Allow Optional ConfigMap and Secrets

- ConfigMaps and Secrets for Env or Volumes are allowed to be optional
This commit is contained in:
Michael Fraenkel
2017-01-16 16:30:22 -08:00
parent 13424d874b
commit 4e466040d9
14 changed files with 1000 additions and 39 deletions

View File

@@ -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