Documentation
¶
Index ¶
- Constants
- func AddHashLabel(r FunctionResources, deployment *appsv1.Deployment)
- func CalculateHash(obj any) string
- func CheckDeploymentSpec(fields ...interface{}) bool
- func ContainerExec[T any](ctx context.Context, client T, pod *corev1.Pod, command []string, ...) (string, error)
- func CustomZapLogger() *zap.Logger
- func DeployAptSign(secret corev1.Secret) bool
- func DeployCollectionSign(secret corev1.Secret) bool
- func DeployContainerSign(secret corev1.Secret) bool
- func DeployRpmSign(secret corev1.Secret) bool
- func GetAPIRoot(ctx context.Context, r client.Client, pulp *pulpv1.Pulp) string
- func GetAdminSecretName(pulp pulpv1.Pulp) string
- func GetContentPathPrefix(ctx context.Context, r client.Client, pulp *pulpv1.Pulp) string
- func GetCurrentHash(obj client.Object) string
- func GetDBFieldsEncryptionSecret(pulp pulpv1.Pulp) string
- func GetPostgresEnvVars(pulp pulpv1.Pulp) (envVars []corev1.EnvVar)
- func GetSigningKeyFingerprint(ctx context.Context, r client.Client, secretName, secretNamespace string) (string, error)
- func GetStorageType(pulp pulpv1.Pulp) []string
- func HashFromMutated(dep *appsv1.Deployment, resources FunctionResources) string
- func IgnoreUpdateCRStatusPredicate() predicate.Predicate
- func ImageChanged(pulp *pulpv1.Pulp) bool
- func IngressDefaults(resources any, plugins []IngressPlugin) (*netv1.Ingress, error)
- func Ipv6Disabled(pulp pulpv1.Pulp) bool
- func IsNginxIngressSupported(pulp *pulpv1.Pulp) bool
- func IsOpenShift() (bool, error)
- func MigrationSettingsList() map[string]string
- func MultiStorageConfigured(pulp *pulpv1.Pulp, resource string) (bool, []string)
- func OtelConfigMap(resources FunctionResources) client.Object
- func ReconcileMetadata(funcResources FunctionResources, expectedState, currentState client.Object, ...) (bool, error)
- func ReconcileObject(funcResources FunctionResources, expectedState, currentState client.Object, ...) (bool, error)
- func RemovePulpWebResources(resources FunctionResources) error
- func RemoveTelemetryResources(resources FunctionResources)
- func RetrieveSecretData(ctx context.Context, secretName, secretNamespace string, required bool, ...) (map[string]string, error)
- func ServiceOtel(resources FunctionResources) client.Object
- func SetCustomEnvVars(pulp pulpv1.Pulp, component string) []corev1.EnvVar
- func SetDefaultSecurityContext() *corev1.SecurityContext
- func SetHashLabel(label string, obj client.Object)
- func SetPulpcoreCustomEnvVars(pulp pulpv1.Pulp, pulpcoreType settings.PulpcoreType) []corev1.EnvVar
- func SettingNeedsMigrationChanged(pulp *pulpv1.Pulp) []string
- func StorageTypeChanged(pulp *pulpv1.Pulp) bool
- func UpdateCRField(ctx context.Context, r client.Client, pulp *pulpv1.Pulp, ...) error
- func UpdateStatus(ctx context.Context, r client.Client, pulp *pulpv1.Pulp, ...)
- type CommonDeployment
- type DeploymentAPICommon
- type DeploymentContentCommon
- type DeploymentWorkerCommon
- type FunctionResources
- type IngressPlugin
- type PulpConfigMap
- type PulpDeployment
- type PulpIngress
- type PulpObject
- type PulpObjectMetadata
- type PulpRoute
- type PulpSecret
- type PulpService
Constants ¶
const ( AzureObjType = "azure blob" GCSObjType = "gcs" S3ObjType = "s3" SCNameType = "StorageClass" PVCType = "PVC" EmptyDirType = "emptyDir" PulpResource = "Pulp" CacheResource = "Cache" DatabaseResource = "Database" DotNotEditMessage = `` /* 197-byte string literal not displayed */ DefaultOCPIngressClass = "openshift-default" OperatorHashLabel = "pulp-operator-hash" )
Variables ¶
This section is empty.
Functions ¶
func AddHashLabel ¶
func AddHashLabel(r FunctionResources, deployment *appsv1.Deployment)
AddHashLabel creates a label with the calculated hash from the mutated deployment
func CalculateHash ¶
CalculateHash returns a string of the hashed value from obj
func CheckDeploymentSpec ¶
func CheckDeploymentSpec(fields ...interface{}) bool
CheckDeployment returns true if a spec from deployment is not with the expected contents defined in Pulp CR
func ContainerExec ¶
func ContainerExec[T any](ctx context.Context, client T, pod *corev1.Pod, command []string, container, namespace string) (string, error)
ContainerExec runs a command in the container
func CustomZapLogger ¶
CustomZapLogger should be used only for warn messages it is a kludge to bypass the "limitation" of logr not having warn level
func DeployAptSign ¶
DeployAptSign returns true if signingScript secret is defined with an apt script
func DeployCollectionSign ¶
DeployCollectionSign returns true if signingScript secret is defined with a collection script
func DeployContainerSign ¶
DeployContainerSign returns true if signingScript secret is defined with a container script
func DeployRpmSign ¶
DeployRpmSign returns true if signingScript secret is defined with an rpm script
func GetAPIRoot ¶
GetAPIRoot returns the definition of API_ROOT in settings.py or /pulp/
func GetAdminSecretName ¶
GetAdminSecretName retrieves pulp admin user password
func GetContentPathPrefix ¶
GetContentPathPrefix returns the definition of CONTENT_PATH_PREFIX in settings.py or * /pulp/content/default/ if domain is enabled * /pulp/content/ otherwise
func GetCurrentHash ¶
getCurrentHash retrieves the hash defined in obj label
func GetDBFieldsEncryptionSecret ¶
GetDBFieldsEncryptionSecret returns the name of DBFieldsEncryption Secret
func GetPostgresEnvVars ¶
GetPostgresEnvVars return the list of postgres environment variables to use in containers
func GetSigningKeyFingerprint ¶
func GetSigningKeyFingerprint(ctx context.Context, r client.Client, secretName, secretNamespace string) (string, error)
getSigningKeyFingerprint returns the signing key fingerprint from secret object
func GetStorageType ¶
GetStorageType retrieves the storage type defined in pulp CR
func HashFromMutated ¶
func HashFromMutated(dep *appsv1.Deployment, resources FunctionResources) string
func IgnoreUpdateCRStatusPredicate ¶
IgnoreUpdateCRStatusPredicate filters update events on pulpbackup CR status
func ImageChanged ¶
CheckImageVersionModified verifies if the container image tag defined in Pulp CR matches the one in the Deployment
func IngressDefaults ¶
func IngressDefaults(resources any, plugins []IngressPlugin) (*netv1.Ingress, error)
IngressDefaults returns an k8s Ingress resource with default values
func Ipv6Disabled ¶
func IsNginxIngressSupported ¶
IsNginxIngressSupported returns true if the operator was instructed that this is a nginx ingress controller
func IsOpenShift ¶
IsOpenShift returns true if the platform cluster is OpenShift
func MigrationSettingsList ¶
MigrationSettingsList returns a map[string]string of configurations that should trigger a migration job note: in the current implementation, all fields should be boolean. Trying to add a non-bool field to the list will fail SettingNeedsMigrationChanged execution.
func MultiStorageConfigured ¶
MultiStorageConfigured returns true if Pulp CR is configured with more than one "storage type" for example, if ObjectStorageAzureSecret and FileStorageClass are defined we can't determine which one the operator should use.
func OtelConfigMap ¶
func OtelConfigMap(resources FunctionResources) client.Object
otelConfigMap defines a configmap resource to keep otel-collector-config.yaml configuration file
func ReconcileMetadata ¶
func ReconcileMetadata(funcResources FunctionResources, expectedState, currentState client.Object, conditionType string) (bool, error)
ReconcileMetadata is a method to handle only .metadata.{labels,annotations} reconciliation for some reason, if we try to use DeepDerivative like
if !equality.Semantic.DeepDerivative(expectedState.(*routev1.Route), currentState.(*routev1.Route)) ...
it will get into an infinite loop
func ReconcileObject ¶
func ReconcileObject(funcResources FunctionResources, expectedState, currentState client.Object, conditionType string, pulpObject PulpObject) (bool, error)
ReconcileObject will check if the definition from Pulp CR is reflecting the current object state and if not will synchronize the configuration func ReconcileObject(funcResources FunctionResources, expectedState, currentState client.Object, conditionType string, pulpObject PulpObject) (bool, error) {
func RemovePulpWebResources ¶
func RemovePulpWebResources(resources FunctionResources) error
RemovePulpWebResources deletes pulp-web Deployment and Service
func RemoveTelemetryResources ¶
func RemoveTelemetryResources(resources FunctionResources)
RemoveTelemetryResources cleans up telemetry resources if telemetry.enabled == false
func RetrieveSecretData ¶
func RetrieveSecretData(ctx context.Context, secretName, secretNamespace string, required bool, r client.Client, keys ...string) (map[string]string, error)
Retrieve specific keys from secret object
func ServiceOtel ¶
func ServiceOtel(resources FunctionResources) client.Object
serviceOtel defines a service to expose otel metrics
func SetCustomEnvVars ¶
setCustomEnvVars returns the list of custom environment variables defined in Pulp CR
func SetDefaultSecurityContext ¶
func SetDefaultSecurityContext() *corev1.SecurityContext
SetDefaultSecurityContext defines the container security configuration to be in compliance with PodSecurity "restricted:v1.24"
func SetHashLabel ¶
SetHashLabel appends the operator's hash label into object
func SetPulpcoreCustomEnvVars ¶
setPulpcoreCustomEnvVars returns the list of custom environment variables defined in Pulp CR
func SettingNeedsMigrationChanged ¶
SettingNeedsMigrationChanged verifies if a Pulp setting that needs migration has been modified returns a list with the settings modified
func StorageTypeChanged ¶
StorageTypeChanged verifies if the storage type has been modified
func UpdateCRField ¶
func UpdateCRField(ctx context.Context, r client.Client, pulp *pulpv1.Pulp, fieldName, fieldValue string) error
UpdatCRField patches fieldName in Pulp CR with fieldValue
func UpdateStatus ¶
func UpdateStatus(ctx context.Context, r client.Client, pulp *pulpv1.Pulp, conditionStatus metav1.ConditionStatus, conditionType, conditionReason, conditionMessage string)
UpdateStatus will set the new condition value for a .status.conditions[] it will also set Pulp-Operator-Finished-Execution to false
Types ¶
type CommonDeployment ¶
type CommonDeployment struct {
// contains filtered or unexported fields
}
CommonDeployment has the common definition for all pulpcore deployments
func (CommonDeployment) Deploy ¶
func (d CommonDeployment) Deploy(resources any, pulpcoreType settings.PulpcoreType) client.Object
Deploy returns a common Deployment object that can be used by any pulpcore component
type DeploymentAPICommon ¶
type DeploymentAPICommon struct {
CommonDeployment
}
DeploymentAPICommon is the common pulpcore-api Deployment definition
type DeploymentContentCommon ¶
type DeploymentContentCommon struct {
CommonDeployment
}
DeploymentContentCommon is the common pulpcore-content Deployment definition
type DeploymentWorkerCommon ¶
type DeploymentWorkerCommon struct {
CommonDeployment
}
DeploymentWorkerCommon is the common pulpcore-worker Deployment definition
type FunctionResources ¶
type FunctionResources struct { context.Context client.Client *pulpv1.Pulp Scheme *runtime.Scheme logr.Logger }
FunctionResources contains the list of arguments passed to create new Pulp resources
type IngressPlugin ¶
type IngressPlugin struct { Name string `json:"name"` Path string `json:"path"` ServiceName string `json:"serviceName"` TargetPort string `json:"targetPort"` Rewrite string `json:"rewrite"` }
IngressPlugin defines a plugin ingress.
type PulpConfigMap ¶
type PulpConfigMap struct{}
func (PulpConfigMap) GetFieldAndKind ¶
func (PulpConfigMap) GetFieldAndKind() (string, string)
GetFieldAndKind returns the field being checked and the object kind
func (PulpConfigMap) GetFields ¶
func (PulpConfigMap) GetFields(obj ...interface{}) []interface{}
GetFields expects 2 arguments: * the current ConfigMap data * the expected ConfigMap data
func (PulpConfigMap) GetModifiedFunc ¶
func (PulpConfigMap) GetModifiedFunc() func(...interface{}) bool
GetModifiedFunc returns the function used to check the COnfigMap modification
type PulpDeployment ¶
type PulpDeployment struct{}
func (PulpDeployment) GetFieldAndKind ¶
func (PulpDeployment) GetFieldAndKind() (string, string)
GetFieldAndKind returns the field being checked and the object kind
func (PulpDeployment) GetFields ¶
func (PulpDeployment) GetFields(obj ...interface{}) []interface{}
GetFields expects 3 arguments: * the current Deployment spec * the expected Deployment spec * a FunctionResources so that CheckDeploymentSpec can use it to get the labels from current Deployment
func (PulpDeployment) GetModifiedFunc ¶
func (PulpDeployment) GetModifiedFunc() func(...interface{}) bool
GetModifiedFunc returns the function used to check the Deployment modification
type PulpIngress ¶
type PulpIngress struct{}
func (PulpIngress) GetFieldAndKind ¶
func (PulpIngress) GetFieldAndKind() (string, string)
GetFieldAndKind returns the field being checked and the object kind
func (PulpIngress) GetFields ¶
func (PulpIngress) GetFields(obj ...interface{}) []interface{}
GetFields expects 2 arguments: * the current Service spec field * the expected Service spec field
func (PulpIngress) GetModifiedFunc ¶
func (PulpIngress) GetModifiedFunc() func(...interface{}) bool
GetModifiedFunc returns the function used to check the Ingress modification
type PulpObject ¶
type PulpObject interface { GetFields(...interface{}) []interface{} GetModifiedFunc() func(...interface{}) bool GetFieldAndKind() (string, string) }
PulpObject represents Pulp resources managed by pulp-operator
type PulpObjectMetadata ¶
type PulpObjectMetadata struct{}
func (PulpObjectMetadata) GetFieldAndKind ¶
func (PulpObjectMetadata) GetFieldAndKind() (string, string)
GetFieldAndKind returns the field being checked and the object kind
func (PulpObjectMetadata) GetFields ¶
func (PulpObjectMetadata) GetFields(obj ...interface{}) []interface{}
GetFields expects 2 arguments: * the current Object definition * the expected Object definition
func (PulpObjectMetadata) GetModifiedFunc ¶
func (PulpObjectMetadata) GetModifiedFunc() func(...interface{}) bool
GetModifiedFunc returns the function used to check the Metadata modification
type PulpRoute ¶
type PulpRoute struct{}
func (PulpRoute) GetFieldAndKind ¶
GetFieldAndKind returns the field being checked and the object kind
func (PulpRoute) GetFields ¶
func (PulpRoute) GetFields(obj ...interface{}) []interface{}
GetFields expects 3 arguments: * the current Deployment spec * the expected Deployment spec * a FunctionResources so that CheckDeploymentSpec can use it to get the labels from current Deployment
func (PulpRoute) GetModifiedFunc ¶
GetModifiedFunc returns the function used to check the Route modification
type PulpSecret ¶
type PulpSecret struct{}
func (PulpSecret) GetFieldAndKind ¶
func (PulpSecret) GetFieldAndKind() (string, string)
GetFieldAndKind returns the field being checked and the object kind
func (PulpSecret) GetFields ¶
func (PulpSecret) GetFields(obj ...interface{}) []interface{}
GetFields expects 2 arguments: * the current encoded Secret data * the expected "raw" Secret string data
func (PulpSecret) GetModifiedFunc ¶
func (PulpSecret) GetModifiedFunc() func(...interface{}) bool
GetModifiedFunc returns the function used to check the Secret modification
type PulpService ¶
type PulpService struct{}
func (PulpService) GetFieldAndKind ¶
func (PulpService) GetFieldAndKind() (string, string)
GetFieldAndKind returns the field being checked and the object kind
func (PulpService) GetFields ¶
func (PulpService) GetFields(obj ...interface{}) []interface{}
GetFields expects 2 arguments: * the current Service spec field * the expected Service spec field
func (PulpService) GetModifiedFunc ¶
func (PulpService) GetModifiedFunc() func(...interface{}) bool
GetModifiedFunc returns the function used to check the Service modification