mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-06 07:57:35 +00:00
Allow Optional ConfigMap and Secrets
- ConfigMaps and Secrets for Env or Volumes are allowed to be optional
This commit is contained in:
@@ -286,6 +286,10 @@ func FuzzerFor(t *testing.T, version schema.GroupVersion, src rand.Source) *fuzz
|
||||
func(s *api.SecretVolumeSource, c fuzz.Continue) {
|
||||
c.FuzzNoCustom(s) // fuzz self without calling this function again
|
||||
|
||||
if c.RandBool() {
|
||||
opt := c.RandBool()
|
||||
s.Optional = &opt
|
||||
}
|
||||
// DefaultMode should always be set, it has a default
|
||||
// value and it is expected to be between 0 and 0777
|
||||
var mode int32
|
||||
@@ -296,6 +300,10 @@ func FuzzerFor(t *testing.T, version schema.GroupVersion, src rand.Source) *fuzz
|
||||
func(cm *api.ConfigMapVolumeSource, c fuzz.Continue) {
|
||||
c.FuzzNoCustom(cm) // fuzz self without calling this function again
|
||||
|
||||
if c.RandBool() {
|
||||
opt := c.RandBool()
|
||||
cm.Optional = &opt
|
||||
}
|
||||
// DefaultMode should always be set, it has a default
|
||||
// value and it is expected to be between 0 and 0777
|
||||
var mode int32
|
||||
@@ -401,6 +409,10 @@ func FuzzerFor(t *testing.T, version schema.GroupVersion, src rand.Source) *fuzz
|
||||
},
|
||||
func(cm *api.ConfigMapEnvSource, c fuzz.Continue) {
|
||||
c.FuzzNoCustom(cm) // fuzz self without calling this function again
|
||||
if c.RandBool() {
|
||||
opt := c.RandBool()
|
||||
cm.Optional = &opt
|
||||
}
|
||||
},
|
||||
func(s *api.SecretEnvSource, c fuzz.Continue) {
|
||||
c.FuzzNoCustom(s) // fuzz self without calling this function again
|
||||
|
||||
@@ -729,8 +729,8 @@ type SecretVolumeSource struct {
|
||||
// key and content is the value. If specified, the listed keys will be
|
||||
// projected into the specified paths, and unlisted keys will not be
|
||||
// present. If a key is specified which is not present in the Secret,
|
||||
// the volume setup will error. Paths must be relative and may not contain
|
||||
// the '..' path or start with '..'.
|
||||
// the volume setup will error unless it is marked optional. Paths must be
|
||||
// relative and may not contain the '..' path or start with '..'.
|
||||
// +optional
|
||||
Items []KeyToPath
|
||||
// Mode bits to use on created files by default. Must be a value between
|
||||
@@ -740,6 +740,9 @@ type SecretVolumeSource struct {
|
||||
// mode, like fsGroup, and the result can be other mode bits set.
|
||||
// +optional
|
||||
DefaultMode *int32
|
||||
// Specify whether the Secret or it's key must be defined
|
||||
// +optional
|
||||
Optional *bool
|
||||
}
|
||||
|
||||
// Represents an NFS mount that lasts the lifetime of a pod.
|
||||
@@ -992,8 +995,8 @@ type ConfigMapVolumeSource struct {
|
||||
// key and content is the value. If specified, the listed keys will be
|
||||
// projected into the specified paths, and unlisted keys will not be
|
||||
// present. If a key is specified which is not present in the ConfigMap,
|
||||
// the volume setup will error. Paths must be relative and may not contain
|
||||
// the '..' path or start with '..'.
|
||||
// the volume setup will error unless it is marked optional. Paths must be
|
||||
// relative and may not contain the '..' path or start with '..'.
|
||||
// +optional
|
||||
Items []KeyToPath
|
||||
// Mode bits to use on created files by default. Must be a value between
|
||||
@@ -1003,6 +1006,9 @@ type ConfigMapVolumeSource struct {
|
||||
// mode, like fsGroup, and the result can be other mode bits set.
|
||||
// +optional
|
||||
DefaultMode *int32
|
||||
// Specify whether the ConfigMap or it's keys must be defined
|
||||
// +optional
|
||||
Optional *bool
|
||||
}
|
||||
|
||||
// Maps a string key to a path within a volume.
|
||||
@@ -1124,6 +1130,9 @@ type ConfigMapKeySelector struct {
|
||||
LocalObjectReference
|
||||
// The key to select.
|
||||
Key string
|
||||
// Specify whether the ConfigMap or it's key must be defined
|
||||
// +optional
|
||||
Optional *bool
|
||||
}
|
||||
|
||||
// SecretKeySelector selects a key of a Secret.
|
||||
@@ -1132,6 +1141,9 @@ type SecretKeySelector struct {
|
||||
LocalObjectReference
|
||||
// The key of the secret to select from. Must be a valid secret key.
|
||||
Key string
|
||||
// Specify whether the Secret or it's key must be defined
|
||||
// +optional
|
||||
Optional *bool
|
||||
}
|
||||
|
||||
// EnvFromSource represents the source of a set of ConfigMaps
|
||||
@@ -1155,6 +1167,9 @@ type EnvFromSource struct {
|
||||
type ConfigMapEnvSource struct {
|
||||
// The ConfigMap to select from.
|
||||
LocalObjectReference
|
||||
// Specify whether the ConfigMap must be defined
|
||||
// +optional
|
||||
Optional *bool
|
||||
}
|
||||
|
||||
// SecretEnvSource selects a Secret to populate the environment
|
||||
@@ -1165,6 +1180,9 @@ type ConfigMapEnvSource struct {
|
||||
type SecretEnvSource struct {
|
||||
// The Secret to select from.
|
||||
LocalObjectReference
|
||||
// Specify whether the Secret must be defined
|
||||
// +optional
|
||||
Optional *bool
|
||||
}
|
||||
|
||||
// HTTPHeader describes a custom header to be used in HTTP probes
|
||||
|
||||
@@ -924,8 +924,8 @@ type SecretVolumeSource struct {
|
||||
// key and content is the value. If specified, the listed keys will be
|
||||
// projected into the specified paths, and unlisted keys will not be
|
||||
// present. If a key is specified which is not present in the Secret,
|
||||
// the volume setup will error. Paths must be relative and may not contain
|
||||
// the '..' path or start with '..'.
|
||||
// the volume setup will error unless it is marked optional. Paths must be
|
||||
// relative and may not contain the '..' path or start with '..'.
|
||||
// +optional
|
||||
Items []KeyToPath `json:"items,omitempty" protobuf:"bytes,2,rep,name=items"`
|
||||
// Optional: mode bits to use on created files by default. Must be a
|
||||
@@ -935,6 +935,9 @@ type SecretVolumeSource struct {
|
||||
// mode, like fsGroup, and the result can be other mode bits set.
|
||||
// +optional
|
||||
DefaultMode *int32 `json:"defaultMode,omitempty" protobuf:"bytes,3,opt,name=defaultMode"`
|
||||
// Specify whether the Secret or it's keys must be defined
|
||||
// +optional
|
||||
Optional *bool `json:"optional,omitempty" protobuf:"varint,4,opt,name=optional"`
|
||||
}
|
||||
|
||||
const (
|
||||
@@ -1081,8 +1084,8 @@ type ConfigMapVolumeSource struct {
|
||||
// key and content is the value. If specified, the listed keys will be
|
||||
// projected into the specified paths, and unlisted keys will not be
|
||||
// present. If a key is specified which is not present in the ConfigMap,
|
||||
// the volume setup will error. Paths must be relative and may not contain
|
||||
// the '..' path or start with '..'.
|
||||
// the volume setup will error unless it is marked optional. Paths must be
|
||||
// relative and may not contain the '..' path or start with '..'.
|
||||
// +optional
|
||||
Items []KeyToPath `json:"items,omitempty" protobuf:"bytes,2,rep,name=items"`
|
||||
// Optional: mode bits to use on created files by default. Must be a
|
||||
@@ -1092,6 +1095,9 @@ type ConfigMapVolumeSource struct {
|
||||
// mode, like fsGroup, and the result can be other mode bits set.
|
||||
// +optional
|
||||
DefaultMode *int32 `json:"defaultMode,omitempty" protobuf:"varint,3,opt,name=defaultMode"`
|
||||
// Specify whether the ConfigMap or it's keys must be defined
|
||||
// +optional
|
||||
Optional *bool `json:"optional,omitempty" protobuf:"varint,4,opt,name=optional"`
|
||||
}
|
||||
|
||||
const (
|
||||
@@ -1225,6 +1231,9 @@ type ConfigMapKeySelector struct {
|
||||
LocalObjectReference `json:",inline" protobuf:"bytes,1,opt,name=localObjectReference"`
|
||||
// The key to select.
|
||||
Key string `json:"key" protobuf:"bytes,2,opt,name=key"`
|
||||
// Specify whether the ConfigMap or it's key must be defined
|
||||
// +optional
|
||||
Optional *bool `json:"optional,omitempty" protobuf:"varint,3,opt,name=optional"`
|
||||
}
|
||||
|
||||
// SecretKeySelector selects a key of a Secret.
|
||||
@@ -1233,6 +1242,9 @@ type SecretKeySelector struct {
|
||||
LocalObjectReference `json:",inline" protobuf:"bytes,1,opt,name=localObjectReference"`
|
||||
// The key of the secret to select from. Must be a valid secret key.
|
||||
Key string `json:"key" protobuf:"bytes,2,opt,name=key"`
|
||||
// Specify whether the Secret or it's key must be defined
|
||||
// +optional
|
||||
Optional *bool `json:"optional,omitempty" protobuf:"varint,3,opt,name=optional"`
|
||||
}
|
||||
|
||||
// EnvFromSource represents the source of a set of ConfigMaps
|
||||
@@ -1256,6 +1268,9 @@ type EnvFromSource struct {
|
||||
type ConfigMapEnvSource struct {
|
||||
// The ConfigMap to select from.
|
||||
LocalObjectReference `json:",inline" protobuf:"bytes,1,opt,name=localObjectReference"`
|
||||
// Specify whether the ConfigMap must be defined
|
||||
// +optional
|
||||
Optional *bool `json:"optional,omitempty" protobuf:"varint,2,opt,name=optional"`
|
||||
}
|
||||
|
||||
// SecretEnvSource selects a Secret to populate the environment
|
||||
@@ -1266,6 +1281,9 @@ type ConfigMapEnvSource struct {
|
||||
type SecretEnvSource struct {
|
||||
// The Secret to select from.
|
||||
LocalObjectReference `json:",inline" protobuf:"bytes,1,opt,name=localObjectReference"`
|
||||
// Specify whether the Secret must be defined
|
||||
// +optional
|
||||
Optional *bool `json:"optional,omitempty" protobuf:"varint,2,opt,name=optional"`
|
||||
}
|
||||
|
||||
// HTTPHeader describes a custom header to be used in HTTP probes
|
||||
|
||||
Reference in New Issue
Block a user