controllers

package
v0.0.20 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2024 License: Apache-2.0 Imports: 56 Imported by: 0

Documentation

Overview

Package controllers provides controller functions

Index

Constants

View Source
const (
	LauncherIdent = nodepoolIdent + "-launcher"

	BuildLogsHttpdPortName       = "buildlogs-http"
	NodepoolProvidersSecretsName = "nodepool-providers-secrets"
	BuilderIdent                 = nodepoolIdent + "-builder"
)
View Source
const (
	BusyboxImage             = "quay.io/software-factory/sf-op-busybox:1.5-3"
	CustomSSLSecretName      = "sf-ssl-cert"
	CorporateCACerts         = "corporate-ca-certs"
	UpdateCATrustAnchorsPath = "/usr/share/pki/ca-trust-source/anchors/"
)
View Source
const GitServerIdent = "git-server"
View Source
const HTTPDImage = "registry.access.redhat.com/ubi8/httpd-24:1-284.1696531168"

HTTPDImage uses pinned/ubi8 based image for httpd https://catalog.redhat.com/software/containers/ubi8/httpd-24/6065b844aee24f523c207943?q=httpd&architecture=amd64&image=651f274c8ce9242f7bb3e011

View Source
const (
	MariaDBIdent = "mariadb"
)
View Source
const ZookeeperIdent = "zookeeper"
View Source
const (
	ZuulPrometheusPortName = "zuul-metrics"
)

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 BaseGetStorageConfOrDefault

func BaseGetStorageConfOrDefault(storageSpec sfv1.StorageSpec, storageClassName string) base.StorageConfig

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)

Types

type LogServerController

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

func (*LogServerController) DeployLogserver

func (r *LogServerController) DeployLogserver() sfv1.LogServerStatus

type LogServerReconciler

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

func (*LogServerReconciler) Reconcile

func (r *LogServerReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)

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 (*LogServerReconciler) SetupWithManager

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

SetupWithManager sets up the controller with the Manager.

type SFController

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

func (*SFController) AddDefaultConnections

func (r *SFController) AddDefaultConnections(cfg *ini.File)

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

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

func (*SFController) EnsureSFPodMonitor

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

func (*SFController) EnsureZuulComponents

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

func (*SFController) EnsureZuulComponentsFrontServices

func (r *SFController) EnsureZuulComponentsFrontServices()

func (*SFController) EnsureZuulConfigSecret

func (r *SFController) EnsureZuulConfigSecret(cfg *ini.File)

func (*SFController) EnsureZuulExecutor

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

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

func (r *SFController) InstallTooling()

func (*SFController) MkClientDNSNames

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

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)

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 caontaining 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) GetConfigMapByNameRef

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

GetConfigMapByNameRef Get ConfigMap by Name Reference

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

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

GetSecretDataFromKey Get Data from Secret Key

func (*SFUtilContext) GetSecretbyNameRef

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

GetSecretbyNameRef Get Secret by Name Reference

func (*SFUtilContext) IsDeploymentReady

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

func (*SFUtilContext) IsStatefulSetReady

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

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)

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