template

package
v0.0.0-...-6b17c94 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2024 License: Apache-2.0 Imports: 38 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AppLabel       = "app.kubernetes.io/name"
	ComponentLabel = "app.kubernetes.io/component"
	InstanceLabel  = "app.kubernetes.io/instance"
)
View Source
const (
	AppliedHashAnnotation = "openstack.ospk8s.com/applied-hash"
)
View Source
const Finalizer = "openstack.ospk8s.com/finalizer"

Variables

This section is empty.

Functions

func AppLabels

func AppLabels(instance, app string) map[string]string

func AppliedHash

func AppliedHash(obj metav1.Object) string

func BidirectionalVolumeMount

func BidirectionalVolumeMount(name, mountPath string) corev1.VolumeMount

func Combine

func Combine(parts ...string) string

func ConfigMapEnvVar

func ConfigMapEnvVar(name, cmName, cmKey string) corev1.EnvVar

func ConfigMapVolume

func ConfigMapVolume(name, configMapName string, defaultMode *int32) corev1.Volume

func CreateJob

func CreateJob(ctx context.Context, c client.Client, instance *batchv1.Job, log logr.Logger) error

func CreateSecret

func CreateSecret(ctx context.Context, c client.Client, instance *corev1.Secret, log logr.Logger) error

func DecodeManifest

func DecodeManifest(encoded string) (*unstructured.Unstructured, error)

func DeleteJob

func DeleteJob(ctx context.Context, c client.Client, instance *batchv1.Job, log logr.Logger) error

func EmptyDirVolume

func EmptyDirVolume(name string) corev1.Volume

func EnsureConfigMap

func EnsureConfigMap(ctx context.Context, c client.Client, intended *corev1.ConfigMap, log logr.Logger) error

func EnsureDaemonSet

func EnsureDaemonSet(ctx context.Context, c client.Client, intended *appsv1.DaemonSet, log logr.Logger) error

func EnsureDeployment

func EnsureDeployment(ctx context.Context, c client.Client, instance *appsv1.Deployment, log logr.Logger) error

func EnsureIngress

func EnsureIngress(ctx context.Context, c client.Client, intended *netv1.Ingress, log logr.Logger) error

func EnsurePersistentVolumeClaim

func EnsurePersistentVolumeClaim(ctx context.Context, c client.Client, instance *corev1.PersistentVolumeClaim, log logr.Logger) error

func EnsureResource

func EnsureResource(ctx context.Context, c client.Client, instance *unstructured.Unstructured, log logr.Logger) error

func EnsureRole

func EnsureRole(ctx context.Context, c client.Client, intended *rbacv1.Role, log logr.Logger) error

func EnsureRoleBinding

func EnsureRoleBinding(ctx context.Context, c client.Client, intended *rbacv1.RoleBinding, log logr.Logger) error

func EnsureSecret

func EnsureSecret(ctx context.Context, c client.Client, intended *corev1.Secret, log logr.Logger) error

func EnsureService

func EnsureService(ctx context.Context, c client.Client, instance *corev1.Service, log logr.Logger) error

func EnsureServiceAccount

func EnsureServiceAccount(ctx context.Context, c client.Client, intended *corev1.ServiceAccount, log logr.Logger) error

func EnsureStatefulSet

func EnsureStatefulSet(ctx context.Context, c client.Client, instance *appsv1.StatefulSet, log logr.Logger) error

func EnvFromConfigMap

func EnvFromConfigMap(name string) corev1.EnvFromSource

func EnvFromSecret

func EnvFromSecret(name string) corev1.EnvFromSource

func EnvFromSecretPrefixed

func EnvFromSecretPrefixed(name, prefix string) corev1.EnvFromSource

func EnvVar

func EnvVar(name, value string) corev1.EnvVar

func FieldEnvVar

func FieldEnvVar(name, fieldPath string) corev1.EnvVar

func GenericConfigMap

func GenericConfigMap(name, namespace string, labels map[string]string) *corev1.ConfigMap

func GenericDaemonSet

func GenericDaemonSet(component Component) *appsv1.DaemonSet

func GenericDeployment

func GenericDeployment(component Component) *appsv1.Deployment

func GenericIngress

func GenericIngress(name, namespace string, spec *openstackv1beta1.IngressSpec, labels map[string]string) *netv1.Ingress

func GenericJob

func GenericJob(component Component) *batchv1.Job

func GenericRole

func GenericRole(name, namespace string, labels map[string]string, rules []rbacv1.PolicyRule) *rbacv1.Role

func GenericRoleBinding

func GenericRoleBinding(name, namespace string, labels map[string]string) *rbacv1.RoleBinding

func GenericSecret

func GenericSecret(name, namespace string, labels map[string]string) *corev1.Secret

func GenericService

func GenericService(name, namespace string, labels map[string]string) *corev1.Service

func GenericServiceAccount

func GenericServiceAccount(name, namespace string, labels map[string]string) *corev1.ServiceAccount

func GenericStatefulSet

func GenericStatefulSet(component Component) *appsv1.StatefulSet

func HeadlessServiceName

func HeadlessServiceName(name string) string

func HostPathVolume

func HostPathVolume(name, path string) corev1.Volume

func IngressServiceBackend

func IngressServiceBackend(svcName, portName string) netv1.IngressBackend

func Labels

func Labels(instance, app, component string) map[string]string

func MatchesAppliedHash

func MatchesAppliedHash(obj metav1.Object, expected string) bool

func MergeINI

func MergeINI(cfg *ini.File, extraCfg openstackv1beta1.ExtraConfig)

func MergeStringMaps

func MergeStringMaps(maps ...map[string]string) map[string]string

func MustDecodeManifest

func MustDecodeManifest(encoded string) *unstructured.Unstructured

func MustEncodeYAML

func MustEncodeYAML(in interface{}) []byte

func MustLoadINI

func MustLoadINI(app, filename string) *ini.File

func MustLoadINITemplate

func MustLoadINITemplate(app, filename string, values interface{}) *ini.File

func MustOutputINI

func MustOutputINI(file *ini.File) *bytes.Buffer

func MustParseINI

func MustParseINI(encoded string) *ini.File

func MustReadFile

func MustReadFile(app, filename string) string

func MustRenderFile

func MustRenderFile(app, filename string, values interface{}) string

func NewFernetKey

func NewFernetKey() string

func NewPassword

func NewPassword() string

func NodePodAntiAffinity

func NodePodAntiAffinity(labels map[string]string) *corev1.PodAntiAffinity

func ObjectHash

func ObjectHash(i interface{}) (string, error)

ObjectHash creates a deep object hash and return it as a safe encoded string

func PersistentVolume

func PersistentVolume(name, claimName string) corev1.Volume

func PersistentVolumeClaim

func PersistentVolumeClaim(name string, labels map[string]string, spec openstackv1beta1.VolumeSpec) corev1.PersistentVolumeClaim

func ReadFile

func ReadFile(app, filename string) (string, error)

func ReadOnlyVolumeMount

func ReadOnlyVolumeMount(name, mountPath string) corev1.VolumeMount

func RenderFile

func RenderFile(app, filename string, values interface{}) (string, error)

func RoleRef

func RoleRef(name string) rbacv1.RoleRef

func SSHKeypairSecret

func SSHKeypairSecret(name, namespace string, labels map[string]string) (*corev1.Secret, error)

func SecretEnvVar

func SecretEnvVar(name, secretName, secretKey string) corev1.EnvVar

func SecretVolume

func SecretVolume(name, secretName string, defaultMode *int32) corev1.Volume

func SetAppliedHash

func SetAppliedHash(obj metav1.Object, hash string)

func SetAppliedHashUnstructured

func SetAppliedHashUnstructured(instance *unstructured.Unstructured, hash string)

func StorageResources

func StorageResources(capacity string) corev1.VolumeResourceRequirements

func SubPathVolumeMount

func SubPathVolumeMount(name, mountPath, subPath string) corev1.VolumeMount

func VolumeMount

func VolumeMount(name, mountPath string) corev1.VolumeMount

Types

type Component

type Component struct {
	Namespace            string
	Labels               map[string]string
	Replicas             int32
	Affinity             *corev1.Affinity
	NodeSelector         map[string]string
	InitContainers       []corev1.Container
	Containers           []corev1.Container
	SecurityContext      *corev1.PodSecurityContext
	Volumes              []corev1.Volume
	VolumeClaimTemplates []corev1.PersistentVolumeClaim
}

type ConditionWaiter

type ConditionWaiter struct {
	// contains filtered or unexported fields
}

func NewConditionWaiter

func NewConditionWaiter(log logr.Logger) *ConditionWaiter

func (*ConditionWaiter) AddReadyCheck

func (cw *ConditionWaiter) AddReadyCheck(instance client.Object, conditions []metav1.Condition) *ConditionWaiter

func (*ConditionWaiter) Clear

func (cw *ConditionWaiter) Clear()

func (*ConditionWaiter) Wait

func (cw *ConditionWaiter) Wait() ctrl.Result

type JobRunner

type JobRunner struct {
	// contains filtered or unexported fields
}

func NewJobRunner

func NewJobRunner(ctx context.Context, c client.Client, log logr.Logger) *JobRunner

func (*JobRunner) Add

func (r *JobRunner) Add(hashField *string, job *batchv1.Job)

func (*JobRunner) Run

func (r *JobRunner) Run(owner client.Object) (ctrl.Result, error)

func (*JobRunner) SetReady

func (r *JobRunner) SetReady(readyField *bool)

Jump to

Keyboard shortcuts

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