builder

package
v0.11.1 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2024 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	VectorContainerName = "vector"
	VectorConfigFile    = "vector.yaml"

	VectorConfigVolumeName = "config"
	VectorLogVolumeName    = "log"
)

Variables

View Source
var (
	HTTPGetProbHandler2PortNames = []string{"http", "ui", "metrics", "health"}
	TCPProbHandler2PortNames     = []string{"master"}
)
View Source
var (
	VectorLogDir       = path.Join(constants.KubedoopLogDir, "_vector")
	VectorShutdownFile = path.Join(VectorLogDir, "shutdown")
)
View Source
var (
	DefaultReplicas = int32(1)
)
View Source
var ErrNoContainers = errors.New("no containers defined")

Functions

func ClusterRoleBindingName added in v0.9.1

func ClusterRoleBindingName(rbacPrefix string) string

func ClusterRoleName added in v0.9.1

func ClusterRoleName(rbacPrefix string) string

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 LogProviderCommand(entrypointScript string) ([]string, error)

func RoleBindingName added in v0.9.1

func RoleBindingName(rbacPrefix string) string

func RoleName added in v0.11.0

func RoleName(rbacPrefix string) string

func ServiceAccountName added in v0.9.1

func ServiceAccountName(rbacPrefix string) string

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) 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 (*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 (*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 (*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 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 *util.Image
	// contains filtered or unexported fields
}

func NewContainer added in v0.8.0

func NewContainer(
	name string,
	image *util.Image,
) *Container

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

Build implements PodDisruptionBudgetBuilder. Subtle: this method shadows the method (BaseResourceBuilder).Build of DefaultPodDisruptionBudgetBuilder.BaseResourceBuilder.

func (*DefaultPDBBuilder) GetObject added in v0.11.0

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 (*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) AddSubject added in v0.9.1

add subect

func (*GenericClusterRoleBindingBuilder) Build

func (*GenericClusterRoleBindingBuilder) GetObject

func (*GenericClusterRoleBindingBuilder) SetClusterRoleBinding added in v0.9.1

set clusterRoleBinding

func (*GenericClusterRoleBindingBuilder) SetRoleRef added in v0.9.1

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

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 (*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) AddSubject added in v0.9.1

func (b *GenericRoleBindingBuilder) AddSubject(saName string) RoleBindingBuilder

add subect

func (*GenericRoleBindingBuilder) Build

func (*GenericRoleBindingBuilder) GetObject

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 (*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 (*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 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 Option added in v0.10.0

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

type Options

type Options func(Option) Option

type PDBBuilderOption added in v0.11.0

type PDBBuilderOption func(*PDBBuilderOptions)

type PDBBuilderOptions added in v0.11.0

type PDBBuilderOptions struct {
	Option
	MaxUnavailableAmount *int32
	MinAvailableAmount   *int32
}

type PodDisruptionBudgetBuilder added in v0.11.0

type PodDisruptionBudgetBuilder interface {
	ResourceBuilder
	GetObject() (*policyv1.PodDisruptionBudget, error)
	SetMaxUnavailable(max intstr.IntOrString)
	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 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 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 ServiceBuilderOption struct {
	Option

	// If not set, ClusterIP will be used
	ListenerClass  constants.ListenerClass
	Headless       bool
	MatchingLabels map[string]string
}

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 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 VolumeBuilder interface {
	Builde() *corev1.Volume
}

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, error)
}

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