mirror of
https://github.com/kubernetes/client-go.git
synced 2026-02-22 08:03:18 +00:00
428 lines
23 KiB
Go
428 lines
23 KiB
Go
/*
|
|
Copyright The Kubernetes Authors.
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
you may not use this file except in compliance with the License.
|
|
You may obtain a copy of the License at
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
See the License for the specific language governing permissions and
|
|
limitations under the License.
|
|
*/
|
|
|
|
// Code generated by applyconfiguration-gen. DO NOT EDIT.
|
|
|
|
package v1
|
|
|
|
import (
|
|
corev1 "k8s.io/api/core/v1"
|
|
)
|
|
|
|
// ContainerApplyConfiguration represents a declarative configuration of the Container type for use
|
|
// with apply.
|
|
//
|
|
// A single application container that you want to run within a pod.
|
|
type ContainerApplyConfiguration struct {
|
|
// Name of the container specified as a DNS_LABEL.
|
|
// Each container in a pod must have a unique name (DNS_LABEL).
|
|
// Cannot be updated.
|
|
Name *string `json:"name,omitempty"`
|
|
// Container image name.
|
|
// More info: https://kubernetes.io/docs/concepts/containers/images
|
|
// This field is optional to allow higher level config management to default or override
|
|
// container images in workload controllers like Deployments and StatefulSets.
|
|
Image *string `json:"image,omitempty"`
|
|
// Entrypoint array. Not executed within a shell.
|
|
// The container image's ENTRYPOINT is used if this is not provided.
|
|
// Variable references $(VAR_NAME) are expanded using the container's environment. If a variable
|
|
// cannot be resolved, the reference in the input string will be unchanged. Double $$ are reduced
|
|
// to a single $, which allows for escaping the $(VAR_NAME) syntax: i.e. "$$(VAR_NAME)" will
|
|
// produce the string literal "$(VAR_NAME)". Escaped references will never be expanded, regardless
|
|
// of whether the variable exists or not. Cannot be updated.
|
|
// More info: https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell
|
|
Command []string `json:"command,omitempty"`
|
|
// Arguments to the entrypoint.
|
|
// The container image's CMD is used if this is not provided.
|
|
// Variable references $(VAR_NAME) are expanded using the container's environment. If a variable
|
|
// cannot be resolved, the reference in the input string will be unchanged. Double $$ are reduced
|
|
// to a single $, which allows for escaping the $(VAR_NAME) syntax: i.e. "$$(VAR_NAME)" will
|
|
// produce the string literal "$(VAR_NAME)". Escaped references will never be expanded, regardless
|
|
// of whether the variable exists or not. Cannot be updated.
|
|
// More info: https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell
|
|
Args []string `json:"args,omitempty"`
|
|
// Container's working directory.
|
|
// If not specified, the container runtime's default will be used, which
|
|
// might be configured in the container image.
|
|
// Cannot be updated.
|
|
WorkingDir *string `json:"workingDir,omitempty"`
|
|
// List of ports to expose from the container. Not specifying a port here
|
|
// DOES NOT prevent that port from being exposed. Any port which is
|
|
// listening on the default "0.0.0.0" address inside a container will be
|
|
// accessible from the network.
|
|
// Modifying this array with strategic merge patch may corrupt the data.
|
|
// For more information See https://github.com/kubernetes/kubernetes/issues/108255.
|
|
// Cannot be updated.
|
|
Ports []ContainerPortApplyConfiguration `json:"ports,omitempty"`
|
|
// List of sources to populate environment variables in the container.
|
|
// The keys defined within a source may consist of any printable ASCII characters except '='.
|
|
// When a key exists in multiple
|
|
// sources, the value associated with the last source will take precedence.
|
|
// Values defined by an Env with a duplicate key will take precedence.
|
|
// Cannot be updated.
|
|
EnvFrom []EnvFromSourceApplyConfiguration `json:"envFrom,omitempty"`
|
|
// List of environment variables to set in the container.
|
|
// Cannot be updated.
|
|
Env []EnvVarApplyConfiguration `json:"env,omitempty"`
|
|
// Compute Resources required by this container.
|
|
// Cannot be updated.
|
|
// More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
|
|
Resources *ResourceRequirementsApplyConfiguration `json:"resources,omitempty"`
|
|
// Resources resize policy for the container.
|
|
// This field cannot be set on ephemeral containers.
|
|
ResizePolicy []ContainerResizePolicyApplyConfiguration `json:"resizePolicy,omitempty"`
|
|
// RestartPolicy defines the restart behavior of individual containers in a pod.
|
|
// This overrides the pod-level restart policy. When this field is not specified,
|
|
// the restart behavior is defined by the Pod's restart policy and the container type.
|
|
// Additionally, setting the RestartPolicy as "Always" for the init container will
|
|
// have the following effect:
|
|
// this init container will be continually restarted on
|
|
// exit until all regular containers have terminated. Once all regular
|
|
// containers have completed, all init containers with restartPolicy "Always"
|
|
// will be shut down. This lifecycle differs from normal init containers and
|
|
// is often referred to as a "sidecar" container. Although this init
|
|
// container still starts in the init container sequence, it does not wait
|
|
// for the container to complete before proceeding to the next init
|
|
// container. Instead, the next init container starts immediately after this
|
|
// init container is started, or after any startupProbe has successfully
|
|
// completed.
|
|
RestartPolicy *corev1.ContainerRestartPolicy `json:"restartPolicy,omitempty"`
|
|
// Represents a list of rules to be checked to determine if the
|
|
// container should be restarted on exit. The rules are evaluated in
|
|
// order. Once a rule matches a container exit condition, the remaining
|
|
// rules are ignored. If no rule matches the container exit condition,
|
|
// the Container-level restart policy determines the whether the container
|
|
// is restarted or not. Constraints on the rules:
|
|
// - At most 20 rules are allowed.
|
|
// - Rules can have the same action.
|
|
// - Identical rules are not forbidden in validations.
|
|
// When rules are specified, container MUST set RestartPolicy explicitly
|
|
// even it if matches the Pod's RestartPolicy.
|
|
RestartPolicyRules []ContainerRestartRuleApplyConfiguration `json:"restartPolicyRules,omitempty"`
|
|
// Pod volumes to mount into the container's filesystem.
|
|
// Cannot be updated.
|
|
VolumeMounts []VolumeMountApplyConfiguration `json:"volumeMounts,omitempty"`
|
|
// volumeDevices is the list of block devices to be used by the container.
|
|
VolumeDevices []VolumeDeviceApplyConfiguration `json:"volumeDevices,omitempty"`
|
|
// Periodic probe of container liveness.
|
|
// Container will be restarted if the probe fails.
|
|
// Cannot be updated.
|
|
// More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes
|
|
LivenessProbe *ProbeApplyConfiguration `json:"livenessProbe,omitempty"`
|
|
// Periodic probe of container service readiness.
|
|
// Container will be removed from service endpoints if the probe fails.
|
|
// Cannot be updated.
|
|
// More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes
|
|
ReadinessProbe *ProbeApplyConfiguration `json:"readinessProbe,omitempty"`
|
|
// StartupProbe indicates that the Pod has successfully initialized.
|
|
// If specified, no other probes are executed until this completes successfully.
|
|
// If this probe fails, the Pod will be restarted, just as if the livenessProbe failed.
|
|
// This can be used to provide different probe parameters at the beginning of a Pod's lifecycle,
|
|
// when it might take a long time to load data or warm a cache, than during steady-state operation.
|
|
// This cannot be updated.
|
|
// More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes
|
|
StartupProbe *ProbeApplyConfiguration `json:"startupProbe,omitempty"`
|
|
// Actions that the management system should take in response to container lifecycle events.
|
|
// Cannot be updated.
|
|
Lifecycle *LifecycleApplyConfiguration `json:"lifecycle,omitempty"`
|
|
// Optional: Path at which the file to which the container's termination message
|
|
// will be written is mounted into the container's filesystem.
|
|
// Message written is intended to be brief final status, such as an assertion failure message.
|
|
// Will be truncated by the node if greater than 4096 bytes. The total message length across
|
|
// all containers will be limited to 12kb.
|
|
// Defaults to /dev/termination-log.
|
|
// Cannot be updated.
|
|
TerminationMessagePath *string `json:"terminationMessagePath,omitempty"`
|
|
// Indicate how the termination message should be populated. File will use the contents of
|
|
// terminationMessagePath to populate the container status message on both success and failure.
|
|
// FallbackToLogsOnError will use the last chunk of container log output if the termination
|
|
// message file is empty and the container exited with an error.
|
|
// The log output is limited to 2048 bytes or 80 lines, whichever is smaller.
|
|
// Defaults to File.
|
|
// Cannot be updated.
|
|
TerminationMessagePolicy *corev1.TerminationMessagePolicy `json:"terminationMessagePolicy,omitempty"`
|
|
// Image pull policy.
|
|
// One of Always, Never, IfNotPresent.
|
|
// Defaults to Always if :latest tag is specified, or IfNotPresent otherwise.
|
|
// Cannot be updated.
|
|
// More info: https://kubernetes.io/docs/concepts/containers/images#updating-images
|
|
ImagePullPolicy *corev1.PullPolicy `json:"imagePullPolicy,omitempty"`
|
|
// SecurityContext defines the security options the container should be run with.
|
|
// If set, the fields of SecurityContext override the equivalent fields of PodSecurityContext.
|
|
// More info: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/
|
|
SecurityContext *SecurityContextApplyConfiguration `json:"securityContext,omitempty"`
|
|
// Whether this container should allocate a buffer for stdin in the container runtime. If this
|
|
// is not set, reads from stdin in the container will always result in EOF.
|
|
// Default is false.
|
|
Stdin *bool `json:"stdin,omitempty"`
|
|
// Whether the container runtime should close the stdin channel after it has been opened by
|
|
// a single attach. When stdin is true the stdin stream will remain open across multiple attach
|
|
// sessions. If stdinOnce is set to true, stdin is opened on container start, is empty until the
|
|
// first client attaches to stdin, and then remains open and accepts data until the client disconnects,
|
|
// at which time stdin is closed and remains closed until the container is restarted. If this
|
|
// flag is false, a container processes that reads from stdin will never receive an EOF.
|
|
// Default is false
|
|
StdinOnce *bool `json:"stdinOnce,omitempty"`
|
|
// Whether this container should allocate a TTY for itself, also requires 'stdin' to be true.
|
|
// Default is false.
|
|
TTY *bool `json:"tty,omitempty"`
|
|
}
|
|
|
|
// ContainerApplyConfiguration constructs a declarative configuration of the Container type for use with
|
|
// apply.
|
|
func Container() *ContainerApplyConfiguration {
|
|
return &ContainerApplyConfiguration{}
|
|
}
|
|
|
|
// WithName sets the Name field in the declarative configuration to the given value
|
|
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
|
// If called multiple times, the Name field is set to the value of the last call.
|
|
func (b *ContainerApplyConfiguration) WithName(value string) *ContainerApplyConfiguration {
|
|
b.Name = &value
|
|
return b
|
|
}
|
|
|
|
// WithImage sets the Image field in the declarative configuration to the given value
|
|
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
|
// If called multiple times, the Image field is set to the value of the last call.
|
|
func (b *ContainerApplyConfiguration) WithImage(value string) *ContainerApplyConfiguration {
|
|
b.Image = &value
|
|
return b
|
|
}
|
|
|
|
// WithCommand adds the given value to the Command field in the declarative configuration
|
|
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
|
|
// If called multiple times, values provided by each call will be appended to the Command field.
|
|
func (b *ContainerApplyConfiguration) WithCommand(values ...string) *ContainerApplyConfiguration {
|
|
for i := range values {
|
|
b.Command = append(b.Command, values[i])
|
|
}
|
|
return b
|
|
}
|
|
|
|
// WithArgs adds the given value to the Args field in the declarative configuration
|
|
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
|
|
// If called multiple times, values provided by each call will be appended to the Args field.
|
|
func (b *ContainerApplyConfiguration) WithArgs(values ...string) *ContainerApplyConfiguration {
|
|
for i := range values {
|
|
b.Args = append(b.Args, values[i])
|
|
}
|
|
return b
|
|
}
|
|
|
|
// WithWorkingDir sets the WorkingDir field in the declarative configuration to the given value
|
|
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
|
// If called multiple times, the WorkingDir field is set to the value of the last call.
|
|
func (b *ContainerApplyConfiguration) WithWorkingDir(value string) *ContainerApplyConfiguration {
|
|
b.WorkingDir = &value
|
|
return b
|
|
}
|
|
|
|
// WithPorts adds the given value to the Ports field in the declarative configuration
|
|
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
|
|
// If called multiple times, values provided by each call will be appended to the Ports field.
|
|
func (b *ContainerApplyConfiguration) WithPorts(values ...*ContainerPortApplyConfiguration) *ContainerApplyConfiguration {
|
|
for i := range values {
|
|
if values[i] == nil {
|
|
panic("nil value passed to WithPorts")
|
|
}
|
|
b.Ports = append(b.Ports, *values[i])
|
|
}
|
|
return b
|
|
}
|
|
|
|
// WithEnvFrom adds the given value to the EnvFrom field in the declarative configuration
|
|
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
|
|
// If called multiple times, values provided by each call will be appended to the EnvFrom field.
|
|
func (b *ContainerApplyConfiguration) WithEnvFrom(values ...*EnvFromSourceApplyConfiguration) *ContainerApplyConfiguration {
|
|
for i := range values {
|
|
if values[i] == nil {
|
|
panic("nil value passed to WithEnvFrom")
|
|
}
|
|
b.EnvFrom = append(b.EnvFrom, *values[i])
|
|
}
|
|
return b
|
|
}
|
|
|
|
// WithEnv adds the given value to the Env field in the declarative configuration
|
|
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
|
|
// If called multiple times, values provided by each call will be appended to the Env field.
|
|
func (b *ContainerApplyConfiguration) WithEnv(values ...*EnvVarApplyConfiguration) *ContainerApplyConfiguration {
|
|
for i := range values {
|
|
if values[i] == nil {
|
|
panic("nil value passed to WithEnv")
|
|
}
|
|
b.Env = append(b.Env, *values[i])
|
|
}
|
|
return b
|
|
}
|
|
|
|
// WithResources sets the Resources field in the declarative configuration to the given value
|
|
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
|
// If called multiple times, the Resources field is set to the value of the last call.
|
|
func (b *ContainerApplyConfiguration) WithResources(value *ResourceRequirementsApplyConfiguration) *ContainerApplyConfiguration {
|
|
b.Resources = value
|
|
return b
|
|
}
|
|
|
|
// WithResizePolicy adds the given value to the ResizePolicy field in the declarative configuration
|
|
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
|
|
// If called multiple times, values provided by each call will be appended to the ResizePolicy field.
|
|
func (b *ContainerApplyConfiguration) WithResizePolicy(values ...*ContainerResizePolicyApplyConfiguration) *ContainerApplyConfiguration {
|
|
for i := range values {
|
|
if values[i] == nil {
|
|
panic("nil value passed to WithResizePolicy")
|
|
}
|
|
b.ResizePolicy = append(b.ResizePolicy, *values[i])
|
|
}
|
|
return b
|
|
}
|
|
|
|
// WithRestartPolicy sets the RestartPolicy field in the declarative configuration to the given value
|
|
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
|
// If called multiple times, the RestartPolicy field is set to the value of the last call.
|
|
func (b *ContainerApplyConfiguration) WithRestartPolicy(value corev1.ContainerRestartPolicy) *ContainerApplyConfiguration {
|
|
b.RestartPolicy = &value
|
|
return b
|
|
}
|
|
|
|
// WithRestartPolicyRules adds the given value to the RestartPolicyRules field in the declarative configuration
|
|
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
|
|
// If called multiple times, values provided by each call will be appended to the RestartPolicyRules field.
|
|
func (b *ContainerApplyConfiguration) WithRestartPolicyRules(values ...*ContainerRestartRuleApplyConfiguration) *ContainerApplyConfiguration {
|
|
for i := range values {
|
|
if values[i] == nil {
|
|
panic("nil value passed to WithRestartPolicyRules")
|
|
}
|
|
b.RestartPolicyRules = append(b.RestartPolicyRules, *values[i])
|
|
}
|
|
return b
|
|
}
|
|
|
|
// WithVolumeMounts adds the given value to the VolumeMounts field in the declarative configuration
|
|
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
|
|
// If called multiple times, values provided by each call will be appended to the VolumeMounts field.
|
|
func (b *ContainerApplyConfiguration) WithVolumeMounts(values ...*VolumeMountApplyConfiguration) *ContainerApplyConfiguration {
|
|
for i := range values {
|
|
if values[i] == nil {
|
|
panic("nil value passed to WithVolumeMounts")
|
|
}
|
|
b.VolumeMounts = append(b.VolumeMounts, *values[i])
|
|
}
|
|
return b
|
|
}
|
|
|
|
// WithVolumeDevices adds the given value to the VolumeDevices field in the declarative configuration
|
|
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
|
|
// If called multiple times, values provided by each call will be appended to the VolumeDevices field.
|
|
func (b *ContainerApplyConfiguration) WithVolumeDevices(values ...*VolumeDeviceApplyConfiguration) *ContainerApplyConfiguration {
|
|
for i := range values {
|
|
if values[i] == nil {
|
|
panic("nil value passed to WithVolumeDevices")
|
|
}
|
|
b.VolumeDevices = append(b.VolumeDevices, *values[i])
|
|
}
|
|
return b
|
|
}
|
|
|
|
// WithLivenessProbe sets the LivenessProbe field in the declarative configuration to the given value
|
|
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
|
// If called multiple times, the LivenessProbe field is set to the value of the last call.
|
|
func (b *ContainerApplyConfiguration) WithLivenessProbe(value *ProbeApplyConfiguration) *ContainerApplyConfiguration {
|
|
b.LivenessProbe = value
|
|
return b
|
|
}
|
|
|
|
// WithReadinessProbe sets the ReadinessProbe field in the declarative configuration to the given value
|
|
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
|
// If called multiple times, the ReadinessProbe field is set to the value of the last call.
|
|
func (b *ContainerApplyConfiguration) WithReadinessProbe(value *ProbeApplyConfiguration) *ContainerApplyConfiguration {
|
|
b.ReadinessProbe = value
|
|
return b
|
|
}
|
|
|
|
// WithStartupProbe sets the StartupProbe field in the declarative configuration to the given value
|
|
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
|
// If called multiple times, the StartupProbe field is set to the value of the last call.
|
|
func (b *ContainerApplyConfiguration) WithStartupProbe(value *ProbeApplyConfiguration) *ContainerApplyConfiguration {
|
|
b.StartupProbe = value
|
|
return b
|
|
}
|
|
|
|
// WithLifecycle sets the Lifecycle field in the declarative configuration to the given value
|
|
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
|
// If called multiple times, the Lifecycle field is set to the value of the last call.
|
|
func (b *ContainerApplyConfiguration) WithLifecycle(value *LifecycleApplyConfiguration) *ContainerApplyConfiguration {
|
|
b.Lifecycle = value
|
|
return b
|
|
}
|
|
|
|
// WithTerminationMessagePath sets the TerminationMessagePath field in the declarative configuration to the given value
|
|
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
|
// If called multiple times, the TerminationMessagePath field is set to the value of the last call.
|
|
func (b *ContainerApplyConfiguration) WithTerminationMessagePath(value string) *ContainerApplyConfiguration {
|
|
b.TerminationMessagePath = &value
|
|
return b
|
|
}
|
|
|
|
// WithTerminationMessagePolicy sets the TerminationMessagePolicy field in the declarative configuration to the given value
|
|
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
|
// If called multiple times, the TerminationMessagePolicy field is set to the value of the last call.
|
|
func (b *ContainerApplyConfiguration) WithTerminationMessagePolicy(value corev1.TerminationMessagePolicy) *ContainerApplyConfiguration {
|
|
b.TerminationMessagePolicy = &value
|
|
return b
|
|
}
|
|
|
|
// WithImagePullPolicy sets the ImagePullPolicy field in the declarative configuration to the given value
|
|
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
|
// If called multiple times, the ImagePullPolicy field is set to the value of the last call.
|
|
func (b *ContainerApplyConfiguration) WithImagePullPolicy(value corev1.PullPolicy) *ContainerApplyConfiguration {
|
|
b.ImagePullPolicy = &value
|
|
return b
|
|
}
|
|
|
|
// WithSecurityContext sets the SecurityContext field in the declarative configuration to the given value
|
|
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
|
// If called multiple times, the SecurityContext field is set to the value of the last call.
|
|
func (b *ContainerApplyConfiguration) WithSecurityContext(value *SecurityContextApplyConfiguration) *ContainerApplyConfiguration {
|
|
b.SecurityContext = value
|
|
return b
|
|
}
|
|
|
|
// WithStdin sets the Stdin field in the declarative configuration to the given value
|
|
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
|
// If called multiple times, the Stdin field is set to the value of the last call.
|
|
func (b *ContainerApplyConfiguration) WithStdin(value bool) *ContainerApplyConfiguration {
|
|
b.Stdin = &value
|
|
return b
|
|
}
|
|
|
|
// WithStdinOnce sets the StdinOnce field in the declarative configuration to the given value
|
|
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
|
// If called multiple times, the StdinOnce field is set to the value of the last call.
|
|
func (b *ContainerApplyConfiguration) WithStdinOnce(value bool) *ContainerApplyConfiguration {
|
|
b.StdinOnce = &value
|
|
return b
|
|
}
|
|
|
|
// WithTTY sets the TTY field in the declarative configuration to the given value
|
|
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
|
// If called multiple times, the TTY field is set to the value of the last call.
|
|
func (b *ContainerApplyConfiguration) WithTTY(value bool) *ContainerApplyConfiguration {
|
|
b.TTY = &value
|
|
return b
|
|
}
|