add enum markers for built-in v1 types.

This commit is contained in:
Jiahui Feng 2021-11-15 11:37:06 -08:00
parent 52d8b53663
commit e916e5dab3
9 changed files with 62 additions and 0 deletions

View File

@ -64,6 +64,7 @@ type Rule struct {
} }
// ScopeType specifies a scope for a Rule. // ScopeType specifies a scope for a Rule.
// +enum
type ScopeType string type ScopeType string
const ( const (
@ -77,6 +78,7 @@ const (
) )
// FailurePolicyType specifies a failure policy that defines how unrecognized errors from the admission endpoint are handled. // FailurePolicyType specifies a failure policy that defines how unrecognized errors from the admission endpoint are handled.
// +enum
type FailurePolicyType string type FailurePolicyType string
const ( const (
@ -87,6 +89,7 @@ const (
) )
// MatchPolicyType specifies the type of match policy. // MatchPolicyType specifies the type of match policy.
// +enum
type MatchPolicyType string type MatchPolicyType string
const ( const (
@ -97,6 +100,7 @@ const (
) )
// SideEffectClass specifies the types of side effects a webhook may have. // SideEffectClass specifies the types of side effects a webhook may have.
// +enum
type SideEffectClass string type SideEffectClass string
const ( const (
@ -450,6 +454,7 @@ type MutatingWebhook struct {
} }
// ReinvocationPolicyType specifies what type of policy the admission hook uses. // ReinvocationPolicyType specifies what type of policy the admission hook uses.
// +enum
type ReinvocationPolicyType string type ReinvocationPolicyType string
const ( const (
@ -476,6 +481,7 @@ type RuleWithOperations struct {
} }
// OperationType specifies an operation for a request. // OperationType specifies an operation for a request.
// +enum
type OperationType string type OperationType string
// The constants should be kept in sync with those defined in k8s.io/kubernetes/pkg/admission/interface.go. // The constants should be kept in sync with those defined in k8s.io/kubernetes/pkg/admission/interface.go.

View File

@ -61,6 +61,7 @@ type StatefulSet struct {
} }
// PodManagementPolicyType defines the policy for creating pods under a stateful set. // PodManagementPolicyType defines the policy for creating pods under a stateful set.
// +enum
type PodManagementPolicyType string type PodManagementPolicyType string
const ( const (
@ -90,6 +91,7 @@ type StatefulSetUpdateStrategy struct {
// StatefulSetUpdateStrategyType is a string enumeration type that enumerates // StatefulSetUpdateStrategyType is a string enumeration type that enumerates
// all possible update strategies for the StatefulSet controller. // all possible update strategies for the StatefulSet controller.
// +enum
type StatefulSetUpdateStrategyType string type StatefulSetUpdateStrategyType string
const ( const (
@ -352,6 +354,7 @@ type DeploymentStrategy struct {
RollingUpdate *RollingUpdateDeployment `json:"rollingUpdate,omitempty" protobuf:"bytes,2,opt,name=rollingUpdate"` RollingUpdate *RollingUpdateDeployment `json:"rollingUpdate,omitempty" protobuf:"bytes,2,opt,name=rollingUpdate"`
} }
// +enum
type DeploymentStrategyType string type DeploymentStrategyType string
const ( const (
@ -493,6 +496,7 @@ type DaemonSetUpdateStrategy struct {
RollingUpdate *RollingUpdateDaemonSet `json:"rollingUpdate,omitempty" protobuf:"bytes,2,opt,name=rollingUpdate"` RollingUpdate *RollingUpdateDaemonSet `json:"rollingUpdate,omitempty" protobuf:"bytes,2,opt,name=rollingUpdate"`
} }
// +enum
type DaemonSetUpdateStrategyType string type DaemonSetUpdateStrategyType string
const ( const (

View File

@ -150,6 +150,7 @@ type ScaleStatus struct {
// the types below are used in the alpha metrics annotation // the types below are used in the alpha metrics annotation
// MetricSourceType indicates the type of metric. // MetricSourceType indicates the type of metric.
// +enum
type MetricSourceType string type MetricSourceType string
const ( const (

View File

@ -71,6 +71,7 @@ type JobList struct {
} }
// CompletionMode specifies how Pod completions of a Job are tracked. // CompletionMode specifies how Pod completions of a Job are tracked.
// +enum
type CompletionMode string type CompletionMode string
const ( const (
@ -288,6 +289,7 @@ type UncountedTerminatedPods struct {
Failed []types.UID `json:"failed,omitempty" protobuf:"bytes,2,rep,name=failed,casttype=k8s.io/apimachinery/pkg/types.UID"` Failed []types.UID `json:"failed,omitempty" protobuf:"bytes,2,rep,name=failed,casttype=k8s.io/apimachinery/pkg/types.UID"`
} }
// +enum
type JobConditionType string type JobConditionType string
// These are valid conditions of a job. // These are valid conditions of a job.
@ -412,6 +414,7 @@ type CronJobSpec struct {
// Only one of the following concurrent policies may be specified. // Only one of the following concurrent policies may be specified.
// If none of the following policies is specified, the default one // If none of the following policies is specified, the default one
// is AllowConcurrent. // is AllowConcurrent.
// +enum
type ConcurrencyPolicy string type ConcurrencyPolicy string
const ( const (

View File

@ -214,6 +214,7 @@ type CertificateSigningRequestStatus struct {
} }
// RequestConditionType is the type of a CertificateSigningRequestCondition // RequestConditionType is the type of a CertificateSigningRequestCondition
// +enum
type RequestConditionType string type RequestConditionType string
// Well-known condition types for certificate requests. // Well-known condition types for certificate requests.
@ -278,6 +279,7 @@ type CertificateSigningRequestList struct {
// KeyUsage specifies valid usage contexts for keys. // KeyUsage specifies valid usage contexts for keys.
// See: https://tools.ietf.org/html/rfc5280#section-4.2.1.3 // See: https://tools.ietf.org/html/rfc5280#section-4.2.1.3
// https://tools.ietf.org/html/rfc5280#section-4.2.1.12 // https://tools.ietf.org/html/rfc5280#section-4.2.1.12
// +enum
type KeyUsage string type KeyUsage string
// Valid key usages // Valid key usages

View File

@ -371,6 +371,7 @@ type VolumeNodeAffinity struct {
} }
// PersistentVolumeReclaimPolicy describes a policy for end-of-life maintenance of persistent volumes. // PersistentVolumeReclaimPolicy describes a policy for end-of-life maintenance of persistent volumes.
// +enum
type PersistentVolumeReclaimPolicy string type PersistentVolumeReclaimPolicy string
const ( const (
@ -386,6 +387,7 @@ const (
) )
// PersistentVolumeMode describes how a volume is intended to be consumed, either Block or Filesystem. // PersistentVolumeMode describes how a volume is intended to be consumed, either Block or Filesystem.
// +enum
type PersistentVolumeMode string type PersistentVolumeMode string
const ( const (
@ -517,6 +519,7 @@ type PersistentVolumeClaimSpec struct {
} }
// PersistentVolumeClaimConditionType is a valid value of PersistentVolumeClaimCondition.Type // PersistentVolumeClaimConditionType is a valid value of PersistentVolumeClaimCondition.Type
// +enum
type PersistentVolumeClaimConditionType string type PersistentVolumeClaimConditionType string
const ( const (
@ -566,6 +569,7 @@ type PersistentVolumeClaimStatus struct {
Conditions []PersistentVolumeClaimCondition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,4,rep,name=conditions"` Conditions []PersistentVolumeClaimCondition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,4,rep,name=conditions"`
} }
// +enum
type PersistentVolumeAccessMode string type PersistentVolumeAccessMode string
const ( const (
@ -580,6 +584,7 @@ const (
ReadWriteOncePod PersistentVolumeAccessMode = "ReadWriteOncePod" ReadWriteOncePod PersistentVolumeAccessMode = "ReadWriteOncePod"
) )
// +enum
type PersistentVolumePhase string type PersistentVolumePhase string
const ( const (
@ -598,6 +603,7 @@ const (
VolumeFailed PersistentVolumePhase = "Failed" VolumeFailed PersistentVolumePhase = "Failed"
) )
// +enum
type PersistentVolumeClaimPhase string type PersistentVolumeClaimPhase string
const ( const (
@ -611,6 +617,7 @@ const (
ClaimLost PersistentVolumeClaimPhase = "Lost" ClaimLost PersistentVolumeClaimPhase = "Lost"
) )
// +enum
type HostPathType string type HostPathType string
const ( const (
@ -939,6 +946,7 @@ const (
) )
// Protocol defines network protocols supported for things like container ports. // Protocol defines network protocols supported for things like container ports.
// +enum
type Protocol string type Protocol string
const ( const (
@ -1367,7 +1375,10 @@ type PhotonPersistentDiskVolumeSource struct {
FSType string `json:"fsType,omitempty" protobuf:"bytes,2,opt,name=fsType"` FSType string `json:"fsType,omitempty" protobuf:"bytes,2,opt,name=fsType"`
} }
// +enum
type AzureDataDiskCachingMode string type AzureDataDiskCachingMode string
// +enum
type AzureDataDiskKind string type AzureDataDiskKind string
const ( const (
@ -1892,6 +1903,7 @@ type VolumeMount struct {
} }
// MountPropagationMode describes mount propagation. // MountPropagationMode describes mount propagation.
// +enum
type MountPropagationMode string type MountPropagationMode string
const ( const (
@ -2082,6 +2094,7 @@ type HTTPGetAction struct {
} }
// URIScheme identifies the scheme used for connection to a host for Get actions // URIScheme identifies the scheme used for connection to a host for Get actions
// +enum
type URIScheme string type URIScheme string
const ( const (
@ -2154,6 +2167,7 @@ type Probe struct {
} }
// PullPolicy describes a policy for if/when to pull a container image // PullPolicy describes a policy for if/when to pull a container image
// +enum
type PullPolicy string type PullPolicy string
const ( const (
@ -2166,6 +2180,7 @@ const (
) )
// PreemptionPolicy describes a policy for if/when to preempt a pod. // PreemptionPolicy describes a policy for if/when to preempt a pod.
// +enum
type PreemptionPolicy string type PreemptionPolicy string
const ( const (
@ -2176,6 +2191,7 @@ const (
) )
// TerminationMessagePolicy describes how termination messages are retrieved from a container. // TerminationMessagePolicy describes how termination messages are retrieved from a container.
// +enum
type TerminationMessagePolicy string type TerminationMessagePolicy string
const ( const (
@ -2534,6 +2550,7 @@ type ContainerStatus struct {
} }
// PodPhase is a label for the condition of a pod at the current time. // PodPhase is a label for the condition of a pod at the current time.
// +enum
type PodPhase string type PodPhase string
// These are the valid statuses of pods. // These are the valid statuses of pods.
@ -2558,6 +2575,7 @@ const (
) )
// PodConditionType is a valid value for PodCondition.Type // PodConditionType is a valid value for PodCondition.Type
// +enum
type PodConditionType string type PodConditionType string
// These are valid conditions of pod. // These are valid conditions of pod.
@ -2607,6 +2625,7 @@ type PodCondition struct {
// Only one of the following restart policies may be specified. // Only one of the following restart policies may be specified.
// If none of the following policies is specified, the default one // If none of the following policies is specified, the default one
// is RestartPolicyAlways. // is RestartPolicyAlways.
// +enum
type RestartPolicy string type RestartPolicy string
const ( const (
@ -2616,6 +2635,7 @@ const (
) )
// DNSPolicy defines how a pod's DNS will be configured. // DNSPolicy defines how a pod's DNS will be configured.
// +enum
type DNSPolicy string type DNSPolicy string
const ( const (
@ -2686,6 +2706,7 @@ type NodeSelectorRequirement struct {
// A node selector operator is the set of operators that can be used in // A node selector operator is the set of operators that can be used in
// a node selector requirement. // a node selector requirement.
// +enum
type NodeSelectorOperator string type NodeSelectorOperator string
const ( const (
@ -2903,6 +2924,7 @@ type Taint struct {
TimeAdded *metav1.Time `json:"timeAdded,omitempty" protobuf:"bytes,4,opt,name=timeAdded"` TimeAdded *metav1.Time `json:"timeAdded,omitempty" protobuf:"bytes,4,opt,name=timeAdded"`
} }
// +enum
type TaintEffect string type TaintEffect string
const ( const (
@ -2956,6 +2978,7 @@ type Toleration struct {
} }
// A toleration operator is the set of operators that can be used in a toleration. // A toleration operator is the set of operators that can be used in a toleration.
// +enum
type TolerationOperator string type TolerationOperator string
const ( const (
@ -3245,6 +3268,7 @@ type PodOS struct {
Name OSName `json:"name" protobuf:"bytes,1,opt,name=name"` Name OSName `json:"name" protobuf:"bytes,1,opt,name=name"`
} }
// +enum
type UnsatisfiableConstraintAction string type UnsatisfiableConstraintAction string
const ( const (
@ -3327,6 +3351,7 @@ type HostAlias struct {
// PodFSGroupChangePolicy holds policies that will be used for applying fsGroup to a volume // PodFSGroupChangePolicy holds policies that will be used for applying fsGroup to a volume
// when volume is mounted. // when volume is mounted.
// +enum
type PodFSGroupChangePolicy string type PodFSGroupChangePolicy string
const ( const (
@ -3442,6 +3467,7 @@ type SeccompProfile struct {
} }
// SeccompProfileType defines the supported seccomp profile types. // SeccompProfileType defines the supported seccomp profile types.
// +enum
type SeccompProfileType string type SeccompProfileType string
const ( const (
@ -3455,6 +3481,7 @@ const (
) )
// PodQOSClass defines the supported qos classes of Pods. // PodQOSClass defines the supported qos classes of Pods.
// +enum
type PodQOSClass string type PodQOSClass string
const ( const (
@ -4006,6 +4033,7 @@ type ReplicationControllerList struct {
} }
// Session Affinity Type string // Session Affinity Type string
// +enum
type ServiceAffinity string type ServiceAffinity string
const ( const (
@ -4035,6 +4063,7 @@ type ClientIPConfig struct {
} }
// Service Type string describes ingress methods for a service // Service Type string describes ingress methods for a service
// +enum
type ServiceType string type ServiceType string
const ( const (
@ -4059,6 +4088,7 @@ const (
// ServiceInternalTrafficPolicyType describes the type of traffic routing for // ServiceInternalTrafficPolicyType describes the type of traffic routing for
// internal traffic // internal traffic
// +enum
type ServiceInternalTrafficPolicyType string type ServiceInternalTrafficPolicyType string
const ( const (
@ -4071,6 +4101,7 @@ const (
) )
// Service External Traffic Policy Type string // Service External Traffic Policy Type string
// +enum
type ServiceExternalTrafficPolicyType string type ServiceExternalTrafficPolicyType string
const ( const (
@ -4132,6 +4163,7 @@ type LoadBalancerIngress struct {
// IPFamily represents the IP Family (IPv4 or IPv6). This type is used // IPFamily represents the IP Family (IPv4 or IPv6). This type is used
// to express the family of an IP expressed by a type (e.g. service.spec.ipFamilies). // to express the family of an IP expressed by a type (e.g. service.spec.ipFamilies).
// +enum
type IPFamily string type IPFamily string
const ( const (
@ -4142,6 +4174,7 @@ const (
) )
// IPFamilyPolicyType represents the dual-stack-ness requested or required by a Service // IPFamilyPolicyType represents the dual-stack-ness requested or required by a Service
// +enum
type IPFamilyPolicyType string type IPFamilyPolicyType string
const ( const (
@ -4949,6 +4982,7 @@ type ContainerImage struct {
SizeBytes int64 `json:"sizeBytes,omitempty" protobuf:"varint,2,opt,name=sizeBytes"` SizeBytes int64 `json:"sizeBytes,omitempty" protobuf:"varint,2,opt,name=sizeBytes"`
} }
// +enum
type NodePhase string type NodePhase string
// These are the valid phases of node. // These are the valid phases of node.
@ -4961,6 +4995,7 @@ const (
NodeTerminated NodePhase = "Terminated" NodeTerminated NodePhase = "Terminated"
) )
// +enum
type NodeConditionType string type NodeConditionType string
// These are valid conditions of node. Currently, we don't have enough information to decide // These are valid conditions of node. Currently, we don't have enough information to decide
@ -4999,6 +5034,7 @@ type NodeCondition struct {
Message string `json:"message,omitempty" protobuf:"bytes,6,opt,name=message"` Message string `json:"message,omitempty" protobuf:"bytes,6,opt,name=message"`
} }
// +enum
type NodeAddressType string type NodeAddressType string
// These are valid address type of node. // These are valid address type of node.
@ -5154,6 +5190,7 @@ type NamespaceStatus struct {
Conditions []NamespaceCondition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,2,rep,name=conditions"` Conditions []NamespaceCondition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,2,rep,name=conditions"`
} }
// +enum
type NamespacePhase string type NamespacePhase string
// These are the valid phases of a namespace. // These are the valid phases of a namespace.
@ -5170,6 +5207,7 @@ const (
NamespaceTerminatingCause metav1.CauseType = "NamespaceTerminating" NamespaceTerminatingCause metav1.CauseType = "NamespaceTerminating"
) )
// +enum
type NamespaceConditionType string type NamespaceConditionType string
// These are valid conditions of a namespace. // These are valid conditions of a namespace.
@ -5661,6 +5699,7 @@ type EventList struct {
type List metav1.List type List metav1.List
// LimitType is a type of object that is limited // LimitType is a type of object that is limited
// +enum
type LimitType string type LimitType string
const ( const (
@ -5777,6 +5816,7 @@ const (
) )
// A ResourceQuotaScope defines a filter that must match each object tracked by a quota // A ResourceQuotaScope defines a filter that must match each object tracked by a quota
// +enum
type ResourceQuotaScope string type ResourceQuotaScope string
const ( const (
@ -5839,6 +5879,7 @@ type ScopedResourceSelectorRequirement struct {
// A scope selector operator is the set of operators that can be used in // A scope selector operator is the set of operators that can be used in
// a scope selector requirement. // a scope selector requirement.
// +enum
type ScopeSelectorOperator string type ScopeSelectorOperator string
const ( const (
@ -6281,6 +6322,7 @@ type SecurityContext struct {
SeccompProfile *SeccompProfile `json:"seccompProfile,omitempty" protobuf:"bytes,11,opt,name=seccompProfile"` SeccompProfile *SeccompProfile `json:"seccompProfile,omitempty" protobuf:"bytes,11,opt,name=seccompProfile"`
} }
// +enum
type ProcMountType string type ProcMountType string
const ( const (

View File

@ -55,6 +55,7 @@ type EndpointSlice struct {
} }
// AddressType represents the type of address referred to by an endpoint. // AddressType represents the type of address referred to by an endpoint.
// +enum
type AddressType string type AddressType string
const ( const (

View File

@ -40,6 +40,7 @@ type NetworkPolicy struct {
// PolicyType string describes the NetworkPolicy type // PolicyType string describes the NetworkPolicy type
// This type is beta-level in 1.8 // This type is beta-level in 1.8
// +enum
type PolicyType string type PolicyType string
const ( const (
@ -373,6 +374,7 @@ type HTTPIngressRuleValue struct {
} }
// PathType represents the type of path referred to by a HTTPIngressPath. // PathType represents the type of path referred to by a HTTPIngressPath.
// +enum
type PathType string type PathType string
const ( const (

View File

@ -90,6 +90,7 @@ type StorageClassList struct {
} }
// VolumeBindingMode indicates how PersistentVolumeClaims should be bound. // VolumeBindingMode indicates how PersistentVolumeClaims should be bound.
// +enum
type VolumeBindingMode string type VolumeBindingMode string
const ( const (