From e79288528e01c03fa244cb4c9ff2bed63eb69a39 Mon Sep 17 00:00:00 2001 From: krishhna_dev Date: Mon, 15 Jun 2026 07:23:19 +0000 Subject: [PATCH] imagepolicy: enable commentstart kube-api-linter rule Enable the commentstart kube-api-linter rule for the imagepolicy API group by dropping it from the rule's exclusion list and updating the field godoc comments to start with the serialized (JSON) field name, as the rule requires. This is part of the wider effort to enable kube-api-linter rules on the built-in API groups one group at a time. --- hack/golangci-hints.yaml | 2 +- hack/golangci.yaml | 2 +- hack/kube-api-linter/exceptions.yaml | 2 +- .../k8s.io/api/imagepolicy/v1alpha1/types.go | 20 +++++++++---------- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/hack/golangci-hints.yaml b/hack/golangci-hints.yaml index 4bc74b6f349..55e6bb69598 100644 --- a/hack/golangci-hints.yaml +++ b/hack/golangci-hints.yaml @@ -147,7 +147,7 @@ linters: # Commentstart - Ignore commentstart issues for existing API group # TODO: For each existing API group, we aim to remove it over time. - text: "godoc for field .* should start with '.* ...'" - path: "staging/src/k8s.io/api/(apps|batch|certificates|core|extensions|flowcontrol|imagepolicy|networking|resource|scheduling|storage|storagemigration)" + path: "staging/src/k8s.io/api/(apps|batch|certificates|core|extensions|flowcontrol|networking|resource|scheduling|storage|storagemigration)" # notimestamp: Legacy 'Timestamp' fields retained for backward compatibility - text: 'notimestamp: naming convention "notimestamp": field TokenRequestStatus.ExpirationTimestamp: prefer use of the term ''time'' over ''timestamp''' diff --git a/hack/golangci.yaml b/hack/golangci.yaml index d13a9da56ae..b171a7a3884 100644 --- a/hack/golangci.yaml +++ b/hack/golangci.yaml @@ -162,7 +162,7 @@ linters: # Commentstart - Ignore commentstart issues for existing API group # TODO: For each existing API group, we aim to remove it over time. - text: "godoc for field .* should start with '.* ...'" - path: "staging/src/k8s.io/api/(apps|batch|certificates|core|extensions|flowcontrol|imagepolicy|networking|resource|scheduling|storage|storagemigration)" + path: "staging/src/k8s.io/api/(apps|batch|certificates|core|extensions|flowcontrol|networking|resource|scheduling|storage|storagemigration)" # notimestamp: Legacy 'Timestamp' fields retained for backward compatibility - text: 'notimestamp: naming convention "notimestamp": field TokenRequestStatus.ExpirationTimestamp: prefer use of the term ''time'' over ''timestamp''' diff --git a/hack/kube-api-linter/exceptions.yaml b/hack/kube-api-linter/exceptions.yaml index 185e080a6d7..85d5b2a3a0e 100644 --- a/hack/kube-api-linter/exceptions.yaml +++ b/hack/kube-api-linter/exceptions.yaml @@ -23,7 +23,7 @@ # Commentstart - Ignore commentstart issues for existing API group # TODO: For each existing API group, we aim to remove it over time. - text: "godoc for field .* should start with '.* ...'" - path: "staging/src/k8s.io/api/(apps|batch|certificates|core|extensions|flowcontrol|imagepolicy|networking|resource|scheduling|storage|storagemigration)" + path: "staging/src/k8s.io/api/(apps|batch|certificates|core|extensions|flowcontrol|networking|resource|scheduling|storage|storagemigration)" # notimestamp: Legacy 'Timestamp' fields retained for backward compatibility - text: 'notimestamp: naming convention "notimestamp": field TokenRequestStatus.ExpirationTimestamp: prefer use of the term ''time'' over ''timestamp''' diff --git a/staging/src/k8s.io/api/imagepolicy/v1alpha1/types.go b/staging/src/k8s.io/api/imagepolicy/v1alpha1/types.go index eaa0ab51981..43567ee6b57 100644 --- a/staging/src/k8s.io/api/imagepolicy/v1alpha1/types.go +++ b/staging/src/k8s.io/api/imagepolicy/v1alpha1/types.go @@ -29,39 +29,39 @@ import ( // +k8s:supportsSubresource="/status" type ImageReview struct { metav1.TypeMeta `json:""` - // Standard object's metadata. + // metadata is the standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - // Spec holds information about the pod being evaluated + // spec holds information about the pod being evaluated // +optional Spec ImageReviewSpec `json:"spec" protobuf:"bytes,2,opt,name=spec"` - // Status is filled in by the backend and indicates whether the pod should be allowed. + // status is filled in by the backend and indicates whether the pod should be allowed. // +optional Status ImageReviewStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"` } // ImageReviewSpec is a description of the pod creation request. type ImageReviewSpec struct { - // Containers is a list of a subset of the information in each container of the Pod being created. + // containers is a list of a subset of the information in each container of the Pod being created. // +optional // +listType=atomic Containers []ImageReviewContainerSpec `json:"containers,omitempty" protobuf:"bytes,1,rep,name=containers"` - // Annotations is a list of key-value pairs extracted from the Pod's annotations. + // annotations is a list of key-value pairs extracted from the Pod's annotations. // It only includes keys which match the pattern `*.image-policy.k8s.io/*`. // It is up to each webhook backend to determine how to interpret these annotations, if at all. // +optional Annotations map[string]string `json:"annotations,omitempty" protobuf:"bytes,2,rep,name=annotations"` - // Namespace is the namespace the pod is being created in. + // namespace is the namespace the pod is being created in. // +optional Namespace string `json:"namespace,omitempty" protobuf:"bytes,3,opt,name=namespace"` } // ImageReviewContainerSpec is a description of a container within the pod creation request. type ImageReviewContainerSpec struct { - // This can be in the form image:tag or image@SHA:012345679abcdef. + // image can be in the form image:tag or image@SHA:012345679abcdef. // +optional Image string `json:"image,omitempty" protobuf:"bytes,1,opt,name=image"` // In future, we may add command line overrides, exec health check command lines, and so on. @@ -69,15 +69,15 @@ type ImageReviewContainerSpec struct { // ImageReviewStatus is the result of the review for the pod creation request. type ImageReviewStatus struct { - // Allowed indicates that all images were allowed to be run. + // allowed indicates that all images were allowed to be run. // +optional Allowed bool `json:"allowed" protobuf:"varint,1,opt,name=allowed"` - // Reason should be empty unless Allowed is false in which case it + // reason should be empty unless Allowed is false in which case it // may contain a short description of what is wrong. Kubernetes // may truncate excessively long errors when displaying to the user. // +optional Reason string `json:"reason,omitempty" protobuf:"bytes,2,opt,name=reason"` - // AuditAnnotations will be added to the attributes object of the + // auditAnnotations will be added to the attributes object of the // admission controller request using 'AddAnnotation'. The keys should // be prefix-less (i.e., the admission controller will add an // appropriate prefix).