base

package
v0.0.24 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package base provides various utility functions regarding base k8s resources used by the sf-operator

Package base provides various utility functions regarding base k8s resources used by the sf-operator

Index

Constants

This section is empty.

Variables

View Source
var (
	BusyboxImage          = ImageToString(Image{Path: "quay.io/software-factory/sf-op-busybox", Version: "1.5-3"})
	GerritImage           = ImageToString(Image{Path: "quay.io/software-factory/gerrit", Version: "3.6.4-8"})
	GitServerImage        = ImageToString(Image{Path: "quay.io/software-factory/git-deamon", Version: "2.39.3-1"})
	SSHDImage             = ImageToString(Image{Path: "quay.io/software-factory/sshd", Version: "0.1-3"})
	PurgeLogsImage        = ImageToString(Image{Path: "quay.io/software-factory/purgelogs", Version: "0.2.3-3"})
	NodepoolLauncherImage = ImageToString(Image{Path: "quay.io/software-factory/nodepool-launcher", Version: nodepoolImageVersion})
	NodepoolBuilderImage  = ImageToString(Image{Path: "quay.io/software-factory/nodepool-builder", Version: nodepoolImageVersion})
	MariabDBImage         = ImageToString(Image{Path: "quay.io/software-factory/mariadb", Version: "10.5.16-4"})
	ZookeeperImage        = ImageToString(Image{Path: "quay.io/software-factory/zookeeper", Version: "3.8.3-1"})
	// https://catalog.redhat.com/software/containers/ubi8/httpd-24/6065b844aee24f523c207943?q=httpd&architecture=amd64&image=651f274c8ce9242f7bb3e011
	HTTPDImage          = ImageToString(Image{Path: "registry.access.redhat.com/ubi8/httpd-24", Version: "1-284.1696531168"})
	NodeExporterImage   = ImageToString(Image{Path: "quay.io/prometheus/node-exporter", Version: "v1.6.1"})
	StatsdExporterImage = ImageToString(Image{Path: "quay.io/prometheus/statsd-exporter", Version: "v0.24.0"})
	FluentBitImage      = ImageToString(Image{Path: "cr.fluentbit.io/fluent/fluent-bit", Version: "2.1.10-debug"})
)
View Source
var DefaultPodSecurityContext = apiv1.PodSecurityContext{
	RunAsNonRoot: pointer.Bool(true),
	SeccompProfile: &apiv1.SeccompProfile{
		Type: "RuntimeDefault",
	},
}

DefaultPodSecurityContext is the PodSecurityContext used by sf-operator Pods

Functions

func ImageToString

func ImageToString(i Image) string

func IsDeploymentReady

func IsDeploymentReady(dep *appsv1.Deployment) bool

func IsDeploymentRolloutDone

func IsDeploymentRolloutDone(obj *appsv1.Deployment) bool

IsDeploymentRolloutDone returns True when the Deployment rollout is over

func IsStatefulSetRolloutDone

func IsStatefulSetRolloutDone(obj *appsv1.StatefulSet) bool

IsStatefulSetRolloutDone returns True when the StatefulSet rollout is over

func MkContainer

func MkContainer(name string, image string) apiv1.Container

MkContainer produces a Container with the default settings

func MkContainerPort

func MkContainerPort(port int, name string) apiv1.ContainerPort

MkContainerPort produces a TCP ContainerPort

func MkDeployment

func MkDeployment(name string, ns string, image string) appsv1.Deployment

MkDeployment produces a Deployment.

func MkEmptyDirVolume

func MkEmptyDirVolume(name string) apiv1.Volume

MkEmptyDirVolume produces a EmptyDir Volume

func MkEnvVar

func MkEnvVar(env string, value string) apiv1.EnvVar

MkEnvVar is small helper to produce an EnvVar

func MkEnvVarFromFieldRef

func MkEnvVarFromFieldRef(env string, fieldPath string) apiv1.EnvVar

func MkHTTPSRoute

func MkHTTPSRoute(
	name string, ns string, host string, serviceName string, path string,
	port int, annotations map[string]string, customTLS *apiroutev1.TLSConfig) apiroutev1.Route

MkHTTPSRoute produces a Route on top of a Service

func MkHeadlessService

func MkHeadlessService(name string, ns string, selector string, ports []int32, portName string) apiv1.Service

MkHeadlessService produces a headless service.

func MkHeadlessServicePod

func MkHeadlessServicePod(name string, ns string, podName string, ports []int32, portName string) apiv1.Service

MkHeadlessServicePod produces a headless service.

func MkJob

func MkJob(name string, ns string, container apiv1.Container) batchv1.Job

MkJob produces a Job

func MkLiveHTTPProbe

func MkLiveHTTPProbe(path string, port int) *apiv1.Probe

func MkLivenessCMDProbe

func MkLivenessCMDProbe(cmd []string) *apiv1.Probe

func MkPVC

func MkPVC(name string, ns string, storageParams StorageConfig, accessMode apiv1.PersistentVolumeAccessMode) apiv1.PersistentVolumeClaim

MkPVC produces PerssistentVolumeClaim

func MkReadinessCMDProbe

func MkReadinessCMDProbe(cmd []string) *apiv1.Probe

func MkReadinessHTTPProbe

func MkReadinessHTTPProbe(path string, port int) *apiv1.Probe

func MkReadinessTCPProbe

func MkReadinessTCPProbe(port int) *apiv1.Probe

func MkSSHKeySecret

func MkSSHKeySecret(name string, namespace string) apiv1.Secret

MkSSHKeySecret produces a Secret storing a SSH Key pair

func MkSecretEnvVar

func MkSecretEnvVar(env string, secret string, key string) apiv1.EnvVar

MkSecretEnvVar produces an EnvVar from a Secret's key. When the 'key' parameter is empty the key name is the Secret name

func MkSecretFromFunc

func MkSecretFromFunc(name string, namespace string, getData func() string) apiv1.Secret

MkSecretFromFunc produces a Secret where data is the result of getData

func MkSecurityContext

func MkSecurityContext(privileged bool) *apiv1.SecurityContext

MkSecurityContext produces a SecurityContext

func MkService

func MkService(name string, ns string, selector string, ports []int32, portName string) apiv1.Service

MkService produces a Service

func MkServicePod

func MkServicePod(name string, ns string, podName string, ports []int32, portName string) apiv1.Service

MkServicePod produces a Service that target a single Pod by name

func MkStartupCMDProbe

func MkStartupCMDProbe(cmd []string) *apiv1.Probe

func MkStartupHTTPProbe

func MkStartupHTTPProbe(path string, port int) *apiv1.Probe

func MkStatefulset

func MkStatefulset(
	name string, ns string, replicas int32, serviceName string,
	container apiv1.Container, pvc apiv1.PersistentVolumeClaim) appsv1.StatefulSet

MkStatefulset produces a StatefulSet.

func MkVolumeCM

func MkVolumeCM(volumeName string, configMapRef string) apiv1.Volume

MkVolumeCM produce a Volume from a ConfigMap

func MkVolumeSecret

func MkVolumeSecret(name string, secretName ...string) apiv1.Volume

MkVolumeSecret produces a Volume from a Secret source When the secretName var is not set then Secret name is the same as the Volume name

func ZuulImage

func ZuulImage(service string) string

Types

type Image

type Image struct {
	Path    string
	Version string
}

type StorageConfig

type StorageConfig struct {
	StorageClassName string
	Size             resource.Quantity
}

StorageConfig is used to define PVC Storage

Jump to

Keyboard shortcuts

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