controllers

package
v0.0.65 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2026 License: Apache-2.0 Imports: 54 Imported by: 0

Documentation

Overview

Package controllers provides controller functions

Index

Constants

View Source
const (
	DBBackupPath      = "mariadb/db-zuul.sql"
	ZuulBackupPath    = "zuul/zuul.keys"
	SecretsBackupPath = "secrets/"
)
View Source
const (
	MariaDBIdent = "mariadb"

	MariadbAdminPass = "mariadb-root-password"
)
View Source
const (
	LauncherIdent = nodepoolIdent + "-launcher"

	BuildLogsHttpdPortName       = "buildlogs-http"
	NodepoolProvidersSecretsName = "nodepool-providers-secrets"
	BuilderIdent                 = nodepoolIdent + "-builder"
)
View Source
const (
	CorporateCACerts            = "corporate-ca-certs"
	UpdateCATrustAnchorsPath    = "/usr/share/pki/ca-trust-source/anchors/"
	TrustedCAExtractedMountPath = "/etc/pki/ca-trust/extracted"
	UpdateCATrustCommand        = "set -x && update-ca-trust extract -o " + TrustedCAExtractedMountPath
)
View Source
const (
	ZuulPrometheusPortName   = "zuul-metrics"
	ZuulKeystorePasswordName = "zuul-keystore-password"
)
View Source
const GitServerIdent = "git-server"
View Source
const GitServerIdentRW = "git-server-rw"
View Source
const ZookeeperIdent = "zookeeper"
View Source
const ZookeeperReplicas = 1

Variables

View Source
var NodepoolStatsdExporterPortName = monitoring.GetStatsdExporterPort(shortIdent)
View Source
var SecretsToBackup = []string{
	"zookeeper-client-tls",
	"zookeeper-server-tls",
	"nodepool-builder-ssh-key",
	"zuul-ssh-key",
	"zuul-keystore-password",
	"zuul-auth-secret",
	"logserver-keys",
}
View Source
var SetupLog = setupLog
View Source
var (
	ZuulStatsdExporterPortName = monitoring.GetStatsdExporterPort("zuul")
)

Functions

func AddGitConnection

func AddGitConnection(cfg *ini.File, name string, baseurl string, poolDelay int32)

func AddWebClientSection

func AddWebClientSection(cfg *ini.File)

func AppendCorporateCACertsVolumeMount added in v0.0.21

func AppendCorporateCACertsVolumeMount(volumeMounts []apiv1.VolumeMount, volumeName string) []apiv1.VolumeMount

func AppendToolingVolume added in v0.0.51

func AppendToolingVolume(volumeMounts []apiv1.Volume) []apiv1.Volume

func BaseGetStorageConfOrDefault

func BaseGetStorageConfOrDefault(storageSpec sfv1.StorageSpec, storageDefault sfv1.StorageDefaultSpec) base.StorageConfig

BaseGetStorageConfOrDefault sets the default storageClassName

func CRSecrets added in v0.0.65

func CRSecrets(cr sfv1.SoftwareFactory) []string

CRSecrets returns the list of secret name used by the CR.

func DumpConfigINI

func DumpConfigINI(cfg *ini.File) string

func GetUserDefinedConnections added in v0.0.58

func GetUserDefinedConnections(zuul *sfv1.ZuulSpec) ([]string, error)

func GetValueFromKeySecret

func GetValueFromKeySecret(secret apiv1.Secret, keyname string) ([]byte, error)

GetValueFromKeySecret gets the Value of the Keyname from a Secret

func HasDuplicate added in v0.0.58

func HasDuplicate(conns []string) string

func LoadConfigINI

func LoadConfigINI(zuulConf string) *ini.File

func MkHoundSearchContainer added in v0.0.51

func MkHoundSearchContainer(corporateCMExists bool, openshiftUser bool) apiv1.Container

func MkZuulCapacityContainer added in v0.0.46

func MkZuulCapacityContainer(
	openshiftUser bool,
	corporateCMExists bool,
) apiv1.Container

func ReadSFYAML added in v0.0.63

func ReadSFYAML(fp string) (sfv1.SoftwareFactory, error)

func RotateSecrets added in v0.0.65

func RotateSecrets(cliNS string, kubeContext string, dryRun bool, crPath string) error

func RunPodCmdRaw added in v0.0.58

func RunPodCmdRaw(restConfig *rest.Config, kubeClientset *kubernetes.Clientset, namespace string, podName string, containerName string, cmdArgs []string) (*bytes.Buffer, error)

func Standalone

func Standalone(cliNS string, kubeContext string, dryRun bool, crPath string, remotePath string) error

func WaitFor added in v0.0.65

func WaitFor(ensureFun func() bool) bool

Types

type HostAlias added in v0.0.53

type HostAlias struct {
	IP        string   `json:"ip" mapstructure:"ip"`
	Hostnames []string `json:"hostnames" mapstructure:"hostnames"`
}

type LogServerReconciler

type LogServerReconciler struct {
	Client     client.Client
	Scheme     *runtime.Scheme
	RESTClient rest.Interface
	RESTConfig *rest.Config
}

type SFController

type SFController struct {
	SFKubeContext
	// contains filtered or unexported fields
}

func MkSFController added in v0.0.63

func MkSFController(r SFKubeContext, cr sfv1.SoftwareFactory) SFController

func (*SFController) AddCorporateCA added in v0.0.42

func (r *SFController) AddCorporateCA(spec *apiv1.PodSpec) string

func (*SFController) AddDefaultConnections

func (r *SFController) AddDefaultConnections(cfg *ini.File, gitServerURL string)

func (*SFController) AddElasticSearchConnection

func (r *SFController) AddElasticSearchConnection(cfg *ini.File, conn sfv1.ElasticSearchConnection)

func (*SFController) AddGerritConnection

func (r *SFController) AddGerritConnection(cfg *ini.File, conn sfv1.GerritConnection)

func (*SFController) AddGitHubConnection

func (r *SFController) AddGitHubConnection(cfg *ini.File, conn sfv1.GitHubConnection)

func (*SFController) AddGitLabConnection

func (r *SFController) AddGitLabConnection(cfg *ini.File, conn sfv1.GitLabConnection)

func (*SFController) AddOIDCAuthenticator

func (r *SFController) AddOIDCAuthenticator(cfg *ini.File, authenticator sfv1.ZuulOIDCAuthenticatorSpec)

func (*SFController) AddPagureConnection

func (r *SFController) AddPagureConnection(cfg *ini.File, conn sfv1.PagureConnection)

func (*SFController) AddSMTPConnection added in v0.0.37

func (r *SFController) AddSMTPConnection(cfg *ini.File, conn sfv1.SMTPConnection)

func (*SFController) CreateDBInitContainer

func (r *SFController) CreateDBInitContainer(username string, password string, dbname string) apiv1.Container

func (*SFController) DebugService

func (r *SFController) DebugService(debugService string)

func (*SFController) DeleteSecret added in v0.0.65

func (r *SFController) DeleteSecret(name string)

func (*SFController) DeployGitServer

func (r *SFController) DeployGitServer() bool

func (*SFController) DeployHTTPDGateway added in v0.0.28

func (r *SFController) DeployHTTPDGateway() bool

func (*SFController) DeployHoundSearch added in v0.0.51

func (r *SFController) DeployHoundSearch() bool

func (*SFController) DeployLogserver added in v0.0.28

func (r *SFController) DeployLogserver() bool

func (*SFController) DeployMariadb

func (r *SFController) DeployMariadb() bool

func (*SFController) DeployNodepool

func (r *SFController) DeployNodepool() map[string]bool

func (*SFController) DeployNodepoolBuilder

func (r *SFController) DeployNodepoolBuilder(statsdExporterVolume apiv1.Volume, nodepoolStatsdMappingConfig string,
	initialVolumeMounts []apiv1.VolumeMount, providersSecrets apiv1.Secret, providerSecretsExists bool) bool

func (*SFController) DeployNodepoolLauncher

func (r *SFController) DeployNodepoolLauncher(statsdExporterVolume apiv1.Volume, nodepoolStatsdMappingConfig string,
	initialVolumeMounts []apiv1.VolumeMount, providersSecrets apiv1.Secret, providerSecretsExists bool) bool

func (*SFController) DeployZookeeper

func (r *SFController) DeployZookeeper() bool

func (*SFController) DeployZuul

func (r *SFController) DeployZuul() map[string]bool

func (*SFController) DeployZuulSecrets

func (r *SFController) DeployZuulSecrets()

func (*SFController) EnsureLogJuicer added in v0.0.39

func (r *SFController) EnsureLogJuicer() bool

func (*SFController) EnsureProvisionDBJob added in v0.0.64

func (r *SFController) EnsureProvisionDBJob(database string, password string) bool

func (*SFController) EnsureToolingVolume added in v0.0.51

func (r *SFController) EnsureToolingVolume()

func (*SFController) EnsureZookeeperCertificates added in v0.0.61

func (r *SFController) EnsureZookeeperCertificates(ZookeeperIdent string, ZookeeperReplicas int)

EnsureZookeeperCertificates ensures the following TLS secrets for zookeeper/zuul/nodepool connections: - self-signed root certificate authority - client certificate for zookeeper, localhost (so we can use zkClient locally from the pod) - server certificates for each zookeeper replica

func (*SFController) EnsureZuulComponents

func (r *SFController) EnsureZuulComponents() map[string]bool

func (*SFController) EnsureZuulComponentsFrontServices

func (r *SFController) EnsureZuulComponentsFrontServices()

func (*SFController) EnsureZuulConfigSecret

func (r *SFController) EnsureZuulConfigSecret(remoteExecutor bool) *ini.File

EnsureZuulConfigSecret build and install the zuul.conf Secret resource If the resource cannot be built then the returned value is nil

func (*SFController) EnsureZuulExecutor

func (r *SFController) EnsureZuulExecutor(cfg *ini.File) bool

func (*SFController) EnsureZuulExecutorService added in v0.0.27

func (r *SFController) EnsureZuulExecutorService()

func (*SFController) EnsureZuulMerger

func (r *SFController) EnsureZuulMerger(cfg *ini.File) bool

func (*SFController) EnsureZuulScheduler

func (r *SFController) EnsureZuulScheduler(cfg *ini.File) bool

func (*SFController) EnsureZuulWeb

func (r *SFController) EnsureZuulWeb(cfg *ini.File) bool

func (*SFController) EnsureZuulWeeder added in v0.0.39

func (r *SFController) EnsureZuulWeeder(checksum string) bool

func (*SFController) InstallTooling

func (r *SFController) InstallTooling()

func (*SFController) IsCodesearchEnabled added in v0.0.51

func (r *SFController) IsCodesearchEnabled() bool

func (*SFController) IsExecutorEnabled added in v0.0.25

func (r *SFController) IsExecutorEnabled() bool

func (*SFController) IsExternalExecutorEnabled added in v0.0.27

func (r *SFController) IsExternalExecutorEnabled() bool

func (*SFController) MkClientDNSNames

func (r *SFController) MkClientDNSNames(serviceName string) []string

MkClientDNSNames returns an array of DNS Names

func (*SFController) MkPreInitScript

func (r *SFController) MkPreInitScript() string

func (*SFController) RunCommand

func (r *SFController) RunCommand(name string, args []string, extraVars []apiv1.EnvVar) *batchv1.Job

func (*SFController) SetupBaseSecrets

func (r *SFController) SetupBaseSecrets(internalTenantSecretsVersion string) bool

SetupBaseSecrets returns true when the Job that set the zuul secret in the system-config repository is done

func (*SFController) SetupConfigJob

func (r *SFController) SetupConfigJob() bool

func (*SFController) Step

func (*SFController) TerminateHoundSearch added in v0.0.51

func (r *SFController) TerminateHoundSearch()

type SFKubeContext added in v0.0.65

type SFKubeContext struct {
	kclient.KubeClient
	// contains filtered or unexported fields
}

func MkSFKubeContext added in v0.0.65

func MkSFKubeContext(kubeconfig string, namespace string, kubecontext string, dryRun bool) (SFKubeContext, error)

func (*SFKubeContext) CleanPVCs added in v0.0.65

func (r *SFKubeContext) CleanPVCs()

func (*SFKubeContext) CleanSFInstance added in v0.0.65

func (r *SFKubeContext) CleanSFInstance()

func (*SFKubeContext) CorporateCAConfigMapExists added in v0.0.65

func (r *SFKubeContext) CorporateCAConfigMapExists() (apiv1.ConfigMap, bool)

CorporateCAConfigMapExists check if the ConfigMap named "corporate-ca-certs" exists

func (*SFKubeContext) CreateR added in v0.0.65

func (r *SFKubeContext) CreateR(obj client.Object)

CreateR creates a resource with the owner as the ownerReferences.

func (*SFKubeContext) CreateROrDie added in v0.0.65

func (r *SFKubeContext) CreateROrDie(obj client.Object)

func (*SFKubeContext) DebugStatefulSet added in v0.0.65

func (r *SFKubeContext) DebugStatefulSet(name string)

DebugStatefulSet disables StatefulSet main container probes

func (*SFKubeContext) DeleteAllOfOrDie added in v0.0.65

func (r *SFKubeContext) DeleteAllOfOrDie(obj client.Object, opts ...client.DeleteAllOfOption)

func (*SFKubeContext) DeleteKazooPod added in v0.0.65

func (r *SFKubeContext) DeleteKazooPod()

func (*SFKubeContext) DeleteOrDie added in v0.0.65

func (r *SFKubeContext) DeleteOrDie(obj client.Object, opts ...client.DeleteOption) bool

func (*SFKubeContext) DeleteR added in v0.0.65

func (r *SFKubeContext) DeleteR(obj client.Object)

DeleteR delete a resource.

func (*SFKubeContext) DoBackup added in v0.0.65

func (r *SFKubeContext) DoBackup(backupDir string, cr sfv1.SoftwareFactory) error

func (*SFKubeContext) DoRestore added in v0.0.65

func (r *SFKubeContext) DoRestore(backupDir string, cr sfv1.SoftwareFactory) error

func (*SFKubeContext) DoRotateSecrets added in v0.0.65

func (r *SFKubeContext) DoRotateSecrets() error

func (*SFKubeContext) EnsureConfigMap added in v0.0.65

func (r *SFKubeContext) EnsureConfigMap(baseName string, data map[string]string) apiv1.ConfigMap

EnsureConfigMap ensures a config map exist The ConfigMap is updated if needed

func (*SFKubeContext) EnsureKazooPod added in v0.0.65

func (r *SFKubeContext) EnsureKazooPod() bool

EnsureKazooPod setups a kazoo client pod that can be used to access ZooKeeper directly

func (*SFKubeContext) EnsureNamespaceOrDie added in v0.0.65

func (r *SFKubeContext) EnsureNamespaceOrDie(name string)

func (*SFKubeContext) EnsureSSHKeySecret added in v0.0.65

func (r *SFKubeContext) EnsureSSHKeySecret(name string)

EnsureSSHKeySecret ensures a Secret exists container an autogenerated SSH key pair If it does not exixtthe Secret is created This function does not support Secret update

func (*SFKubeContext) EnsureSecret added in v0.0.65

func (r *SFKubeContext) EnsureSecret(secret *apiv1.Secret)

EnsureSecret ensures a Secret exist The Secret is updated if needed

func (*SFKubeContext) EnsureSecretUUID added in v0.0.65

func (r *SFKubeContext) EnsureSecretUUID(name string) apiv1.Secret

EnsureSecretUUID ensures a Secret containing an UUID This function does not support update

func (*SFKubeContext) EnsureService added in v0.0.65

func (r *SFKubeContext) EnsureService(service *apiv1.Service)

EnsureService ensures a Service exists The Service is updated if needed

func (*SFKubeContext) EnsureServiceAccountOrDie added in v0.0.65

func (r *SFKubeContext) EnsureServiceAccountOrDie(name string)

func (*SFKubeContext) EnsureStandaloneOwner added in v0.0.65

func (r *SFKubeContext) EnsureStandaloneOwner(spec sfv1.SoftwareFactorySpec)

func (*SFKubeContext) GetConfigMap added in v0.0.65

func (r *SFKubeContext) GetConfigMap(name string) (apiv1.ConfigMap, error)

GetConfigMap Get ConfigMap by name

func (*SFKubeContext) GetOrCreate added in v0.0.65

func (r *SFKubeContext) GetOrCreate(obj client.Object) bool

GetOrCreate does not change an existing object, update needs to be used manually. In the case the object already exists then the function return True

func (*SFKubeContext) GetSecret added in v0.0.65

func (r *SFKubeContext) GetSecret(name string) (apiv1.Secret, error)

GetSecret Get Secret by name

func (*SFKubeContext) GetSecretDataFromKey added in v0.0.65

func (r *SFKubeContext) GetSecretDataFromKey(name string, key string) ([]byte, error)

GetSecretDataFromKey Get Data from Secret Key

func (*SFKubeContext) GetStandaloneOwner added in v0.0.65

func (r *SFKubeContext) GetStandaloneOwner() bool

func (*SFKubeContext) IsDeploymentReady added in v0.0.65

func (r *SFKubeContext) IsDeploymentReady(dep *appsv1.Deployment) bool

IsDeploymentReady checks if Deployment is ready

func (*SFKubeContext) IsStatefulSetReady added in v0.0.65

func (r *SFKubeContext) IsStatefulSetReady(dep *appsv1.StatefulSet) bool

IsStatefulSetReady checks if StatefulSet is ready

func (*SFKubeContext) PodExec added in v0.0.65

func (r *SFKubeContext) PodExec(pod string, container string, command []string) error

PodExec connects to a container's Pod and execute a command Stdout and Stderr is output on the caller's Stdout

func (*SFKubeContext) PodExecBytes added in v0.0.65

func (r *SFKubeContext) PodExecBytes(pod string, container string, command []string) (bytes.Buffer, error)

func (*SFKubeContext) PodExecIn added in v0.0.65

func (r *SFKubeContext) PodExecIn(pod string, container string, command []string, in io.Reader) error

PodExecIn connects to a container's Pod and execute a command Stderr is output on the caller's Stdout The function returns an Error for any issue

func (*SFKubeContext) PodExecM added in v0.0.65

func (r *SFKubeContext) PodExecM(pod string, container string, command []string)

func (*SFKubeContext) PodExecOut added in v0.0.65

func (r *SFKubeContext) PodExecOut(pod string, container string, command []string, out io.Writer) error

PodExecOut connects to a container's Pod and execute a command Stderr is output on the caller's Stdout The function returns an Error for any issue

func (*SFKubeContext) ReadSecret added in v0.0.65

func (r *SFKubeContext) ReadSecret(name string) map[string][]byte

func (*SFKubeContext) ReadSecretValue added in v0.0.65

func (r *SFKubeContext) ReadSecretValue(name string, key string) string

func (*SFKubeContext) RunPodCmd added in v0.0.65

func (r *SFKubeContext) RunPodCmd(podName string, containerName string, cmdArgs []string) (*bytes.Buffer, error)

func (*SFKubeContext) ScaleDownSTSAndWait added in v0.0.65

func (r *SFKubeContext) ScaleDownSTSAndWait(name string) error

func (*SFKubeContext) StandaloneReconcile added in v0.0.65

func (r *SFKubeContext) StandaloneReconcile(sf sfv1.SoftwareFactory) error

func (*SFKubeContext) UpdateR added in v0.0.65

func (r *SFKubeContext) UpdateR(obj client.Object) bool

UpdateR updates resource with the owner as the ownerReferences.

func (*SFKubeContext) UpdateROrDie added in v0.0.65

func (r *SFKubeContext) UpdateROrDie(obj client.Object)

type ZuulDBOpts

type ZuulDBOpts struct {
	Username string
	Password string
	Host     string
	Port     int32
	Database string
	Params   map[string]string
}

Directories

Path Synopsis
libs
base
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
cert
Package cert provides various utility functions regarding handling the local CA for the sf-operator
Package cert provides various utility functions regarding handling the local CA for the sf-operator
client
Package client wraps the low-level kubernetes client.
Package client wraps the low-level kubernetes client.
conds
Package conds provides various utility functions regarding Status.Conditions for the sf-operator
Package conds provides various utility functions regarding Status.Conditions for the sf-operator
logging
Package logging provides various utility functions regarding optional service log collection for the sf-operator:
Package logging provides various utility functions regarding optional service log collection for the sf-operator:
monitoring
Package monitoring provides various utility functions regarding monitoring for the sf-operator:
Package monitoring provides various utility functions regarding monitoring for the sf-operator:
utils
Package utils provides various utility functions
Package utils provides various utility functions
zuulcf
Package zuulcf contains a library to build Zuul configurations.
Package zuulcf contains a library to build Zuul configurations.

Jump to

Keyboard shortcuts

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