builder

package
v0.8.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 26, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
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

View Source
var (
	HTTPGetProbHandler2PortNames = []string{"http", "ui", "metrics", "health"}
	TCPProbHandler2PortNames     = []string{"master"}
	DefaultImagePullPolicy       = &[]corev1.PullPolicy{corev1.PullAlways}[0]
)
View Source
var (
	DefaultReplicas = int32(1)
)
View Source
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 LogProviderCommand(entrypointScript string) ([]string, error)

func MakeVectorYaml added in v0.8.0

func MakeVectorYaml(
	ctx context.Context,
	client ctrlclient.Client,
	namespace string,
	cluster string,
	role string,
	groupName string,
	vectorAggregatorDiscovery string) (string, error)

func ParseVectorYaml added in v0.8.4

func ParseVectorYaml(data map[string]interface{}) (string, error)

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 NewBaseConfigBuilder(
	client *client.Client,
	name string,
	labels map[string]string,
	annotations map[string]string,
) *BaseConfigBuilder

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 (*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 (*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 (*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 NewConfigMapBuilder(
	client *client.Client,
	name string,
	labels map[string]string,
	annotations map[string]string,
) *ConfigMapBuilder

func (*ConfigMapBuilder) Build

func (*ConfigMapBuilder) GetObject

func (b *ConfigMapBuilder) GetObject() *corev1.ConfigMap

type Container added in v0.8.0

type Container struct {
	Name  string
	Image string
	// contains filtered or unexported fields
}

func NewContainer added in v0.8.0

func NewContainer(
	name, image string,
) *Container

NewContainer returns a new Container

func (*Container) AddEnv added in v0.8.0

func (b *Container) AddEnv(key, value string)

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)

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) Build added in v0.8.0

func (b *Container) Build() *corev1.Container

func (*Container) GetEnvFrom added in v0.8.0

func (b *Container) GetEnvFrom() []corev1.EnvFromSource

func (*Container) GetEnvVars added in v0.8.0

func (b *Container) GetEnvVars() []corev1.EnvVar

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 (b *Container) OverrideEnv(envs map[string]string)

func (*Container) ResetEnvFrom added in v0.8.0

func (b *Container) ResetEnvFrom(envs []corev1.EnvFromSource)

func (*Container) ResetEnvVars added in v0.8.0

func (b *Container) ResetEnvVars(envVars []corev1.EnvVar)

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 (*Deployment) GetObject added in v0.8.0

func (b *Deployment) GetObject() (*appv1.Deployment, error)

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 (*GenericClusterRoleBindingBuilder) GetObject

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 (*GenericClusterRoleBuilder) GetObject

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 (*GenericRoleBindingBuilder) GetObject

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 (*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 (*GenericServiceAccountBuilder) GetObject

type Job added in v0.8.4

type Job struct {
	BaseWorkloadBuilder
	// contains filtered or unexported fields
}

func (*Job) Build added in v0.8.4

func (b *Job) Build(_ context.Context) (ctrlclient.Object, error)

func (*Job) GetObject added in v0.8.4

func (b *Job) GetObject() (*batchv1.Job, error)

func (*Job) SetRestPolicy added in v0.8.4

func (b *Job) SetRestPolicy(policy *corev1.RestartPolicy)

type Options

type Options struct {
	ClusterName   string
	RoleName      string
	RoleGroupName string
	Labels        map[string]string
	Annotations   map[string]string
}

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 NewSecretBuilder(
	client *client.Client,
	name string,
	labels map[string]string,
	annotations map[string]string,
) *SecretBuilder

func (*SecretBuilder) Build

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 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 WorkloadAffinity interface {
	SetAffinity(affinity *corev1.Affinity)
	GetAffinity() *corev1.Affinity
}

type WorkloadContainers added in v0.8.0

type WorkloadContainers interface {
	AddContainers(containers []corev1.Container)
	AddContainer(container *corev1.Container)
	ResetContainers(containers []corev1.Container)
	GetContainers() []corev1.Container
}

type WorkloadDecorator added in v0.8.0

type WorkloadDecorator interface {
	Decorate() error
}

type WorkloadImage added in v0.8.0

type WorkloadImage interface {
	SetImage(image *util.Image)
	GetImage() *util.Image
	GetImageWithTag() string
}

type WorkloadInitContainers added in v0.8.0

type WorkloadInitContainers interface {
	AddInitContainers(containers []corev1.Container)
	AddInitContainer(container *corev1.Container)
	ResetInitContainers(containers []corev1.Container)
	GetInitContainers() []corev1.Container
}

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 WorkloadReplicas interface {
	SetReplicas(replicas *int32)
	GetReplicas() *int32
}

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
}

type WorkloadTerminationGracePeriodSeconds added in v0.8.0

type WorkloadTerminationGracePeriodSeconds interface {
	SetTerminationGracePeriod(duration *time.Duration)
	GetTerminationGracePeriod() *time.Duration
}

type WorkloadVolumes added in v0.8.0

type WorkloadVolumes interface {
	AddVolumes(volumes []corev1.Volume)
	AddVolume(volume *corev1.Volume)
	ResetVolumes(volumes []corev1.Volume)
	GetVolumes() []corev1.Volume
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL