controllers

package
v0.0.41 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2024 License: Apache-2.0 Imports: 59 Imported by: 0

Documentation

Overview

Package controllers provides controller functions

Index

Constants

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 (
	CustomSSLSecretName      = "sf-ssl-cert"
	CorporateCACerts         = "corporate-ca-certs"
	UpdateCATrustAnchorsPath = "/usr/share/pki/ca-trust-source/anchors/"
	UpdateCATrustCommand     = "set -x && mkdir -p /etc/pki/ca-trust/extracted/{pem,java,edk2,openssl} && update-ca-trust"
)
View Source
const (
	ZuulPrometheusPortName   = "zuul-metrics"
	ZuulSchedulerIdent       = "zuul-scheduler"
	ZuulKeystorePasswordName = "zuul-keystore-password"
)
View Source
const GitServerIdent = "git-server"
View Source
const GitServerIdentRW = "git-server-rw"
View Source
const ZookeeperIdent = "zookeeper"

Variables

View Source
var NodepoolStatsdExporterPortName = monitoring.GetStatsdExporterPort(shortIdent)
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 BaseGetStorageConfOrDefault

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

BaseGetStorageConfOrDefault sets the default storageClassName

func DumpConfigINI

func DumpConfigINI(cfg *ini.File) string

func GetConfigContextOrDie

func GetConfigContextOrDie(contextName string) *rest.Config

func GetValueFromKeySecret

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

GetValueFromKeySecret gets the Value of the Keyname from a Secret

func LoadConfigINI

func LoadConfigINI(zuulConf string) *ini.File

func Main

func Main(ns string, metricsAddr string, probeAddr string, enableLeaderElection bool, oneShot bool)

func Standalone

func Standalone(sf sfv1.SoftwareFactory, ns string, kubeContext string) error

Types

type LogServerReconciler

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

type SFController

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

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) CreateProvisionDBJob

func (r *SFController) CreateProvisionDBJob(database string, password string) batchv1.Job

func (*SFController) DBPostInit

func (r *SFController) DBPostInit(configSecret apiv1.Secret) apiv1.Secret

func (*SFController) DebugService

func (r *SFController) DebugService(debugService string)

func (*SFController) DeployGitServer

func (r *SFController) DeployGitServer() bool

func (*SFController) DeployHTTPDGateway added in v0.0.28

func (r *SFController) DeployHTTPDGateway() 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() bool

func (*SFController) DeployZuulSecrets

func (r *SFController) DeployZuulSecrets()

func (*SFController) EnsureDiskUsagePromRule

func (r *SFController) EnsureDiskUsagePromRule(ruleGroups []monitoringv1.RuleGroup) bool

EnsureDiskUsagePromRule sync Prometheus Rules

func (*SFController) EnsureLogJuicer added in v0.0.39

func (r *SFController) EnsureLogJuicer() bool

func (*SFController) EnsureSFPodMonitor

func (r *SFController) EnsureSFPodMonitor(ports []string, selector metav1.LabelSelector) bool

EnsureSFPodMonitor Create or Updates Software Factory Monitor for metrics

func (*SFController) EnsureZuulComponents

func (r *SFController) EnsureZuulComponents() bool

func (*SFController) EnsureZuulComponentsFrontServices

func (r *SFController) EnsureZuulComponentsFrontServices()

func (*SFController) EnsureZuulConfigSecret

func (r *SFController) EnsureZuulConfigSecret(skipDBSettings bool, skipAuthSettings 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) 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

type SFUtilContext

type SFUtilContext struct {
	Client     client.Client
	Scheme     *runtime.Scheme
	RESTClient rest.Interface
	RESTConfig *rest.Config
	// contains filtered or unexported fields
}

func (*SFUtilContext) CorporateCAConfigMapExists

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

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

func (*SFUtilContext) CreateR

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

CreateR creates a resource with the owner as the ownerReferences.

func (*SFUtilContext) DebugStatefulSet

func (r *SFUtilContext) DebugStatefulSet(name string)

DebugStatefulSet disables StatefulSet main container probes

func (*SFUtilContext) DeleteR

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

DeleteR delete a resource.

func (*SFUtilContext) EnsureConfigMap

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

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

func (*SFUtilContext) EnsureLocalCA

func (r *SFUtilContext) EnsureLocalCA()

EnsureLocalCA ensures cert-manager resources exists to enable of local CA Issuer This function does not support update

func (*SFUtilContext) EnsureSSHKeySecret

func (r *SFUtilContext) 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 (*SFUtilContext) EnsureSecret

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

EnsureSecret ensures a Secret exist The Secret is updated if needed

func (*SFUtilContext) EnsureSecretUUID

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

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

func (*SFUtilContext) EnsureService

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

EnsureService ensures a Service exists The Service is updated if needed

func (*SFUtilContext) GetConfigMap added in v0.0.21

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

GetConfigMap Get ConfigMap by name

func (*SFUtilContext) GetM

func (r *SFUtilContext) GetM(name string, obj client.Object) bool

GetM gets a resource, returning if it was found

func (*SFUtilContext) GetOrCreate

func (r *SFUtilContext) 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 (*SFUtilContext) GetSecret added in v0.0.21

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

GetSecret Get Secret by name

func (*SFUtilContext) GetSecretDataFromKey

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

GetSecretDataFromKey Get Data from Secret Key

func (*SFUtilContext) IsDeploymentReady

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

IsDeploymentReady checks if StatefulSet is ready

func (*SFUtilContext) IsStatefulSetReady

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

IsStatefulSetReady checks if StatefulSet is ready

func (*SFUtilContext) PatchR

func (r *SFUtilContext) PatchR(obj client.Object, patch client.Patch)

PatchR delete a resource.

func (*SFUtilContext) PodExec

func (r *SFUtilContext) 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 The function returns an Error for any issue

func (*SFUtilContext) UpdateR

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

UpdateR updates resource with the owner as the ownerReferences.

type SoftwareFactoryReconciler

type SoftwareFactoryReconciler struct {
	client.Client
	Scheme     *runtime.Scheme
	RESTClient rest.Interface
	RESTConfig *rest.Config
	CancelFunc context.CancelFunc
	Completed  bool
}

func (*SoftwareFactoryReconciler) Reconcile

Reconcile is part of the main kubernetes reconciliation loop which aims to move the current state of the cluster closer to the desired state.

For more details, check Reconcile and its Result here: - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.11.2/pkg/reconcile

func (*SoftwareFactoryReconciler) SetupWithManager

func (r *SoftwareFactoryReconciler) SetupWithManager(mgr ctrl.Manager) error

SetupWithManager sets up the controller with the Manager.

func (*SoftwareFactoryReconciler) StandaloneReconcile

func (r *SoftwareFactoryReconciler) StandaloneReconcile(ctx context.Context, ns string, sf sfv1.SoftwareFactory) error

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 cert-manager for the sf-operator
Package cert provides various utility functions regarding handling cert-manager for the sf-operator
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