resource

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

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

Go to latest
Published: Dec 22, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateAppNamespaceHash

func CreateAppNamespaceHash(source Source) string

We concatenate name, namespace and add a hash in order to avoid duplicate names when creating service accounts in common service accounts namespace. Also making sure to not exceed name length restrictions of 30 characters

func CreateEvent

func CreateEvent(source Source, reason, message, typeStr string) *corev1.Event

func CreateObjectMeta

func CreateObjectMeta(source Source) metav1.ObjectMeta

Types

type Ast

type Ast struct {
	Operations Operations

	// For podSpec
	Annotations    map[string]string
	Containers     []corev1.Container
	Env            []corev1.EnvVar
	EnvFrom        []corev1.EnvFromSource
	InitContainers []corev1.Container
	Labels         map[string]string
	Volumes        []corev1.Volume
	VolumeMounts   []corev1.VolumeMount
}

func NewAst

func NewAst() *Ast

func (*Ast) AppendEnv

func (a *Ast) AppendEnv(vars ...corev1.EnvVar)

Use AppendEnv for adding environment variables that depend on other environment variables, or to ensure that they can not be overridden by the user.

func (*Ast) AppendOperation

func (ast *Ast) AppendOperation(operationType OperationType, resource client.Object)

func (*Ast) PrependEnv

func (a *Ast) PrependEnv(vars ...corev1.EnvVar)

Use PrependEnv for adding environment variables that can be referenced by other environment variables or allowed to be overriden by the user.

type Operation

type Operation struct {
	Resource  client.Object `json:"resource"`
	Operation OperationType `json:"operation"`
}

Operation is the combination of a Kubernetes resource and what operation to perform on it.

type OperationType

type OperationType string

OperationType defines what should be done with a resource.

const (
	OperationCreateOrUpdate    OperationType = `CreateOrUpdate`
	OperationCreateOrRecreate  OperationType = `CreateOrRecreate`
	OperationCreateIfNotExists OperationType = `CreateIfNotExists`
	OperationDeleteIfExists    OperationType = `CreateDeleteIfExists`
	AnnotateIfExists           OperationType = `AnnotateIfExists`
)

type Operations

type Operations []Operation

func (*Operations) Extract

func (r *Operations) Extract(operation OperationType) Operations

Extract return a new slice of Operations where only one type of operation matches.

type Source

type Source interface {
	client.Object
	metav1.ObjectMetaAccessor
	metav1.Common
	SetStatus(*nais_io_v1.Status)
	GetStatus() *nais_io_v1.Status
	GetObjectReference() corev1.ObjectReference
	GetOwnerReference() metav1.OwnerReference
	GetGCP() *nais_io_v1.GCP
	GetPort() int
	CorrelationID() string
	SkipDeploymentMessage() bool
	LogFields() log.Fields
	ApplyDefaults() error
	Hash(aivenGeneration int) (string, error)
}

Jump to

Keyboard shortcuts

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