mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-07-17 11:28:58 +00:00
Enforce either optional or required tag on apiserverinternal API group
This commit is contained in:
@@ -214,7 +214,7 @@ linters:
|
||||
|
||||
# OptionalOrRequired is being enabled over time. For now, each API group should be added to this list until we comb through each group and fix the missing tags.
|
||||
- text: "must be marked as optional or required"
|
||||
path: "staging/src/k8s.io/api/(admission|apidiscovery|apiserverinternal|apps|authentication|authorization|autoscaling|batch|certificates|coordination|core|discovery|events|extensions|flowcontrol|networking|rbac|resource|storage|storagemigration)"
|
||||
path: "staging/src/k8s.io/api/(admission|apidiscovery|apps|authentication|authorization|autoscaling|batch|certificates|coordination|core|discovery|events|extensions|flowcontrol|networking|rbac|resource|storage|storagemigration)"
|
||||
|
||||
# OptionalOrRequired - Existing fields that are marked as both optional and required (based on standard optional vs kubebuilder:validation:Required) and should not be fixed.
|
||||
- text: "field (PortStatus|IngressPortStatus)\\.Error must not be marked as both optional and required"
|
||||
@@ -444,7 +444,6 @@ linters:
|
||||
# nomaps:
|
||||
# policy: AllowStringToStringMaps # Determines how the linter should handle maps of basic types. Maps of objects are always disallowed.
|
||||
# optionalFields:
|
||||
# policy: AllowOptionalFields # Determines how the linter should handle optional fields.optionalfields:
|
||||
# pointers:
|
||||
# preference: Always | WhenRequired # Whether to always require pointers, or only when required. Defaults to `Always`.
|
||||
# policy: SuggestFix | Warn # The policy for pointers in optional fields. Defaults to `SuggestFix`.
|
||||
@@ -455,7 +454,6 @@ linters:
|
||||
# optionalOrRequired:
|
||||
# preferredOptionalMarker: optional # The preferred optional marker to use, fixes will suggest to use this marker. Defaults to `optional`.
|
||||
# preferredRequiredMarker: required # The preferred required marker to use, fixes will suggest to use this marker. Defaults to `required`.
|
||||
# policy: AllowOptionalFields # Determines how the linter should handle optional fields.
|
||||
# requiredFields:
|
||||
# pointers:
|
||||
# policy: SuggestFix | Warn # The policy for pointers in required fields. Defaults to `SuggestFix`.
|
||||
|
||||
@@ -225,7 +225,7 @@ linters:
|
||||
|
||||
# OptionalOrRequired is being enabled over time. For now, each API group should be added to this list until we comb through each group and fix the missing tags.
|
||||
- text: "must be marked as optional or required"
|
||||
path: "staging/src/k8s.io/api/(admission|apidiscovery|apiserverinternal|apps|authentication|authorization|autoscaling|batch|certificates|coordination|core|discovery|events|extensions|flowcontrol|networking|rbac|resource|storage|storagemigration)"
|
||||
path: "staging/src/k8s.io/api/(admission|apidiscovery|apps|authentication|authorization|autoscaling|batch|certificates|coordination|core|discovery|events|extensions|flowcontrol|networking|rbac|resource|storage|storagemigration)"
|
||||
|
||||
# OptionalOrRequired - Existing fields that are marked as both optional and required (based on standard optional vs kubebuilder:validation:Required) and should not be fixed.
|
||||
- text: "field (PortStatus|IngressPortStatus)\\.Error must not be marked as both optional and required"
|
||||
@@ -453,7 +453,6 @@ linters:
|
||||
# nomaps:
|
||||
# policy: AllowStringToStringMaps # Determines how the linter should handle maps of basic types. Maps of objects are always disallowed.
|
||||
# optionalFields:
|
||||
# policy: AllowOptionalFields # Determines how the linter should handle optional fields.optionalfields:
|
||||
# pointers:
|
||||
# preference: Always | WhenRequired # Whether to always require pointers, or only when required. Defaults to `Always`.
|
||||
# policy: SuggestFix | Warn # The policy for pointers in optional fields. Defaults to `SuggestFix`.
|
||||
@@ -464,7 +463,6 @@ linters:
|
||||
# optionalOrRequired:
|
||||
# preferredOptionalMarker: optional # The preferred optional marker to use, fixes will suggest to use this marker. Defaults to `optional`.
|
||||
# preferredRequiredMarker: required # The preferred required marker to use, fixes will suggest to use this marker. Defaults to `required`.
|
||||
# policy: AllowOptionalFields # Determines how the linter should handle optional fields.
|
||||
# requiredFields:
|
||||
# pointers:
|
||||
# policy: SuggestFix | Warn # The policy for pointers in required fields. Defaults to `SuggestFix`.
|
||||
|
||||
@@ -90,7 +90,7 @@
|
||||
|
||||
# OptionalOrRequired is being enabled over time. For now, each API group should be added to this list until we comb through each group and fix the missing tags.
|
||||
- text: "must be marked as optional or required"
|
||||
path: "staging/src/k8s.io/api/(admission|apidiscovery|apiserverinternal|apps|authentication|authorization|autoscaling|batch|certificates|coordination|core|discovery|events|extensions|flowcontrol|networking|rbac|resource|storage|storagemigration)"
|
||||
path: "staging/src/k8s.io/api/(admission|apidiscovery|apps|authentication|authorization|autoscaling|batch|certificates|coordination|core|discovery|events|extensions|flowcontrol|networking|rbac|resource|storage|storagemigration)"
|
||||
|
||||
# OptionalOrRequired - Existing fields that are marked as both optional and required (based on standard optional vs kubebuilder:validation:Required) and should not be fixed.
|
||||
- text: "field (PortStatus|IngressPortStatus)\\.Error must not be marked as both optional and required"
|
||||
|
||||
@@ -51,7 +51,6 @@ lintersConfig:
|
||||
# nomaps:
|
||||
# policy: AllowStringToStringMaps # Determines how the linter should handle maps of basic types. Maps of objects are always disallowed.
|
||||
# optionalFields:
|
||||
# policy: AllowOptionalFields # Determines how the linter should handle optional fields.optionalfields:
|
||||
# pointers:
|
||||
# preference: Always | WhenRequired # Whether to always require pointers, or only when required. Defaults to `Always`.
|
||||
# policy: SuggestFix | Warn # The policy for pointers in optional fields. Defaults to `SuggestFix`.
|
||||
@@ -62,7 +61,6 @@ lintersConfig:
|
||||
# optionalOrRequired:
|
||||
# preferredOptionalMarker: optional # The preferred optional marker to use, fixes will suggest to use this marker. Defaults to `optional`.
|
||||
# preferredRequiredMarker: required # The preferred required marker to use, fixes will suggest to use this marker. Defaults to `required`.
|
||||
# policy: AllowOptionalFields # Determines how the linter should handle optional fields.
|
||||
# requiredFields:
|
||||
# pointers:
|
||||
# policy: SuggestFix | Warn # The policy for pointers in required fields. Defaults to `SuggestFix`.
|
||||
|
||||
@@ -28,13 +28,16 @@ import (
|
||||
type StorageVersion struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
// The name is <group>.<resource>.
|
||||
// +required
|
||||
metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
|
||||
|
||||
// Spec is an empty spec. It is here to comply with Kubernetes API style.
|
||||
// +optional
|
||||
Spec StorageVersionSpec `json:"spec" protobuf:"bytes,2,opt,name=spec"`
|
||||
|
||||
// API server instances report the version they can decode and the version they
|
||||
// encode objects to when persisting objects in the backend.
|
||||
// +optional
|
||||
Status StorageVersionStatus `json:"status" protobuf:"bytes,3,opt,name=status"`
|
||||
}
|
||||
|
||||
@@ -67,20 +70,24 @@ type StorageVersionStatus struct {
|
||||
// encodes objects to when persisting objects in the backend.
|
||||
type ServerStorageVersion struct {
|
||||
// The ID of the reporting API server.
|
||||
APIServerID string `json:"apiServerID,omitempty" protobuf:"bytes,1,opt,name=apiServerID"`
|
||||
// +required
|
||||
APIServerID string `json:"apiServerID" protobuf:"bytes,1,opt,name=apiServerID"`
|
||||
|
||||
// The API server encodes the object to this version when persisting it in
|
||||
// the backend (e.g., etcd).
|
||||
EncodingVersion string `json:"encodingVersion,omitempty" protobuf:"bytes,2,opt,name=encodingVersion"`
|
||||
// +required
|
||||
EncodingVersion string `json:"encodingVersion" protobuf:"bytes,2,opt,name=encodingVersion"`
|
||||
|
||||
// The API server can decode objects encoded in these versions.
|
||||
// The encodingVersion must be included in the decodableVersions.
|
||||
// +listType=set
|
||||
DecodableVersions []string `json:"decodableVersions,omitempty" protobuf:"bytes,3,opt,name=decodableVersions"`
|
||||
// +required
|
||||
DecodableVersions []string `json:"decodableVersions" protobuf:"bytes,3,opt,name=decodableVersions"`
|
||||
|
||||
// The API server can serve these versions.
|
||||
// DecodableVersions must include all ServedVersions.
|
||||
// +listType=set
|
||||
// +optional
|
||||
ServedVersions []string `json:"servedVersions,omitempty" protobuf:"bytes,4,opt,name=servedVersions"`
|
||||
}
|
||||
|
||||
@@ -111,6 +118,7 @@ type StorageVersionCondition struct {
|
||||
// +optional
|
||||
ObservedGeneration int64 `json:"observedGeneration,omitempty" protobuf:"varint,3,opt,name=observedGeneration"`
|
||||
// Last time the condition transitioned from one status to another.
|
||||
// +optional
|
||||
LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty" protobuf:"bytes,4,opt,name=lastTransitionTime"`
|
||||
// The reason for the condition's last transition.
|
||||
// +required
|
||||
|
||||
Reference in New Issue
Block a user