Documentation ¶
Index ¶
- Constants
- Variables
- func ContainerPorts2ServicePorts(port []corev1.ContainerPort) []corev1.ServicePort
- func LogProviderCommand(entrypointScript string) ([]string, error)
- func MakeVectorYaml(ctx context.Context, client ctrlclient.Client, namespace string, ...) (string, error)
- func ParseVectorYaml(data map[string]interface{}) (string, error)
- func VectorCommand() []string
- func VectorCommandArgs() []string
- func VectorVolumeMount(vectorConfigVolumeName string, vectorLogVolumeName string) []corev1.VolumeMount
- type BaseConfigBuilder
- func (b *BaseConfigBuilder) AddData(data map[string]string) ConfigBuilder
- func (b *BaseConfigBuilder) AddDecodeData(data map[string][]byte) ConfigBuilder
- func (b *BaseConfigBuilder) ClearData() ConfigBuilder
- func (b *BaseConfigBuilder) GetData() map[string]string
- func (b *BaseConfigBuilder) GetEncodeData() map[string][]byte
- func (b *BaseConfigBuilder) SetData(data map[string]string) ConfigBuilder
- type BaseResourceBuilder
- func (b *BaseResourceBuilder) AddAnnotations(annotations map[string]string)
- func (b *BaseResourceBuilder) AddLabels(labels map[string]string)
- func (b *BaseResourceBuilder) Build(ctx context.Context) (ctrlclient.Object, error)
- func (b *BaseResourceBuilder) GetAnnotations() map[string]string
- func (b *BaseResourceBuilder) GetClient() *client.Client
- func (b *BaseResourceBuilder) GetLabelSelector() *metav1.LabelSelector
- func (b *BaseResourceBuilder) GetLabels() map[string]string
- func (b *BaseResourceBuilder) GetMatchingLabels() map[string]string
- func (b *BaseResourceBuilder) GetName() string
- func (b *BaseResourceBuilder) GetObject() (ctrlclient.Object, error)
- func (b *BaseResourceBuilder) GetObjectMeta() metav1.ObjectMeta
- func (b *BaseResourceBuilder) GetObjectMetaWithClusterScope() metav1.ObjectMeta
- func (b *BaseResourceBuilder) SetName(name string)
- type BaseServiceBuilder
- func (b *BaseServiceBuilder) AddPort(port *corev1.ServicePort)
- func (b *BaseServiceBuilder) Build(_ context.Context) (ctrlclient.Object, error)
- func (b *BaseServiceBuilder) GetObject() *corev1.Service
- func (b *BaseServiceBuilder) GetPorts() []corev1.ServicePort
- func (b *BaseServiceBuilder) GetServiceType() corev1.ServiceType
- type BaseWorkloadBuilder
- func (b *BaseWorkloadBuilder) AddContainer(container *corev1.Container)
- func (b *BaseWorkloadBuilder) AddContainers(containers []corev1.Container)
- func (b *BaseWorkloadBuilder) AddInitContainer(container *corev1.Container)
- func (b *BaseWorkloadBuilder) AddInitContainers(containers []corev1.Container)
- func (b *BaseWorkloadBuilder) AddVolume(volume *corev1.Volume)
- func (b *BaseWorkloadBuilder) AddVolumes(volumes []corev1.Volume)
- func (b *BaseWorkloadBuilder) GetAffinity() *corev1.Affinity
- func (b *BaseWorkloadBuilder) GetContainers() []corev1.Container
- func (b *BaseWorkloadBuilder) GetImage() *util.Image
- func (b *BaseWorkloadBuilder) GetImagePullSecrets() []corev1.LocalObjectReference
- func (b *BaseWorkloadBuilder) GetImageWithTag() string
- func (b *BaseWorkloadBuilder) GetInitContainers() []corev1.Container
- func (b *BaseWorkloadBuilder) GetResources() *commonsv1alpha1.ResourcesSpec
- func (b *BaseWorkloadBuilder) GetSecurityContext() *corev1.PodSecurityContext
- func (b *BaseWorkloadBuilder) GetTerminationGracePeriod() *time.Duration
- func (b *BaseWorkloadBuilder) GetTerminationGracePeriodSeconds() *int64
- func (b *BaseWorkloadBuilder) GetVolumes() []corev1.Volume
- func (b *BaseWorkloadBuilder) OverrideCommand()
- func (b *BaseWorkloadBuilder) OverrideEnv()
- func (b *BaseWorkloadBuilder) ResetContainers(containers []corev1.Container)
- func (b *BaseWorkloadBuilder) ResetInitContainers(containers []corev1.Container)
- func (b *BaseWorkloadBuilder) ResetVolumes(volumes []corev1.Volume)
- func (b *BaseWorkloadBuilder) SetAffinity(affinity *corev1.Affinity)
- func (b *BaseWorkloadBuilder) SetImage(image *util.Image)
- func (b *BaseWorkloadBuilder) SetResources(resources *commonsv1alpha1.ResourcesSpec)
- func (b *BaseWorkloadBuilder) SetSecurityContext(user int64, group int64, nonRoot bool)
- func (b *BaseWorkloadBuilder) SetTerminationGracePeriod(duration *time.Duration)
- type BaseWorkloadReplicasBuilder
- type ClusterRoleBindingBuilder
- type ClusterRoleBuilder
- type ConfigBuilder
- type ConfigMapBuilder
- type Container
- func (b *Container) AddEnv(key, value string)
- func (b *Container) AddEnvFromConfigMap(configMapName string) ContainerBuilder
- func (b *Container) AddEnvFromSecret(secretName string) ContainerBuilder
- func (b *Container) AddEnvSource(envs []corev1.EnvFromSource) ContainerBuilder
- func (b *Container) AddEnvVar(env *corev1.EnvVar) ContainerBuilder
- func (b *Container) AddEnvVars(envVars []corev1.EnvVar) ContainerBuilder
- func (b *Container) AddEnvs(envs map[string]string)
- func (b *Container) AddPort(port corev1.ContainerPort)
- func (b *Container) AddPorts(ports []corev1.ContainerPort) ContainerBuilder
- func (b *Container) AddVolumeMount(mount *corev1.VolumeMount) ContainerBuilder
- func (b *Container) AddVolumeMounts(mounts []corev1.VolumeMount) ContainerBuilder
- func (b *Container) AutomaticSetProbe()
- func (b *Container) Build() *corev1.Container
- func (b *Container) GetEnvFrom() []corev1.EnvFromSource
- func (b *Container) GetEnvVars() []corev1.EnvVar
- func (b *Container) GetPorts() []corev1.ContainerPort
- func (b *Container) GetVolumeMounts() []corev1.VolumeMount
- func (b *Container) OverrideCommand(command []string) ContainerBuilder
- func (b *Container) OverrideEnv(envs map[string]string)
- func (b *Container) ResetEnvFrom(envs []corev1.EnvFromSource)
- func (b *Container) ResetEnvVars(envVars []corev1.EnvVar)
- func (b *Container) ResetPorts(ports []corev1.ContainerPort)
- func (b *Container) ResetVolumeMounts(mounts []corev1.VolumeMount)
- func (b *Container) SetArgs(args []string) ContainerBuilder
- func (b *Container) SetCommand(command []string) ContainerBuilder
- func (b *Container) SetImagePullPolicy(policy *corev1.PullPolicy) ContainerBuilder
- func (b *Container) SetLivenessProbe(probe *corev1.Probe) ContainerBuilder
- func (b *Container) SetProbeWithHealth()
- func (b *Container) SetReadinessProbe(probe *corev1.Probe) ContainerBuilder
- func (b *Container) SetResources(resources *commonsv1alpha1.ResourcesSpec) ContainerBuilder
- func (b *Container) SetSecurityContext(user int64, group int64, nonRoot bool) ContainerBuilder
- func (b *Container) SetStartupProbe(probe *corev1.Probe) ContainerBuilder
- type ContainerBuilder
- type Deployment
- type DeploymentBuilder
- type GenericClusterRoleBindingBuilder
- type GenericClusterRoleBuilder
- type GenericRoleBindingBuilder
- type GenericRoleBuilder
- type GenericServiceAccountBuilder
- type Job
- type JobBuilder
- type Options
- type ResourceBuilder
- type RoleBindingBuilder
- type RoleBuilder
- type SecretBuilder
- type ServiceAccountBuilder
- type ServiceBuilder
- type StatefulSet
- func (b *StatefulSet) AddVolumeClaimTemplate(pvc *corev1.PersistentVolumeClaim)
- func (b *StatefulSet) AddVolumeClaimTemplates(claims []corev1.PersistentVolumeClaim)
- func (b *StatefulSet) Build(ctx context.Context) (ctrlclient.Object, error)
- func (b *StatefulSet) GetObject() (*appv1.StatefulSet, error)
- func (b *StatefulSet) GetVolumeClaimTemplates() []corev1.PersistentVolumeClaim
- func (b *StatefulSet) ResetVolumeClaimTemplates(claims []corev1.PersistentVolumeClaim)
- type StatefulSetBuilder
- type VectorDecorator
- type WorkloadAffinity
- type WorkloadContainers
- type WorkloadDecorator
- type WorkloadImage
- type WorkloadInitContainers
- type WorkloadOptions
- type WorkloadReplicas
- type WorkloadResource
- type WorkloadSecurityContext
- type WorkloadTerminationGracePeriodSeconds
- type WorkloadVolumes
Constants ¶
const ( VectorImage = "timberio/vector:0.38.0-alpine" VectorContainerName = "vector" ConfigDir = "/zncdata/config" LogDir = "/zncdata/log" )
todo: in future, all operator should config log, config and data to the same dir, like '/zncdata/log', '/zncdata/config'
Variables ¶
var ( HTTPGetProbHandler2PortNames = []string{"http", "ui", "metrics", "health"} TCPProbHandler2PortNames = []string{"master"} DefaultImagePullPolicy = &[]corev1.PullPolicy{corev1.PullAlways}[0] )
var (
DefaultReplicas = int32(1)
)
var ErrNoContainers = errors.New("no containers defined")
Functions ¶
func ContainerPorts2ServicePorts ¶ added in v0.8.0
func ContainerPorts2ServicePorts(port []corev1.ContainerPort) []corev1.ServicePort
func LogProviderCommand ¶ added in v0.8.0
func MakeVectorYaml ¶ added in v0.8.0
func ParseVectorYaml ¶ added in v0.8.4
func VectorCommand ¶ added in v0.8.0
func VectorCommand() []string
func VectorCommandArgs ¶ added in v0.8.0
func VectorCommandArgs() []string
func VectorVolumeMount ¶ added in v0.8.0
func VectorVolumeMount(vectorConfigVolumeName string, vectorLogVolumeName string) []corev1.VolumeMount
Types ¶
type BaseConfigBuilder ¶
type BaseConfigBuilder struct { BaseResourceBuilder // contains filtered or unexported fields }
func NewBaseConfigBuilder ¶
func (*BaseConfigBuilder) AddData ¶
func (b *BaseConfigBuilder) AddData(data map[string]string) ConfigBuilder
func (*BaseConfigBuilder) AddDecodeData ¶
func (b *BaseConfigBuilder) AddDecodeData(data map[string][]byte) ConfigBuilder
func (*BaseConfigBuilder) ClearData ¶
func (b *BaseConfigBuilder) ClearData() ConfigBuilder
func (*BaseConfigBuilder) GetData ¶
func (b *BaseConfigBuilder) GetData() map[string]string
func (*BaseConfigBuilder) GetEncodeData ¶
func (b *BaseConfigBuilder) GetEncodeData() map[string][]byte
func (*BaseConfigBuilder) SetData ¶
func (b *BaseConfigBuilder) SetData(data map[string]string) ConfigBuilder
type BaseResourceBuilder ¶
type BaseResourceBuilder struct { Client *client.Client Name string // this is resource name when creating // contains filtered or unexported fields }
func NewBaseResourceBuilder ¶ added in v0.8.0
func NewBaseResourceBuilder( client *client.Client, name string, options *Options, ) *BaseResourceBuilder
func (*BaseResourceBuilder) AddAnnotations ¶ added in v0.8.0
func (b *BaseResourceBuilder) AddAnnotations(annotations map[string]string)
func (*BaseResourceBuilder) AddLabels ¶ added in v0.8.0
func (b *BaseResourceBuilder) AddLabels(labels map[string]string)
func (*BaseResourceBuilder) Build ¶
func (b *BaseResourceBuilder) Build(ctx context.Context) (ctrlclient.Object, error)
func (*BaseResourceBuilder) GetAnnotations ¶ added in v0.8.0
func (b *BaseResourceBuilder) GetAnnotations() map[string]string
func (*BaseResourceBuilder) GetClient ¶
func (b *BaseResourceBuilder) GetClient() *client.Client
func (*BaseResourceBuilder) GetLabelSelector ¶ added in v0.8.0
func (b *BaseResourceBuilder) GetLabelSelector() *metav1.LabelSelector
func (*BaseResourceBuilder) GetLabels ¶ added in v0.8.0
func (b *BaseResourceBuilder) GetLabels() map[string]string
func (*BaseResourceBuilder) GetMatchingLabels ¶ added in v0.8.0
func (b *BaseResourceBuilder) GetMatchingLabels() map[string]string
func (*BaseResourceBuilder) GetName ¶
func (b *BaseResourceBuilder) GetName() string
func (*BaseResourceBuilder) GetObject ¶ added in v0.8.0
func (b *BaseResourceBuilder) GetObject() (ctrlclient.Object, error)
func (*BaseResourceBuilder) GetObjectMeta ¶
func (b *BaseResourceBuilder) GetObjectMeta() metav1.ObjectMeta
func (*BaseResourceBuilder) GetObjectMetaWithClusterScope ¶
func (b *BaseResourceBuilder) GetObjectMetaWithClusterScope() metav1.ObjectMeta
GetObjectMetaWithClusterScope returns the object meta with cluster scope, meaning that the object is not namespaced.
func (*BaseResourceBuilder) SetName ¶
func (b *BaseResourceBuilder) SetName(name string)
type BaseServiceBuilder ¶
type BaseServiceBuilder struct { BaseResourceBuilder // contains filtered or unexported fields }
func NewServiceBuilder ¶
func NewServiceBuilder( client *client.Client, name string, labels map[string]string, annotations map[string]string, ports []corev1.ContainerPort, ) *BaseServiceBuilder
func (*BaseServiceBuilder) AddPort ¶
func (b *BaseServiceBuilder) AddPort(port *corev1.ServicePort)
func (*BaseServiceBuilder) Build ¶
func (b *BaseServiceBuilder) Build(_ context.Context) (ctrlclient.Object, error)
func (*BaseServiceBuilder) GetObject ¶
func (b *BaseServiceBuilder) GetObject() *corev1.Service
func (*BaseServiceBuilder) GetPorts ¶
func (b *BaseServiceBuilder) GetPorts() []corev1.ServicePort
func (*BaseServiceBuilder) GetServiceType ¶
func (b *BaseServiceBuilder) GetServiceType() corev1.ServiceType
type BaseWorkloadBuilder ¶ added in v0.8.0
type BaseWorkloadBuilder struct { BaseResourceBuilder // contains filtered or unexported fields }
WorkloadOptions is a struct to hold the options for a workload
Note: The values of envOverrides and commandOverrides will only be overridden on the container with the same name as roleGroupInfo.RoleName, if roleGroupInfo exists and roleGroupInfo.RoleName has a value.
func NewBaseWorkloadBuilder ¶ added in v0.8.0
func NewBaseWorkloadBuilder( client *client.Client, name string, image *util.Image, options WorkloadOptions, ) *BaseWorkloadBuilder
func (*BaseWorkloadBuilder) AddContainer ¶ added in v0.8.0
func (b *BaseWorkloadBuilder) AddContainer(container *corev1.Container)
func (*BaseWorkloadBuilder) AddContainers ¶ added in v0.8.0
func (b *BaseWorkloadBuilder) AddContainers(containers []corev1.Container)
func (*BaseWorkloadBuilder) AddInitContainer ¶ added in v0.8.0
func (b *BaseWorkloadBuilder) AddInitContainer(container *corev1.Container)
func (*BaseWorkloadBuilder) AddInitContainers ¶ added in v0.8.0
func (b *BaseWorkloadBuilder) AddInitContainers(containers []corev1.Container)
func (*BaseWorkloadBuilder) AddVolume ¶ added in v0.8.0
func (b *BaseWorkloadBuilder) AddVolume(volume *corev1.Volume)
func (*BaseWorkloadBuilder) AddVolumes ¶ added in v0.8.0
func (b *BaseWorkloadBuilder) AddVolumes(volumes []corev1.Volume)
func (*BaseWorkloadBuilder) GetAffinity ¶ added in v0.8.0
func (b *BaseWorkloadBuilder) GetAffinity() *corev1.Affinity
func (*BaseWorkloadBuilder) GetContainers ¶ added in v0.8.0
func (b *BaseWorkloadBuilder) GetContainers() []corev1.Container
func (*BaseWorkloadBuilder) GetImage ¶ added in v0.8.0
func (b *BaseWorkloadBuilder) GetImage() *util.Image
func (*BaseWorkloadBuilder) GetImagePullSecrets ¶ added in v0.8.0
func (b *BaseWorkloadBuilder) GetImagePullSecrets() []corev1.LocalObjectReference
func (*BaseWorkloadBuilder) GetImageWithTag ¶ added in v0.8.4
func (b *BaseWorkloadBuilder) GetImageWithTag() string
func (*BaseWorkloadBuilder) GetInitContainers ¶ added in v0.8.0
func (b *BaseWorkloadBuilder) GetInitContainers() []corev1.Container
func (*BaseWorkloadBuilder) GetResources ¶ added in v0.8.0
func (b *BaseWorkloadBuilder) GetResources() *commonsv1alpha1.ResourcesSpec
func (*BaseWorkloadBuilder) GetSecurityContext ¶ added in v0.8.0
func (b *BaseWorkloadBuilder) GetSecurityContext() *corev1.PodSecurityContext
func (*BaseWorkloadBuilder) GetTerminationGracePeriod ¶ added in v0.8.0
func (b *BaseWorkloadBuilder) GetTerminationGracePeriod() *time.Duration
func (*BaseWorkloadBuilder) GetTerminationGracePeriodSeconds ¶ added in v0.8.0
func (b *BaseWorkloadBuilder) GetTerminationGracePeriodSeconds() *int64
func (*BaseWorkloadBuilder) GetVolumes ¶ added in v0.8.0
func (b *BaseWorkloadBuilder) GetVolumes() []corev1.Volume
func (*BaseWorkloadBuilder) OverrideCommand ¶ added in v0.8.0
func (b *BaseWorkloadBuilder) OverrideCommand()
func (*BaseWorkloadBuilder) OverrideEnv ¶ added in v0.8.0
func (b *BaseWorkloadBuilder) OverrideEnv()
func (*BaseWorkloadBuilder) ResetContainers ¶ added in v0.8.0
func (b *BaseWorkloadBuilder) ResetContainers(containers []corev1.Container)
func (*BaseWorkloadBuilder) ResetInitContainers ¶ added in v0.8.0
func (b *BaseWorkloadBuilder) ResetInitContainers(containers []corev1.Container)
func (*BaseWorkloadBuilder) ResetVolumes ¶ added in v0.8.0
func (b *BaseWorkloadBuilder) ResetVolumes(volumes []corev1.Volume)
func (*BaseWorkloadBuilder) SetAffinity ¶ added in v0.8.4
func (b *BaseWorkloadBuilder) SetAffinity(affinity *corev1.Affinity)
func (*BaseWorkloadBuilder) SetImage ¶ added in v0.8.0
func (b *BaseWorkloadBuilder) SetImage(image *util.Image)
func (*BaseWorkloadBuilder) SetResources ¶ added in v0.8.0
func (b *BaseWorkloadBuilder) SetResources(resources *commonsv1alpha1.ResourcesSpec)
func (*BaseWorkloadBuilder) SetSecurityContext ¶ added in v0.8.0
func (b *BaseWorkloadBuilder) SetSecurityContext(user int64, group int64, nonRoot bool)
func (*BaseWorkloadBuilder) SetTerminationGracePeriod ¶ added in v0.8.4
func (b *BaseWorkloadBuilder) SetTerminationGracePeriod(duration *time.Duration)
type BaseWorkloadReplicasBuilder ¶ added in v0.8.0
type BaseWorkloadReplicasBuilder struct { BaseWorkloadBuilder // contains filtered or unexported fields }
func NewBaseWorkloadReplicasBuilder ¶ added in v0.8.0
func NewBaseWorkloadReplicasBuilder( client *client.Client, name string, replicas *int32, image *util.Image, options WorkloadOptions, ) *BaseWorkloadReplicasBuilder
func (*BaseWorkloadReplicasBuilder) GetReplicas ¶ added in v0.8.0
func (b *BaseWorkloadReplicasBuilder) GetReplicas() *int32
func (*BaseWorkloadReplicasBuilder) SetReplicas ¶ added in v0.8.0
func (b *BaseWorkloadReplicasBuilder) SetReplicas(replicas *int32)
type ClusterRoleBindingBuilder ¶
type ClusterRoleBindingBuilder interface { ResourceBuilder GetObject() *rbacv1.ClusterRoleBinding }
type ClusterRoleBuilder ¶
type ClusterRoleBuilder interface { ResourceBuilder GetObject() *rbacv1.ClusterRole }
type ConfigBuilder ¶
type ConfigBuilder interface { ResourceBuilder AddData(data map[string]string) ConfigBuilder AddDecodeData(data map[string][]byte) ConfigBuilder SetData(data map[string]string) ConfigBuilder ClearData() ConfigBuilder GetData() map[string]string GetEncodeData() map[string][]byte }
type ConfigMapBuilder ¶
type ConfigMapBuilder struct {
BaseConfigBuilder
}
func NewConfigMapBuilder ¶
func (*ConfigMapBuilder) Build ¶
func (b *ConfigMapBuilder) Build(_ context.Context) (ctrlclient.Object, error)
func (*ConfigMapBuilder) GetObject ¶
func (b *ConfigMapBuilder) GetObject() *corev1.ConfigMap
type Container ¶ added in v0.8.0
func NewContainer ¶ added in v0.8.0
NewContainer returns a new Container
func (*Container) AddEnvFromConfigMap ¶ added in v0.8.0
func (b *Container) AddEnvFromConfigMap(configMapName string) ContainerBuilder
func (*Container) AddEnvFromSecret ¶ added in v0.8.0
func (b *Container) AddEnvFromSecret(secretName string) ContainerBuilder
func (*Container) AddEnvSource ¶ added in v0.8.0
func (b *Container) AddEnvSource(envs []corev1.EnvFromSource) ContainerBuilder
func (*Container) AddEnvVar ¶ added in v0.8.0
func (b *Container) AddEnvVar(env *corev1.EnvVar) ContainerBuilder
func (*Container) AddEnvVars ¶ added in v0.8.0
func (b *Container) AddEnvVars(envVars []corev1.EnvVar) ContainerBuilder
func (*Container) AddPort ¶ added in v0.8.0
func (b *Container) AddPort(port corev1.ContainerPort)
func (*Container) AddPorts ¶ added in v0.8.0
func (b *Container) AddPorts(ports []corev1.ContainerPort) ContainerBuilder
func (*Container) AddVolumeMount ¶ added in v0.8.0
func (b *Container) AddVolumeMount(mount *corev1.VolumeMount) ContainerBuilder
func (*Container) AddVolumeMounts ¶ added in v0.8.0
func (b *Container) AddVolumeMounts(mounts []corev1.VolumeMount) ContainerBuilder
func (*Container) AutomaticSetProbe ¶ added in v0.8.0
func (b *Container) AutomaticSetProbe()
AutomaticSetProbe sets the liveness, readiness and startup probes policy: - handle policy:
- if name of ports contains "http", "ui", "metrics" or "health", use httpGet
- if name of ports contains "master", use tcpSocket
- todo: add more rules
- startupProbe:
- failureThreshold: 30
- initialDelaySeconds: 4
- periodSeconds: 6
- successThreshold: 1
- timeoutSeconds: 3
- livenessProbe:
- failureThreshold: 3
- periodSeconds: 10
- successThreshold: 1
- timeoutSeconds: 3
- readinessProbe:
- failureThreshold: 3
- periodSeconds: 10
- successThreshold: 1
- timeoutSeconds: 3
func (*Container) GetEnvFrom ¶ added in v0.8.0
func (b *Container) GetEnvFrom() []corev1.EnvFromSource
func (*Container) GetEnvVars ¶ added in v0.8.0
func (*Container) GetPorts ¶ added in v0.8.0
func (b *Container) GetPorts() []corev1.ContainerPort
func (*Container) GetVolumeMounts ¶ added in v0.8.0
func (b *Container) GetVolumeMounts() []corev1.VolumeMount
func (*Container) OverrideCommand ¶ added in v0.8.0
func (b *Container) OverrideCommand(command []string) ContainerBuilder
func (*Container) OverrideEnv ¶ added in v0.8.0
func (*Container) ResetEnvFrom ¶ added in v0.8.0
func (b *Container) ResetEnvFrom(envs []corev1.EnvFromSource)
func (*Container) ResetEnvVars ¶ added in v0.8.0
func (*Container) ResetPorts ¶ added in v0.8.0
func (b *Container) ResetPorts(ports []corev1.ContainerPort)
func (*Container) ResetVolumeMounts ¶ added in v0.8.0
func (b *Container) ResetVolumeMounts(mounts []corev1.VolumeMount)
func (*Container) SetArgs ¶ added in v0.8.0
func (b *Container) SetArgs(args []string) ContainerBuilder
func (*Container) SetCommand ¶ added in v0.8.0
func (b *Container) SetCommand(command []string) ContainerBuilder
func (*Container) SetImagePullPolicy ¶ added in v0.8.0
func (b *Container) SetImagePullPolicy(policy *corev1.PullPolicy) ContainerBuilder
func (*Container) SetLivenessProbe ¶ added in v0.8.0
func (b *Container) SetLivenessProbe(probe *corev1.Probe) ContainerBuilder
func (*Container) SetProbeWithHealth ¶ added in v0.8.0
func (b *Container) SetProbeWithHealth()
func (*Container) SetReadinessProbe ¶ added in v0.8.0
func (b *Container) SetReadinessProbe(probe *corev1.Probe) ContainerBuilder
func (*Container) SetResources ¶ added in v0.8.0
func (b *Container) SetResources(resources *commonsv1alpha1.ResourcesSpec) ContainerBuilder
func (*Container) SetSecurityContext ¶ added in v0.8.0
func (b *Container) SetSecurityContext(user int64, group int64, nonRoot bool) ContainerBuilder
func (*Container) SetStartupProbe ¶ added in v0.8.0
func (b *Container) SetStartupProbe(probe *corev1.Probe) ContainerBuilder
type ContainerBuilder ¶
type ContainerBuilder interface { Build() *corev1.Container SetImagePullPolicy(policy *corev1.PullPolicy) ContainerBuilder AddVolumeMounts(mounts []corev1.VolumeMount) ContainerBuilder AddVolumeMount(mount *corev1.VolumeMount) ContainerBuilder AddEnvVars(envs []corev1.EnvVar) ContainerBuilder AddEnvVar(env *corev1.EnvVar) ContainerBuilder AddEnvSource(envs []corev1.EnvFromSource) ContainerBuilder AddEnvFromSecret(secretName string) ContainerBuilder AddEnvFromConfigMap(configMapName string) ContainerBuilder AddPorts(ports []corev1.ContainerPort) ContainerBuilder SetCommand(command []string) ContainerBuilder SetArgs(args []string) ContainerBuilder OverrideCommand(command []string) ContainerBuilder SetResources(resources *commonsv1alpha1.ResourcesSpec) ContainerBuilder SetLivenessProbe(probe *corev1.Probe) ContainerBuilder SetReadinessProbe(probe *corev1.Probe) ContainerBuilder SetStartupProbe(probe *corev1.Probe) ContainerBuilder SetSecurityContext(user int64, group int64, nonRoot bool) ContainerBuilder }
ContainerBuilder is an interface for building a container implementation with build pattern
func NewContainerBuilder ¶ added in v0.8.0
func NewContainerBuilder( name, image string, ) ContainerBuilder
NewContainerBuilder returns a new ContainerBuilder This method return a ContainerBuilder interface Example:
fooContainer := builder.NewContainerBuilder("foo", "nginx"). SetImagePullPolicy(corev1.PullAlways). Build()
type Deployment ¶ added in v0.8.0
type Deployment struct {
BaseWorkloadReplicasBuilder
}
func NewDeployment ¶ added in v0.8.0
func NewDeployment( client *client.Client, name string, replicas *int32, image *util.Image, options WorkloadOptions, ) *Deployment
func (*Deployment) Build ¶ added in v0.8.0
func (b *Deployment) Build(_ context.Context) (ctrlclient.Object, error)
func (*Deployment) GetObject ¶ added in v0.8.0
func (b *Deployment) GetObject() (*appv1.Deployment, error)
type DeploymentBuilder ¶
type DeploymentBuilder interface { ResourceBuilder GetObject() (*appv1.Deployment, error) WorkloadReplicas WorkloadContainers WorkloadInitContainers WorkloadVolumes WorkloadAffinity WorkloadTerminationGracePeriodSeconds WorkloadSecurityContext WorkloadResource }
type GenericClusterRoleBindingBuilder ¶
type GenericClusterRoleBindingBuilder struct { BaseResourceBuilder // contains filtered or unexported fields }
func NewGenericClusterRoleBindingBuilder ¶
func NewGenericClusterRoleBindingBuilder( client *resourceClient.Client, name string, labels map[string]string, annotations map[string]string, ) *GenericClusterRoleBindingBuilder
func (*GenericClusterRoleBindingBuilder) Build ¶
func (b *GenericClusterRoleBindingBuilder) Build(ctx context.Context) (ctrlclient.Object, error)
func (*GenericClusterRoleBindingBuilder) GetObject ¶
func (b *GenericClusterRoleBindingBuilder) GetObject() *rbacv1.ClusterRoleBinding
type GenericClusterRoleBuilder ¶
type GenericClusterRoleBuilder struct { BaseResourceBuilder // contains filtered or unexported fields }
func NewGenericClusterRoleBuilder ¶
func NewGenericClusterRoleBuilder( client *resourceClient.Client, name string, labels map[string]string, annotations map[string]string, ) *GenericClusterRoleBuilder
func (*GenericClusterRoleBuilder) Build ¶
func (b *GenericClusterRoleBuilder) Build(ctx context.Context) (ctrlclient.Object, error)
func (*GenericClusterRoleBuilder) GetObject ¶
func (b *GenericClusterRoleBuilder) GetObject() *rbacv1.ClusterRole
type GenericRoleBindingBuilder ¶
type GenericRoleBindingBuilder struct { BaseResourceBuilder // contains filtered or unexported fields }
func NewGenericRoleBindingBuilder ¶
func NewGenericRoleBindingBuilder( client *resourceClient.Client, name string, labels map[string]string, annotations map[string]string, ) *GenericRoleBindingBuilder
func (*GenericRoleBindingBuilder) Build ¶
func (b *GenericRoleBindingBuilder) Build(ctx context.Context) (ctrlclient.Object, error)
func (*GenericRoleBindingBuilder) GetObject ¶
func (b *GenericRoleBindingBuilder) GetObject() *rbacv1.RoleBinding
type GenericRoleBuilder ¶
type GenericRoleBuilder struct { BaseResourceBuilder // contains filtered or unexported fields }
func NewGenericRoleBuilder ¶
func NewGenericRoleBuilder( client *resourceClient.Client, name string, labels map[string]string, annotations map[string]string, ) *GenericRoleBuilder
func (*GenericRoleBuilder) Build ¶
func (b *GenericRoleBuilder) Build(ctx context.Context) (ctrlclient.Object, error)
func (*GenericRoleBuilder) GetObject ¶
func (b *GenericRoleBuilder) GetObject() *rbacv1.Role
type GenericServiceAccountBuilder ¶
type GenericServiceAccountBuilder struct { BaseResourceBuilder // contains filtered or unexported fields }
func NewGenericServiceAccountBuilder ¶
func NewGenericServiceAccountBuilder( client *resourceClient.Client, name string, labels map[string]string, annotations map[string]string, ) *GenericServiceAccountBuilder
func (*GenericServiceAccountBuilder) Build ¶
func (b *GenericServiceAccountBuilder) Build(ctx context.Context) (ctrlclient.Object, error)
func (*GenericServiceAccountBuilder) GetObject ¶
func (b *GenericServiceAccountBuilder) GetObject() *corev1.ServiceAccount
type Job ¶ added in v0.8.4
type Job struct { BaseWorkloadBuilder // contains filtered or unexported fields }
func (*Job) SetRestPolicy ¶ added in v0.8.4
func (b *Job) SetRestPolicy(policy *corev1.RestartPolicy)
type JobBuilder ¶
type JobBuilder interface { ResourceBuilder GetObject() (*batchv1.Job, error) WorkloadContainers WorkloadInitContainers WorkloadVolumes WorkloadAffinity WorkloadTerminationGracePeriodSeconds WorkloadSecurityContext WorkloadResource SetRestPolicy(policy *corev1.RestartPolicy) }
func NewGenericJobBuilder ¶
func NewGenericJobBuilder( client *resourceClient.Client, name string, image *util.Image, options WorkloadOptions, ) JobBuilder
type ResourceBuilder ¶ added in v0.8.0
type ResourceBuilder interface { Build(ctx context.Context) (ctrlclient.Object, error) GetObjectMeta() metav1.ObjectMeta GetClient() *client.Client SetName(name string) GetName() string AddLabels(labels map[string]string) GetLabels() map[string]string AddAnnotations(annotations map[string]string) GetAnnotations() map[string]string }
type RoleBindingBuilder ¶
type RoleBindingBuilder interface { ResourceBuilder GetObject() *rbacv1.RoleBinding }
type RoleBuilder ¶
type RoleBuilder interface { ResourceBuilder GetObject() *rbacv1.Role }
type SecretBuilder ¶
type SecretBuilder struct {
BaseConfigBuilder
}
func NewSecretBuilder ¶
func (*SecretBuilder) Build ¶
func (b *SecretBuilder) Build(_ context.Context) (ctrlclient.Object, error)
func (*SecretBuilder) GetObject ¶
func (b *SecretBuilder) GetObject() *corev1.Secret
type ServiceAccountBuilder ¶
type ServiceAccountBuilder interface { ResourceBuilder GetObject() *corev1.ServiceAccount }
type ServiceBuilder ¶
type ServiceBuilder interface { ResourceBuilder GetObject() *corev1.Service AddPort(port *corev1.ServicePort) GetPorts() []corev1.ServicePort GetServiceType() corev1.ServiceType }
type StatefulSet ¶ added in v0.8.0
type StatefulSet struct { BaseWorkloadReplicasBuilder // contains filtered or unexported fields }
func NewStatefulSetBuilder ¶ added in v0.8.0
func NewStatefulSetBuilder( client *client.Client, name string, replicas *int32, image *util.Image, options WorkloadOptions, ) *StatefulSet
func (*StatefulSet) AddVolumeClaimTemplate ¶ added in v0.8.0
func (b *StatefulSet) AddVolumeClaimTemplate(pvc *corev1.PersistentVolumeClaim)
func (*StatefulSet) AddVolumeClaimTemplates ¶ added in v0.8.0
func (b *StatefulSet) AddVolumeClaimTemplates(claims []corev1.PersistentVolumeClaim)
func (*StatefulSet) Build ¶ added in v0.8.0
func (b *StatefulSet) Build(ctx context.Context) (ctrlclient.Object, error)
func (*StatefulSet) GetObject ¶ added in v0.8.0
func (b *StatefulSet) GetObject() (*appv1.StatefulSet, error)
func (*StatefulSet) GetVolumeClaimTemplates ¶ added in v0.8.0
func (b *StatefulSet) GetVolumeClaimTemplates() []corev1.PersistentVolumeClaim
func (*StatefulSet) ResetVolumeClaimTemplates ¶ added in v0.8.0
func (b *StatefulSet) ResetVolumeClaimTemplates(claims []corev1.PersistentVolumeClaim)
type StatefulSetBuilder ¶
type StatefulSetBuilder interface { ResourceBuilder WorkloadReplicas WorkloadContainers WorkloadInitContainers WorkloadVolumes WorkloadAffinity WorkloadTerminationGracePeriodSeconds WorkloadSecurityContext WorkloadResource GetObject() (*appv1.StatefulSet, error) AddVolumeClaimTemplates(claims []corev1.PersistentVolumeClaim) AddVolumeClaimTemplate(claim *corev1.PersistentVolumeClaim) ResetVolumeClaimTemplates(claims []corev1.PersistentVolumeClaim) GetVolumeClaimTemplates() []corev1.PersistentVolumeClaim }
type VectorDecorator ¶ added in v0.8.0
type VectorDecorator struct { WorkloadObject ctrlclient.Object LogVolumeName string VectorConfigVolumeName string VectorConfigMapName string LogProviderContainerName []string }
func (*VectorDecorator) Decorate ¶ added in v0.8.0
func (v *VectorDecorator) Decorate() error
func (*VectorDecorator) NewVectorContainer ¶ added in v0.8.0
func (v *VectorDecorator) NewVectorContainer() *corev1.Container
type WorkloadAffinity ¶ added in v0.8.0
type WorkloadContainers ¶ added in v0.8.0
type WorkloadDecorator ¶ added in v0.8.0
type WorkloadDecorator interface {
Decorate() error
}
type WorkloadImage ¶ added in v0.8.0
type WorkloadInitContainers ¶ added in v0.8.0
type WorkloadOptions ¶ added in v0.8.0
type WorkloadOptions struct { Options Affinity *corev1.Affinity PodOverrides *corev1.PodTemplateSpec EnvOverrides map[string]string CommandOverrides []string TerminationGracePeriod *time.Duration // Workload cpu and memory resource limits and requests Resource *commonsv1alpha1.ResourcesSpec }
type WorkloadReplicas ¶ added in v0.8.0
type WorkloadResource ¶ added in v0.8.0
type WorkloadResource interface { SetResources(resources *commonsv1alpha1.ResourcesSpec) GetResources() *commonsv1alpha1.ResourcesSpec }
type WorkloadSecurityContext ¶ added in v0.8.0
type WorkloadSecurityContext interface { SetSecurityContext(user int64, group int64, nonRoot bool) GetSecurityContext() *corev1.PodSecurityContext }