Skip to content

Commit 2cd5821

Browse files
Merge pull request openshift#2321 from JoelSpeed/golangci-lint-v2
Update KAL and GolangCI-Lint to v2
2 parents c631530 + 636ec89 commit 2cd5821

File tree

1,419 files changed

+126591
-19633
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,419 files changed

+126591
-19633
lines changed

.golangci.yaml

Lines changed: 61 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,69 @@
1-
linters-settings:
2-
custom:
3-
kubeapilinter:
4-
type: "module"
5-
description: kubeapilinter is the Kube-API-Linter and lints Kube like APIs based on API conventions and best practices.
6-
settings:
7-
linters:
8-
enable:
9-
- "maxlength"
10-
- "nobools"
11-
- "nomaps"
12-
- "statussubresource"
13-
lintersConfig:
14-
conditions:
15-
isFirstField: Warn
16-
useProtobuf: Ignore
17-
usePatchStrategy: Ignore
1+
version: "2"
182
linters:
19-
disable-all: true
3+
default: none
204
enable:
215
- kubeapilinter
6+
settings:
7+
custom:
8+
kubeapilinter:
9+
path: tools/_output/bin/kube-api-linter.so
10+
description: kubeapilinter is the Kube-API-Linter and lints Kube like APIs based on API conventions and best practices.
11+
settings:
12+
linters:
13+
enable:
14+
- maxlength
15+
- nobools
16+
- nomaps
17+
- statussubresource
18+
lintersConfig:
19+
conditions:
20+
isFirstField: Warn
21+
usePatchStrategy: Ignore
22+
useProtobuf: Ignore
23+
optionalfields:
24+
pointers:
25+
preference: WhenRequired
26+
policy: SuggestFix
27+
omitEmpty:
28+
# Ignore missing omitempty so that we can omit the omitempty for discoverability.
29+
# Discoverability is for configuration APIs, generally singletons.
30+
# Refer to the API conventions for when to use discoverability (not our default stance).
31+
policy: Ignore
32+
uniqueMarkers:
33+
customMarkers:
34+
- identifier: "openshift:validation:FeatureGateAwareEnum"
35+
attributes:
36+
- featureGate
37+
- requiredFeatureGate
38+
- identifier: "openshift:validation:FeatureGateMaxItems"
39+
attributes:
40+
- featureGate
41+
- requiredFeatureGate
42+
- identifier: "openshift:validation:FeatureGateAwareXValidation"
43+
attributes:
44+
- featureGate
45+
- requiredFeatureGate
46+
- rule
47+
exclusions:
48+
generated: lax
49+
presets:
50+
- comments
51+
- common-false-positives
52+
- legacy
53+
- std-error-handling
54+
paths:
55+
- third_party$
56+
- builtin$
57+
- examples$
2258
issues:
2359
# We have a lot of existing issues.
2460
# Want to make sure that those adding new fields have an
2561
# opportunity to fix them when running the linter locally.
2662
max-issues-per-linter: 1000
63+
formatters:
64+
exclusions:
65+
generated: lax
66+
paths:
67+
- third_party$
68+
- builtin$
69+
- examples$

apps/v1/generated.proto

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apps/v1/types.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,26 +304,35 @@ type DeploymentTriggerImageChangeParams struct {
304304
type DeploymentConfigStatus struct {
305305
// latestVersion is used to determine whether the current deployment associated with a deployment
306306
// config is out of sync.
307+
// +optional
307308
LatestVersion int64 `json:"latestVersion" protobuf:"varint,1,opt,name=latestVersion"`
308309
// observedGeneration is the most recent generation observed by the deployment config controller.
310+
// +optional
309311
ObservedGeneration int64 `json:"observedGeneration" protobuf:"varint,2,opt,name=observedGeneration"`
310312
// replicas is the total number of pods targeted by this deployment config.
313+
// +optional
311314
Replicas int32 `json:"replicas" protobuf:"varint,3,opt,name=replicas"`
312315
// updatedReplicas is the total number of non-terminated pods targeted by this deployment config
313316
// that have the desired template spec.
317+
// +optional
314318
UpdatedReplicas int32 `json:"updatedReplicas" protobuf:"varint,4,opt,name=updatedReplicas"`
315319
// availableReplicas is the total number of available pods targeted by this deployment config.
320+
// +optional
316321
AvailableReplicas int32 `json:"availableReplicas" protobuf:"varint,5,opt,name=availableReplicas"`
317322
// unavailableReplicas is the total number of unavailable pods targeted by this deployment config.
323+
// +optional
318324
UnavailableReplicas int32 `json:"unavailableReplicas" protobuf:"varint,6,opt,name=unavailableReplicas"`
319325
// details are the reasons for the update to this deployment config.
320326
// This could be based on a change made by the user or caused by an automatic trigger
327+
// +optional
321328
Details *DeploymentDetails `json:"details,omitempty" protobuf:"bytes,7,opt,name=details"`
322329
// conditions represents the latest available observations of a deployment config's current state.
323330
// +patchMergeKey=type
324331
// +patchStrategy=merge
332+
// +optional
325333
Conditions []DeploymentCondition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,8,rep,name=conditions"`
326334
// Total number of ready pods targeted by this deployment.
335+
// +optional
327336
ReadyReplicas int32 `json:"readyReplicas,omitempty" protobuf:"varint,9,opt,name=readyReplicas"`
328337
}
329338

authorization/v1/generated.proto

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

authorization/v1/types.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,9 +208,11 @@ type SubjectRulesReviewSpec struct {
208208
// SubjectRulesReviewStatus is contains the result of a rules check
209209
type SubjectRulesReviewStatus struct {
210210
// rules is the list of rules (no particular sort) that are allowed for the subject
211+
// +optional
211212
Rules []PolicyRule `json:"rules" protobuf:"bytes,1,rep,name=rules"`
212213
// evaluationError can appear in combination with Rules. It means some error happened during evaluation
213214
// that may have prevented additional rules from being populated.
215+
// +optional
214216
EvaluationError string `json:"evaluationError,omitempty" protobuf:"bytes,2,opt,name=evaluationError"`
215217
}
216218

build/v1/generated.proto

Lines changed: 15 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/v1/types.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,54 +192,67 @@ type ImageChangeCause struct {
192192
type BuildStatus struct {
193193
// phase is the point in the build lifecycle. Possible values are
194194
// "New", "Pending", "Running", "Complete", "Failed", "Error", and "Cancelled".
195+
// +optional
195196
Phase BuildPhase `json:"phase" protobuf:"bytes,1,opt,name=phase,casttype=BuildPhase"`
196197

197198
// cancelled describes if a cancel event was triggered for the build.
199+
// +optional
198200
Cancelled bool `json:"cancelled,omitempty" protobuf:"varint,2,opt,name=cancelled"`
199201

200202
// reason is a brief CamelCase string that describes any failure and is meant for machine parsing and tidy display in the CLI.
203+
// +optional
201204
Reason StatusReason `json:"reason,omitempty" protobuf:"bytes,3,opt,name=reason,casttype=StatusReason"`
202205

203206
// message is a human-readable message indicating details about why the build has this status.
207+
// +optional
204208
Message string `json:"message,omitempty" protobuf:"bytes,4,opt,name=message"`
205209

206210
// startTimestamp is a timestamp representing the server time when this Build started
207211
// running in a Pod.
208212
// It is represented in RFC3339 form and is in UTC.
213+
// +optional
209214
StartTimestamp *metav1.Time `json:"startTimestamp,omitempty" protobuf:"bytes,5,opt,name=startTimestamp"`
210215

211216
// completionTimestamp is a timestamp representing the server time when this Build was
212217
// finished, whether that build failed or succeeded. It reflects the time at which
213218
// the Pod running the Build terminated.
214219
// It is represented in RFC3339 form and is in UTC.
220+
// +optional
215221
CompletionTimestamp *metav1.Time `json:"completionTimestamp,omitempty" protobuf:"bytes,6,opt,name=completionTimestamp"`
216222

217223
// duration contains time.Duration object describing build time.
224+
// +optional
218225
Duration time.Duration `json:"duration,omitempty" protobuf:"varint,7,opt,name=duration,casttype=time.Duration"`
219226

220227
// outputDockerImageReference contains a reference to the container image that
221228
// will be built by this build. Its value is computed from
222229
// Build.Spec.Output.To, and should include the registry address, so that
223230
// it can be used to push and pull the image.
231+
// +optional
224232
OutputDockerImageReference string `json:"outputDockerImageReference,omitempty" protobuf:"bytes,8,opt,name=outputDockerImageReference"`
225233

226234
// config is an ObjectReference to the BuildConfig this Build is based on.
235+
// +optional
227236
Config *corev1.ObjectReference `json:"config,omitempty" protobuf:"bytes,9,opt,name=config"`
228237

229238
// output describes the container image the build has produced.
239+
// +optional
230240
Output BuildStatusOutput `json:"output,omitempty" protobuf:"bytes,10,opt,name=output"`
231241

232242
// stages contains details about each stage that occurs during the build
233243
// including start time, duration (in milliseconds), and the steps that
234244
// occured within each stage.
245+
// +optional
235246
Stages []StageInfo `json:"stages,omitempty" protobuf:"bytes,11,opt,name=stages"`
236247

237248
// logSnippet is the last few lines of the build log. This value is only set for builds that failed.
249+
// +optional
238250
LogSnippet string `json:"logSnippet,omitempty" protobuf:"bytes,12,opt,name=logSnippet"`
239251

240252
// conditions represents the latest available observations of a build's current state.
241253
// +patchMergeKey=type
242254
// +patchStrategy=merge
255+
// +optional
243256
Conditions []BuildCondition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,13,rep,name=conditions"`
244257
}
245258

@@ -1005,11 +1018,13 @@ const (
10051018
// BuildConfigStatus contains current state of the build config object.
10061019
type BuildConfigStatus struct {
10071020
// lastVersion is used to inform about number of last triggered build.
1021+
// +optional
10081022
LastVersion int64 `json:"lastVersion" protobuf:"varint,1,opt,name=lastVersion"`
10091023

10101024
// imageChangeTriggers captures the runtime state of any ImageChangeTrigger specified in the BuildConfigSpec,
10111025
// including the value reconciled by the OpenShift APIServer for the lastTriggeredImageID. There is a single entry
10121026
// in this array for each image change trigger in spec. Each trigger status references the ImageStreamTag that acts as the source of the trigger.
1027+
// +optional
10131028
ImageChangeTriggers []ImageChangeTriggerStatus `json:"imageChangeTriggers,omitempty" protobuf:"bytes,2,rep,name=imageChangeTriggers"`
10141029
}
10151030

config/v1/types_apiserver.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ type AuditCustomRule struct {
146146
// If unset, the 'Default' profile is used as the default.
147147
//
148148
// +required
149-
Profile AuditProfileType `json:"profile,omitempty"`
149+
Profile AuditProfileType `json:"profile"`
150150
}
151151

152152
type APIServerServingCerts struct {

config/v1/types_authentication.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ type AuthenticationStatus struct {
108108
// If the config map or expected key is not found, no metadata is served.
109109
// If the specified metadata is not valid, no metadata is served.
110110
// The namespace for this config map is openshift-config-managed.
111+
// +optional
111112
IntegratedOAuthMetadata ConfigMapNameReference `json:"integratedOAuthMetadata"`
112113

113114
// oidcClients is where participating operators place the current OIDC client status
@@ -119,6 +120,7 @@ type AuthenticationStatus struct {
119120
// +kubebuilder:validation:MaxItems=20
120121
// +openshift:enable:FeatureGate=ExternalOIDC
121122
// +openshift:enable:FeatureGate=ExternalOIDCWithUIDAndExtraClaimMappings
123+
// +optional
122124
OIDCClients []OIDCClientStatus `json:"oidcClients"`
123125
}
124126

@@ -207,7 +209,7 @@ type OIDCProvider struct {
207209
Name string `json:"name"`
208210

209211
// issuer is a required field that configures how the platform interacts
210-
// with the identity provider and how tokens issued from the identity provider
212+
// with the identity provider and how tokens issued from the identity provider
211213
// are evaluated by the Kubernetes API server.
212214
//
213215
// +required
@@ -737,7 +739,7 @@ type TokenClaimValidationRule struct {
737739
// JWT is valid for this identity provider.
738740
//
739741
// +optional
740-
RequiredClaim *TokenRequiredClaim `json:"requiredClaim"`
742+
RequiredClaim *TokenRequiredClaim `json:"requiredClaim,omitempty"`
741743
}
742744

743745
type TokenRequiredClaim struct {

0 commit comments

Comments
 (0)