Skip to content

Update KAL and GolangCI-Lint to v2 #2321

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .ci-operator.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
build_root_image:
name: release
namespace: openshift
tag: rhel-9-release-golang-1.23-openshift-4.19
tag: rhel-9-release-golang-1.24-openshift-4.20
64 changes: 46 additions & 18 deletions .golangci.yaml
Original file line number Diff line number Diff line change
@@ -1,26 +1,54 @@
linters-settings:
custom:
kubeapilinter:
type: "module"
description: kubeapilinter is the Kube-API-Linter and lints Kube like APIs based on API conventions and best practices.
settings:
linters:
enable:
- "maxlength"
- "nobools"
- "nomaps"
- "statussubresource"
lintersConfig:
conditions:
isFirstField: Warn
useProtobuf: Ignore
usePatchStrategy: Ignore
version: "2"
linters:
disable-all: true
default: none
enable:
- kubeapilinter
settings:
custom:
kubeapilinter:
path: tools/_output/bin/kube-api-linter.so
description: kubeapilinter is the Kube-API-Linter and lints Kube like APIs based on API conventions and best practices.
settings:
linters:
enable:
- maxlength
- nobools
- nomaps
- statussubresource
lintersConfig:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we add a configuration for the new uniquemarkers linter to prevent duplicate feature-gate markers on fields and types?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes we should, will need to work out what the appropriate configuration is for that 🤔

conditions:
isFirstField: Warn
usePatchStrategy: Ignore
useProtobuf: Ignore
optionalfields:
pointers:
preference: WhenRequired
policy: SuggestFix
omitEmpty:
# Ignore missing omitempty so that we can omit the omitempty for discoverability.
# Discoverability is for configuration APIs, generally singletons.
# Refer to the API conventions for when to use discoverability (not our default stance).
policy: Ignore
exclusions:
generated: lax
presets:
- comments
- common-false-positives
- legacy
- std-error-handling
paths:
- third_party$
- builtin$
- examples$
issues:
# We have a lot of existing issues.
# Want to make sure that those adding new fields have an
# opportunity to fix them when running the linter locally.
max-issues-per-linter: 1000
formatters:
exclusions:
generated: lax
paths:
- third_party$
- builtin$
- examples$
4 changes: 2 additions & 2 deletions Dockerfile.ocp
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
FROM registry.ci.openshift.org/ocp/builder:rhel-9-golang-1.23-openshift-4.19 AS builder
FROM registry.ci.openshift.org/ocp/builder:rhel-9-golang-1.24-openshift-4.20 AS builder
WORKDIR /go/src/github.com/openshift/api
COPY . .
ENV GO_PACKAGE github.com/openshift/api
RUN make build --warn-undefined-variables

FROM registry.ci.openshift.org/ocp/4.19:base-rhel9
FROM registry.ci.openshift.org/ocp/4.20:base-rhel9

# copy the built binaries to /usr/bin
COPY --from=builder /go/src/github.com/openshift/api/render /usr/bin/
Expand Down
9 changes: 9 additions & 0 deletions apps/v1/generated.proto

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions apps/v1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -304,26 +304,35 @@ type DeploymentTriggerImageChangeParams struct {
type DeploymentConfigStatus struct {
// latestVersion is used to determine whether the current deployment associated with a deployment
// config is out of sync.
// +optional
LatestVersion int64 `json:"latestVersion" protobuf:"varint,1,opt,name=latestVersion"`
// observedGeneration is the most recent generation observed by the deployment config controller.
// +optional
ObservedGeneration int64 `json:"observedGeneration" protobuf:"varint,2,opt,name=observedGeneration"`
// replicas is the total number of pods targeted by this deployment config.
// +optional
Replicas int32 `json:"replicas" protobuf:"varint,3,opt,name=replicas"`
// updatedReplicas is the total number of non-terminated pods targeted by this deployment config
// that have the desired template spec.
// +optional
UpdatedReplicas int32 `json:"updatedReplicas" protobuf:"varint,4,opt,name=updatedReplicas"`
// availableReplicas is the total number of available pods targeted by this deployment config.
// +optional
AvailableReplicas int32 `json:"availableReplicas" protobuf:"varint,5,opt,name=availableReplicas"`
// unavailableReplicas is the total number of unavailable pods targeted by this deployment config.
// +optional
UnavailableReplicas int32 `json:"unavailableReplicas" protobuf:"varint,6,opt,name=unavailableReplicas"`
// details are the reasons for the update to this deployment config.
// This could be based on a change made by the user or caused by an automatic trigger
// +optional
Details *DeploymentDetails `json:"details,omitempty" protobuf:"bytes,7,opt,name=details"`
// conditions represents the latest available observations of a deployment config's current state.
// +patchMergeKey=type
// +patchStrategy=merge
// +optional
Conditions []DeploymentCondition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,8,rep,name=conditions"`
// Total number of ready pods targeted by this deployment.
// +optional
ReadyReplicas int32 `json:"readyReplicas,omitempty" protobuf:"varint,9,opt,name=readyReplicas"`
}

Expand Down
2 changes: 2 additions & 0 deletions authorization/v1/generated.proto

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions authorization/v1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -208,9 +208,11 @@ type SubjectRulesReviewSpec struct {
// SubjectRulesReviewStatus is contains the result of a rules check
type SubjectRulesReviewStatus struct {
// rules is the list of rules (no particular sort) that are allowed for the subject
// +optional
Rules []PolicyRule `json:"rules" protobuf:"bytes,1,rep,name=rules"`
// evaluationError can appear in combination with Rules. It means some error happened during evaluation
// that may have prevented additional rules from being populated.
// +optional
EvaluationError string `json:"evaluationError,omitempty" protobuf:"bytes,2,opt,name=evaluationError"`
}

Expand Down
15 changes: 15 additions & 0 deletions build/v1/generated.proto

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions build/v1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,54 +192,67 @@ type ImageChangeCause struct {
type BuildStatus struct {
// phase is the point in the build lifecycle. Possible values are
// "New", "Pending", "Running", "Complete", "Failed", "Error", and "Cancelled".
// +optional
Phase BuildPhase `json:"phase" protobuf:"bytes,1,opt,name=phase,casttype=BuildPhase"`

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Expand Down
2 changes: 1 addition & 1 deletion config/v1/types_apiserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ type AuditCustomRule struct {
// If unset, the 'Default' profile is used as the default.
//
// +required
Profile AuditProfileType `json:"profile,omitempty"`
Profile AuditProfileType `json:"profile"`
}

type APIServerServingCerts struct {
Expand Down
Loading