kube

package
v0.0.0-...-1d8deb8 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	// ObjectModifiedTryAgainError contains the error text for an error that can happen when multiple reconciliation loops are called for the same object at nearly the same time.
	// When this happens, we just want to requeue the reconcile after some amount of time to ensure the latest changes were applied to the sub-resources
	ObjectModifiedTryAgainError = "the object has been modified; please apply your changes to the latest version and try again"
)

Variables

This section is empty.

Functions

func AssembleChiaContainer

func AssembleChiaContainer(input AssembleChiaContainerInputs) corev1.Container

AssembleChiaContainer assembles a chia container spec

func AssembleChiaExporterContainer

func AssembleChiaExporterContainer(input AssembleChiaExporterContainerInputs) corev1.Container

AssembleChiaExporterContainer assembles a chia-exporter container spec

func AssembleChiaHealthcheckContainer

func AssembleChiaHealthcheckContainer(input AssembleChiaHealthcheckContainerInputs) corev1.Container

AssembleChiaHealthcheckContainer assembles a chia-healthcheck container spec

func AssembleChiaHealthcheckProbe

func AssembleChiaHealthcheckProbe(input AssembleChiaHealthcheckProbeInputs) *corev1.Probe

func AssembleCommonService

func AssembleCommonService(input AssembleCommonServiceInputs) corev1.Service

AssembleCommonService accepts some values and outputs a kubernetes Service definition in a standard way

func CombineMaps

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

CombineMaps takes an arbitrary number of maps and combines them to one map[string]string

func GetChiaDaemonServicePorts

func GetChiaDaemonServicePorts() []corev1.ServicePort

func GetChiaExporterServicePorts

func GetChiaExporterServicePorts() []corev1.ServicePort

func GetChiaHealthcheckServicePorts

func GetChiaHealthcheckServicePorts() []corev1.ServicePort

GetChiaHealthcheckServicePorts returns the Service ports for chia-healthcheck Services

func GetChiaNetworkData

func GetChiaNetworkData(ctx context.Context, c client.Client, config k8schianetv1.CommonSpecChia, namespace string) (*map[string]string, error)

func GetCommonChiaEnv

func GetCommonChiaEnv(commonSpecChia k8schianetv1.CommonSpecChia, networkData *map[string]string) ([]corev1.EnvVar, error)

GetCommonChiaEnv retrieves the environment variables from the CommonSpecChia config struct

func GetCommonLabels

func GetCommonLabels(kind string, meta metav1.ObjectMeta, additionalLabels ...map[string]string) map[string]string

GetCommonLabels gives some common labels for chia-operator related objects

func GetExistingChiaRootVolume

func GetExistingChiaRootVolume(storage *k8schianetv1.StorageConfig) corev1.Volume

GetExistingChiaRootVolume returns a corev1 API Volume specification for CHIA_ROOT. If both a PV and hostPath volume are specified for CHIA_ROOT, the PV will take precedence. If both configs are empty, this will fall back to emptyDir so sidecars can mount CHIA_ROOT. NOTE: This function does not handle the mode where the controller generates a CHIA_ROOT PVC, itself. Therefore, if ShouldMakeVolumeClaim is true, specifying the PVC's name should be handled in the controller.

func GetExtraContainers

func GetExtraContainers(config []k8schianetv1.ExtraContainer, chiaContainer corev1.Container) []corev1.Container

func GetFullNodePort

func GetFullNodePort(chia k8schianetv1.CommonSpecChia, networkData *map[string]string) (int32, error)

GetFullNodePort determines the correct full_node port to use

func MarshalFullNodePeers

func MarshalFullNodePeers(peers []k8schianetv1.Peer) ([]byte, error)

MarshalFullNodePeers returns a byte slice of JSON marshalled data representing a full_node_peers list in the config

func ReconcileConfigMap

func ReconcileConfigMap(ctx context.Context, c client.Client, desired corev1.ConfigMap) (reconcile.Result, error)

ReconcileConfigMap uses the controller-runtime client to determine if the ConfigMap resource needs to be created or updated

func ReconcileDeployment

func ReconcileDeployment(ctx context.Context, c client.Client, desired appsv1.Deployment) (reconcile.Result, error)

ReconcileDeployment uses the controller-runtime client to determine if the deployment resource needs to be created or updated

func ReconcilePersistentVolumeClaim

func ReconcilePersistentVolumeClaim(ctx context.Context, c client.Client, storage *k8schianetv1.StorageConfig, desired corev1.PersistentVolumeClaim) (reconcile.Result, error)

ReconcilePersistentVolumeClaim uses the controller-runtime client to determine if the PVC resource needs to be created or updated

func ReconcileService

func ReconcileService(ctx context.Context, c client.Client, service k8schianetv1.Service, desired corev1.Service, defaultEnabled bool) (reconcile.Result, error)

ReconcileService uses the controller-runtime client to determine if the service resource needs to be created or updated

func ReconcileStatefulset

func ReconcileStatefulset(ctx context.Context, c client.Client, desired appsv1.StatefulSet) (reconcile.Result, error)

ReconcileStatefulset uses the controller-runtime client to determine if the statefulset resource needs to be created or updated

func ShouldMakeService

func ShouldMakeService(srv k8schianetv1.Service, def bool) bool

ShouldMakeService returns true if the related Service was configured to be made, otherwise returns the specified default value

func ShouldMakeVolumeClaim

func ShouldMakeVolumeClaim(storage *k8schianetv1.StorageConfig) bool

ShouldMakeVolumeClaim returns true if the related PersistentVolumeClaim was configured to be made

func ShouldRollIntoMainPeerService

func ShouldRollIntoMainPeerService(srv k8schianetv1.Service) bool

ShouldRollIntoMainPeerService returns true if the related Service's ports were meant to be rolled into the main peer Service's ports

Types

type AssembleChiaContainerInputs

type AssembleChiaContainerInputs struct {
	Image                *string
	ImagePullPolicy      corev1.PullPolicy
	Env                  []corev1.EnvVar
	Ports                []corev1.ContainerPort
	VolumeMounts         []corev1.VolumeMount
	SecurityContext      *corev1.SecurityContext
	LivenessProbe        *corev1.Probe
	ReadinessProbe       *corev1.Probe
	StartupProbe         *corev1.Probe
	ResourceRequirements *corev1.ResourceRequirements
}

AssembleChiaContainerInputs contains configuration inputs to the AssembleChiaContainer function

type AssembleChiaExporterContainerInputs

type AssembleChiaExporterContainerInputs struct {
	Image                *string
	ImagePullPolicy      corev1.PullPolicy
	ResourceRequirements corev1.ResourceRequirements
	ConfigSecretName     *string
	SecurityContext      *corev1.SecurityContext
}

AssembleChiaExporterContainerInputs contains configuration inputs to the AssembleChiaExporterContainer function

type AssembleChiaHealthcheckContainerInputs

type AssembleChiaHealthcheckContainerInputs struct {
	Image                *string
	ImagePullPolicy      corev1.PullPolicy
	ResourceRequirements corev1.ResourceRequirements
	DNSHostname          *string
	SecurityContext      *corev1.SecurityContext
}

AssembleChiaHealthcheckContainerInputs contains configuration inputs to the AssembleChiaHealthcheckContainer function

type AssembleChiaHealthcheckProbeInputs

type AssembleChiaHealthcheckProbeInputs struct {
	Path             string
	FailureThreshold *int32
	PeriodSeconds    *int32
}

AssembleChiaHealthcheckProbeInputs contains configuration inputs to the AssembleChiaHealthcheckProbe function

type AssembleCommonServiceInputs

type AssembleCommonServiceInputs struct {
	Name                  string
	Namespace             string
	Labels                map[string]string
	Annotations           map[string]string
	OwnerReference        []metav1.OwnerReference
	IPFamilyPolicy        *corev1.IPFamilyPolicy
	IPFamilies            *[]corev1.IPFamily
	ServiceType           *corev1.ServiceType
	ExternalTrafficPolicy *corev1.ServiceExternalTrafficPolicy
	SessionAffinity       *corev1.ServiceAffinity
	SessionAffinityConfig *corev1.SessionAffinityConfig
	Ports                 []corev1.ServicePort
	SelectorLabels        map[string]string
}

AssembleCommonServiceInputs contains configuration inputs to the AssembleCommonService function

Jump to

Keyboard shortcuts

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