Documentation ¶
Index ¶
- Constants
- Variables
- func ClusterRoleBindingName(rbacPrefix string) string
- func ClusterRoleName(rbacPrefix string) string
- func ContainerPorts2ServicePorts(port []corev1.ContainerPort) []corev1.ServicePort
- func ListenerClass2ServiceType(listenerClass constants.ListenerClass) corev1.ServiceType
- func LogProviderCommand(entrypointScript string) ([]string, error)
- func RoleBindingName(rbacPrefix string) string
- func RoleName(rbacPrefix string) string
- func ServiceAccountName(rbacPrefix string) string
- 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) AddItem(key, value string) ConfigBuilder
- func (b *BaseConfigBuilder) ClearData() ConfigBuilder
- func (b *BaseConfigBuilder) GetData() map[string]string
- 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
- 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, error)
- 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) ContainerBuilder
- 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) ContainerBuilder
- 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 DefaultPDBBuilder
- type Deployment
- type DeploymentBuilder
- type GenericClusterRoleBindingBuilder
- func (b *GenericClusterRoleBindingBuilder) AddSubject(saName string) ClusterRoleBindingBuilder
- func (b *GenericClusterRoleBindingBuilder) Build(ctx context.Context) (ctrlclient.Object, error)
- func (b *GenericClusterRoleBindingBuilder) GetObject() *rbacv1.ClusterRoleBinding
- func (b *GenericClusterRoleBindingBuilder) SetClusterRoleBinding(obj *rbacv1.ClusterRoleBinding) ClusterRoleBindingBuilder
- func (b *GenericClusterRoleBindingBuilder) SetRoleRef(roleRefName string) ClusterRoleBindingBuilder
- func (b *GenericClusterRoleBindingBuilder) SetSubjects(saNames []string) ClusterRoleBindingBuilder
- type GenericClusterRoleBuilder
- type GenericRoleBindingBuilder
- func (b *GenericRoleBindingBuilder) AddSubject(saName string) RoleBindingBuilder
- func (b *GenericRoleBindingBuilder) Build(ctx context.Context) (ctrlclient.Object, error)
- func (b *GenericRoleBindingBuilder) GetObject() *rbacv1.RoleBinding
- func (b *GenericRoleBindingBuilder) SetRoleRef(roleRefName string, isCluster bool) RoleBindingBuilder
- func (b *GenericRoleBindingBuilder) SetSubjects(saNames []string) RoleBindingBuilder
- type GenericRoleBuilder
- func (b *GenericRoleBuilder) AddPolicyRule(rule rbacv1.PolicyRule)
- func (b *GenericRoleBuilder) AddPolicyRules(rules []rbacv1.PolicyRule)
- func (b *GenericRoleBuilder) Build(ctx context.Context) (ctrlclient.Object, error)
- func (b *GenericRoleBuilder) GetObject() *rbacv1.Role
- func (b *GenericRoleBuilder) ResetPolicyRules(rules []rbacv1.PolicyRule)
- func (b *GenericRoleBuilder) SetObject(obj *rbacv1.Role)
- type GenericServiceAccountBuilder
- type Job
- type JobBuilder
- type ListenerOperatorVolume
- type Option
- type Options
- type PDBBuilderOption
- type PDBBuilderOptions
- type PodDisruptionBudgetBuilder
- type ResourceBuilder
- type RoleBindingBuilder
- type RoleBuilder
- type SecretBuilder
- type SecretOperatorVolume
- func (s *SecretOperatorVolume) Builde() *corev1.Volume
- func (s *SecretOperatorVolume) SetCertJitterFactor(factor string)
- func (s *SecretOperatorVolume) SetCertLifeTime(lifetime string)
- func (s *SecretOperatorVolume) SetFormatName(format constants.SecretFormat)
- func (s *SecretOperatorVolume) SetKerberosServiceNames(service string, services ...string)
- func (s *SecretOperatorVolume) SetPKCS12Password(password string)
- func (s *SecretOperatorVolume) SetScope(pod, node bool, service, listenerVolume string)
- type ServiceAccountBuilder
- type ServiceBuilder
- type ServiceBuilderOption
- type ServiceBuilderOptions
- 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 VolumeBuilder
- type WorkloadAffinity
- type WorkloadContainers
- type WorkloadDecorator
- type WorkloadImage
- type WorkloadInitContainers
- type WorkloadOptions
- type WorkloadReplicas
- type WorkloadResource
- type WorkloadSecurityContext
- type WorkloadTerminationGracePeriodSeconds
- type WorkloadVolumes
Constants ¶
const ( VectorContainerName = "vector" VectorConfigFile = "vector.yaml" VectorConfigVolumeName = "config" VectorLogVolumeName = "log" )
Variables ¶
var ( HTTPGetProbHandler2PortNames = []string{"http", "ui", "metrics", "health"} TCPProbHandler2PortNames = []string{"master"} )
var ( VectorLogDir = path.Join(constants.KubedoopLogDir, "_vector") VectorShutdownFile = path.Join(VectorLogDir, "shutdown") )
var (
DefaultReplicas = int32(1)
)
var ErrNoContainers = errors.New("no containers defined")
Functions ¶
func ClusterRoleBindingName ¶ added in v0.9.1
func ClusterRoleName ¶ added in v0.9.1
func ContainerPorts2ServicePorts ¶ added in v0.8.0
func ContainerPorts2ServicePorts(port []corev1.ContainerPort) []corev1.ServicePort
func ListenerClass2ServiceType ¶ added in v0.10.0
func ListenerClass2ServiceType(listenerClass constants.ListenerClass) corev1.ServiceType
ListenerClass2ServiceType converts listener class to k8s service type
ClusterInternal --> ClusterIP ExternalUnstable --> NodePort ExternalStable --> LoadBalancer Default --> ClusterIP
func LogProviderCommand ¶ added in v0.8.0
func RoleBindingName ¶ added in v0.9.1
func ServiceAccountName ¶ added in v0.9.1
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) AddItem ¶ added in v0.10.0
func (b *BaseConfigBuilder) AddItem(key, value string) ConfigBuilder
func (*BaseConfigBuilder) ClearData ¶
func (b *BaseConfigBuilder) ClearData() ConfigBuilder
func (*BaseConfigBuilder) GetData ¶
func (b *BaseConfigBuilder) GetData() map[string]string
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 ClusterName string RoleName string RoleGroupName string // 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, ports []corev1.ContainerPort, options ...ServiceBuilderOptions, ) *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
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 cliOverrides 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, error)
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 AddItem(key, value string) ConfigBuilder SetData(data map[string]string) ConfigBuilder ClearData() ConfigBuilder GetData() map[string]string }
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) AddEnv ¶ added in v0.8.0
func (b *Container) AddEnv(key, value string) ContainerBuilder
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) AddEnvs ¶ added in v0.8.0
func (b *Container) AddEnvs(envs map[string]string) 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 AddEnvs(envs map[string]string) ContainerBuilder AddEnv(name, value string) 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 string, image *util.Image, ) ContainerBuilder
NewContainerBuilder returns a new ContainerBuilder This method return a ContainerBuilder interface Example:
image := util.Image{Custom: "nginx"} fooContainer := builder.NewContainerBuilder("foo", "nginx"). SetImagePullPolicy(corev1.PullAlways). Build()
type DefaultPDBBuilder ¶ added in v0.11.0
type DefaultPDBBuilder struct { BaseResourceBuilder // contains filtered or unexported fields }
func NewDefaultPDBBuilder ¶ added in v0.11.0
func NewDefaultPDBBuilder( client *client.Client, name string, options ...PDBBuilderOption, ) (*DefaultPDBBuilder, error)
func (*DefaultPDBBuilder) Build ¶ added in v0.11.0
func (d *DefaultPDBBuilder) Build(ctx context.Context) (ctrlclient.Object, error)
Build implements PodDisruptionBudgetBuilder. Subtle: this method shadows the method (BaseResourceBuilder).Build of DefaultPodDisruptionBudgetBuilder.BaseResourceBuilder.
func (*DefaultPDBBuilder) GetObject ¶ added in v0.11.0
func (d *DefaultPDBBuilder) GetObject() (*policyv1.PodDisruptionBudget, error)
You can specify only one of maxUnavailable and minAvailable in a single PodDisruptionBudget. maxUnavailable can only be used to control the eviction of pods that have an associated controller managing them.
func (*DefaultPDBBuilder) SetMaxUnavailable ¶ added in v0.11.0
func (d *DefaultPDBBuilder) SetMaxUnavailable(max intstr.IntOrString)
SetMaxUnavailable implements PodDisruptionBudgetBuilder.
func (*DefaultPDBBuilder) SetMinAvailable ¶ added in v0.11.0
func (d *DefaultPDBBuilder) SetMinAvailable(min intstr.IntOrString)
SetMinAvailable implements PodDisruptionBudgetBuilder.
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) AddSubject ¶ added in v0.9.1
func (b *GenericClusterRoleBindingBuilder) AddSubject(saName string) ClusterRoleBindingBuilder
add subect
func (*GenericClusterRoleBindingBuilder) Build ¶
func (b *GenericClusterRoleBindingBuilder) Build(ctx context.Context) (ctrlclient.Object, error)
func (*GenericClusterRoleBindingBuilder) GetObject ¶
func (b *GenericClusterRoleBindingBuilder) GetObject() *rbacv1.ClusterRoleBinding
func (*GenericClusterRoleBindingBuilder) SetClusterRoleBinding ¶ added in v0.9.1
func (b *GenericClusterRoleBindingBuilder) SetClusterRoleBinding(obj *rbacv1.ClusterRoleBinding) ClusterRoleBindingBuilder
set clusterRoleBinding
func (*GenericClusterRoleBindingBuilder) SetRoleRef ¶ added in v0.9.1
func (b *GenericClusterRoleBindingBuilder) SetRoleRef(roleRefName string) ClusterRoleBindingBuilder
set roleref when obj not provided, need to set it, after the resource is applied, the roleRef is Immutable
func (*GenericClusterRoleBindingBuilder) SetSubjects ¶ added in v0.9.1
func (b *GenericClusterRoleBindingBuilder) SetSubjects(saNames []string) ClusterRoleBindingBuilder
set subjects after the resource is applied, the subjects can be set continuously
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) AddSubject ¶ added in v0.9.1
func (b *GenericRoleBindingBuilder) AddSubject(saName string) RoleBindingBuilder
add subect
func (*GenericRoleBindingBuilder) Build ¶
func (b *GenericRoleBindingBuilder) Build(ctx context.Context) (ctrlclient.Object, error)
func (*GenericRoleBindingBuilder) GetObject ¶
func (b *GenericRoleBindingBuilder) GetObject() *rbacv1.RoleBinding
func (*GenericRoleBindingBuilder) SetRoleRef ¶ added in v0.9.1
func (b *GenericRoleBindingBuilder) SetRoleRef(roleRefName string, isCluster bool) RoleBindingBuilder
set roleref when obj not provided, need to set it, after the resource is applied, the roleRef is Immutable
func (*GenericRoleBindingBuilder) SetSubjects ¶ added in v0.9.1
func (b *GenericRoleBindingBuilder) SetSubjects(saNames []string) RoleBindingBuilder
set subjects after the resource is applied, the subjects can be set continuously
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) AddPolicyRule ¶ added in v0.11.0
func (b *GenericRoleBuilder) AddPolicyRule(rule rbacv1.PolicyRule)
func (*GenericRoleBuilder) AddPolicyRules ¶ added in v0.11.0
func (b *GenericRoleBuilder) AddPolicyRules(rules []rbacv1.PolicyRule)
func (*GenericRoleBuilder) Build ¶
func (b *GenericRoleBuilder) Build(ctx context.Context) (ctrlclient.Object, error)
func (*GenericRoleBuilder) GetObject ¶
func (b *GenericRoleBuilder) GetObject() *rbacv1.Role
func (*GenericRoleBuilder) ResetPolicyRules ¶ added in v0.11.0
func (b *GenericRoleBuilder) ResetPolicyRules(rules []rbacv1.PolicyRule)
func (*GenericRoleBuilder) SetObject ¶ added in v0.11.0
func (b *GenericRoleBuilder) SetObject(obj *rbacv1.Role)
set obj
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 ListenerOperatorVolume ¶ added in v0.8.6
type ListenerOperatorVolume struct { Name string ListenerClass string // contains filtered or unexported fields }
func NewListenerOperatorVolume ¶ added in v0.8.6
func NewListenerOperatorVolume(name, listenerClass string) *ListenerOperatorVolume
func (*ListenerOperatorVolume) Builde ¶ added in v0.8.6
func (l *ListenerOperatorVolume) Builde() *corev1.Volume
func (*ListenerOperatorVolume) SetListenerName ¶ added in v0.8.6
func (l *ListenerOperatorVolume) SetListenerName(name string)
type PDBBuilderOption ¶ added in v0.11.0
type PDBBuilderOption func(*PDBBuilderOptions)
type PDBBuilderOptions ¶ added in v0.11.0
type PodDisruptionBudgetBuilder ¶ added in v0.11.0
type PodDisruptionBudgetBuilder interface { ResourceBuilder GetObject() (*policyv1.PodDisruptionBudget, error) SetMinAvailable(min intstr.IntOrString) }
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 SecretOperatorVolume ¶ added in v0.8.6
type SecretOperatorVolume struct { Name string SecretClass string // contains filtered or unexported fields }
func NewSecretOperatorVolume ¶ added in v0.8.6
func NewSecretOperatorVolume(name, secretClass string) *SecretOperatorVolume
func (*SecretOperatorVolume) Builde ¶ added in v0.8.6
func (s *SecretOperatorVolume) Builde() *corev1.Volume
func (*SecretOperatorVolume) SetCertJitterFactor ¶ added in v0.8.6
func (s *SecretOperatorVolume) SetCertJitterFactor(factor string)
func (*SecretOperatorVolume) SetCertLifeTime ¶ added in v0.8.6
func (s *SecretOperatorVolume) SetCertLifeTime(lifetime string)
func (*SecretOperatorVolume) SetFormatName ¶ added in v0.8.6
func (s *SecretOperatorVolume) SetFormatName(format constants.SecretFormat)
func (*SecretOperatorVolume) SetKerberosServiceNames ¶ added in v0.8.6
func (s *SecretOperatorVolume) SetKerberosServiceNames(service string, services ...string)
func (*SecretOperatorVolume) SetPKCS12Password ¶ added in v0.8.6
func (s *SecretOperatorVolume) SetPKCS12Password(password string)
func (*SecretOperatorVolume) SetScope ¶ added in v0.8.6
func (s *SecretOperatorVolume) SetScope(pod, node bool, service, listenerVolume string)
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 }
type ServiceBuilderOption ¶ added in v0.10.0
type ServiceBuilderOptions ¶ added in v0.10.0
type ServiceBuilderOptions func(*ServiceBuilderOption)
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 Image *util.Image LogVolumeName string VectorConfigVolumeName string VectorConfigMapName string LogProviderContainerName []string //optional }
func NewVectorDecorator ¶ added in v0.9.2
func NewVectorDecorator( workloadObject ctrlclient.Object, image *util.Image, logVolumeName string, vectorConfigVolumeName string, vectorConfigMapName string, ) *VectorDecorator
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 VolumeBuilder ¶ added in v0.8.6
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 { Option Affinity *corev1.Affinity PodOverrides *corev1.PodTemplateSpec EnvOverrides map[string]string CliOverrides []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 }