Documentation
¶
Index ¶
- Constants
- func AddTrackedByOperatorLabel(meta *metav1.ObjectMeta)
- func AgentTLSProtocolVersionString(v configv1.TLSProtocolVersion) string
- func AnnotationsForCluster(cr *argoproj.ArgoCD) map[string]string
- func AppendStringMap(src map[string]string, add map[string]string) map[string]string
- func CheckClusterRoleBindingOwnership(clusterRoleBinding *v1.ClusterRoleBinding, cr *argoproj.ArgoCD) bool
- func CheckClusterRoleOwnership(clusterRole *v1.ClusterRole, cr *argoproj.ArgoCD) bool
- func CombineImageTag(img string, tag string) string
- func CreateEvent(client client.Client, eventType, action, message, reason string, ...) error
- func CreateSecret(client client.Client, name string, namespace string, data map[string][]byte) error
- func CreateTLSSecret(client client.Client, name string, namespace string, data map[string][]byte) error
- func DecorateWithFIPSEnv(in []corev1.EnvVar) []corev1.EnvVar
- func DefaultPVCResources() corev1.VolumeResourceRequirements
- func DefaultSecurityContext() *v1.SecurityContext
- func EncodeCertificatePEM(cert *x509.Certificate) []byte
- func EncodePrivateKeyPEM(key *rsa.PrivateKey) []byte
- func EnvGet(envs []corev1.EnvVar, name string) *corev1.EnvVar
- func EnvMerge(existing []corev1.EnvVar, merge []corev1.EnvVar, override bool) []corev1.EnvVar
- func EnvRemove(envs []corev1.EnvVar, name string) []corev1.EnvVar
- func EnvSet(envs []corev1.EnvVar, env corev1.EnvVar) []corev1.EnvVar
- func FetchObject(client client.Client, namespace string, name string, obj client.Object) error
- func FetchSecret(client client.Client, meta metav1.ObjectMeta, name string) (*corev1.Secret, error)
- func FetchStorageSecretName(export *argoprojv1alpha1.ArgoCDExport) string
- func FqdnServiceRef(service string, port int, cr *argoproj.ArgoCD) string
- func GenerateAgentPrincipalRedisProxyServiceName(crName string) string
- func GetClusterDomain(cr *argoproj.ArgoCD) string
- func GetImagePullPolicy(policy corev1.PullPolicy) corev1.PullPolicy
- func GetMaxCRNameLength() int
- func GetMaxLabelLength() int
- func GetMaxStatefulSetNameLength() int
- func GetOperatorNamespace() (string, error)
- func GetRedisAuthEnv() []corev1.EnvVar
- func GetRedisConf(useTLSForRedis bool) string
- func GetRedisContainerImage(cr *argoproj.ArgoCD) string
- func GetRedisHAContainerImage(cr *argoproj.ArgoCD) string
- func GetRedisHAProxyConfig(cr *argoproj.ArgoCD, useTLSForRedis bool, ...) string
- func GetRedisHAProxyContainerImage(cr *argoproj.ArgoCD) string
- func GetRedisHAProxyScript(cr *argoproj.ArgoCD) string
- func GetRedisHAReplicas() *int32
- func GetRedisHAResources(cr *argoproj.ArgoCD) corev1.ResourceRequirements
- func GetRedisInitScript(cr *argoproj.ArgoCD, useTLSForRedis bool) string
- func GetRedisLivenessScript(useTLSForRedis bool) string
- func GetRedisReadinessScript(useTLSForRedis bool) string
- func GetRedisResources(cr *argoproj.ArgoCD) corev1.ResourceRequirements
- func GetRedisSecretData(redisInitialPassword []byte) map[string][]byte
- func GetRedisSentinelConf(useTLSForRedis bool) string
- func GetRedisServerAddress(cr *argoproj.ArgoCD) string
- func GetSecretNameWithSuffix(cr *argoproj.ArgoCD, suffix string) string
- func GetSentinelLivenessScript(useTLSForRedis bool) string
- func GetTruncatedCRName(cr *argoproj.ArgoCD) string
- func IsAPIRegistered(group string, version string) (bool, error)
- func IsNamespaceClusterConfigNamespace(ns string) bool
- func IsObjectFound(client client.Client, namespace string, name string, obj client.Object) (bool, error)
- func IsRouteAPIAvailable() bool
- func IsTrackedByOperator(labels map[string]string) bool
- func LabelsForCluster(cr *argoproj.ArgoCD) map[string]string
- func LogResourceAction(log logr.Logger, action string, object metav1.Object, explanations ...string)
- func LogResourceCreation(log logr.Logger, object metav1.Object, explanations ...string)
- func LogResourceDeletion(log logr.Logger, object metav1.Object, explanations ...string)
- func LogResourceUpdate(log logr.Logger, object metav1.Object, explanations ...string)
- func MapCipherSuites(names []string) []string
- func MapOpenShiftTLSGroupsToGoCurves(groups []configv1.TLSGroup, component string) (string, error)
- func MapOpenShiftTLSGroupsToOpenSSL(groups []configv1.TLSGroup, component string) string
- func MountRedisAuthToArgo(cr *argoproj.ArgoCD) (volume corev1.Volume, mount corev1.VolumeMount)
- func MountRedisAuthToRedis(cr *argoproj.ArgoCD) (volume corev1.Volume, mount corev1.VolumeMount)
- func NameWithSuffix(meta metav1.ObjectMeta, suffix string) string
- func NameWithSuffixForStatefulSet(meta metav1.ObjectMeta, suffix string) string
- func NewPersistentVolumeClaim(meta metav1.ObjectMeta) *corev1.PersistentVolumeClaim
- func NewPersistentVolumeClaimWithName(name string, meta metav1.ObjectMeta) *corev1.PersistentVolumeClaim
- func NewPrivateKey() (*rsa.PrivateKey, error)
- func NewSecret(cr *argoproj.ArgoCD) *corev1.Secret
- func NewSecretWithName(cr *argoproj.ArgoCD, name string) *corev1.Secret
- func NewSecretWithSuffix(cr *argoproj.ArgoCD, suffix string) *corev1.Secret
- func NewSelfSignedCACertificate(name string, key *rsa.PrivateKey) (*x509.Certificate, error)
- func NewSignedCertificate(cfg *certmanagerv1.CertificateSpec, dnsNames []string, key *rsa.PrivateKey, ...) (*x509.Certificate, error)
- func NewTLSSecret(cr *argoproj.ArgoCD, suffix string) *corev1.Secret
- func ParsePEMEncodedCert(pemdata []byte) (*x509.Certificate, error)
- func ParsePEMEncodedPrivateKey(pemdata []byte) (*rsa.PrivateKey, error)
- func RedisTLSProtocolVersionString(v configv1.TLSProtocolVersion) string
- func SetRouteAPIFound(found bool)
- func TLSProtocolVersionString(v configv1.TLSProtocolVersion) string
- func TruncateCRName(crName string) string
- func TruncateWithHash(input string, maxLength int) string
- func VerifyAPI(group string, version string) (bool, error)
- func VerifyRouteAPI() error
- type FipsConfigChecker
- type LinuxFipsConfigChecker
Constants ¶
const ( RedisAuthVolumeName = "redis-initial-pass" RedisAuthMountPath = "/app/config/redis-auth/" )
const OperatorNamespaceFile = "/var/run/secrets/kubernetes.io/serviceaccount/namespace"
Variables ¶
This section is empty.
Functions ¶
func AddTrackedByOperatorLabel ¶
func AddTrackedByOperatorLabel(meta *metav1.ObjectMeta)
AddTrackedByOperatorLabel adds the ArgoCDTrackedByOperator label to the resource
func AgentTLSProtocolVersionString ¶
func AgentTLSProtocolVersionString(v configv1.TLSProtocolVersion) string
func AnnotationsForCluster ¶
AnnotationsForCluster returns the annotations for all cluster resources.
func AppendStringMap ¶
AppendStringMap will append the map `add` to the given map `src` and return the result.
func CheckClusterRoleBindingOwnership ¶
func CheckClusterRoleBindingOwnership(clusterRoleBinding *v1.ClusterRoleBinding, cr *argoproj.ArgoCD) bool
func CheckClusterRoleOwnership ¶
func CheckClusterRoleOwnership(clusterRole *v1.ClusterRole, cr *argoproj.ArgoCD) bool
func CombineImageTag ¶
CombineImageTag will return the combined image and tag in the proper format for tags and digests.
func CreateEvent ¶
func CreateEvent(client client.Client, eventType, action, message, reason string, objectMeta metav1.ObjectMeta, typeMeta metav1.TypeMeta) error
CreateEvent will create a new Kubernetes Event with the given action, message, reason and involved uid.
func CreateSecret ¶
func CreateTLSSecret ¶
func DecorateWithFIPSEnv ¶
DecorateWithFIPSEnv adds environment variables required to enable FIPS in go runtime. If user has set this value already, this method does not override it. If the environment variable GODEBUG contains fips140=on, it will also set GOLANG_FIPS=0 as these two environments are mutually exclusive.
func DefaultPVCResources ¶
func DefaultPVCResources() corev1.VolumeResourceRequirements
DefaultPVCResources will return the default PVC resources.
func DefaultSecurityContext ¶
func DefaultSecurityContext() *v1.SecurityContext
func EncodeCertificatePEM ¶
func EncodeCertificatePEM(cert *x509.Certificate) []byte
EncodeCertificatePEM encodes the given certificate pem and returns bytes (base64).
func EncodePrivateKeyPEM ¶
func EncodePrivateKeyPEM(key *rsa.PrivateKey) []byte
EncodePrivateKeyPEM encodes the given private key pem and returns bytes (base64).
func EnvGet ¶
EnvGet returns a pointer to the EnvVar with the given name, or nil if not found. The pointer refers into envs, so callers may update the entry in place.
func EnvMerge ¶
EnvMerge merges two slices of EnvVar entries into a single one. If existing has an EnvVar with same Name attribute as one in merge, the EnvVar is not merged unless override is set to true.
func EnvRemove ¶
EnvRemove returns a copy of envs with any EnvVar named name removed. Order of remaining entries is preserved.
func EnvSet ¶
EnvSet returns a copy of envs with env upserted by Name: existing entry is replaced in place, otherwise env is appended. Order of other entries is preserved.
func FetchObject ¶
FetchObject will retrieve the object with the given namespace and name using the Kubernetes API. The result will be stored in the given object.
func FetchSecret ¶
FetchSecret will retrieve the object with the given Name using the provided client. The result will be returned.
func FetchStorageSecretName ¶
func FetchStorageSecretName(export *argoprojv1alpha1.ArgoCDExport) string
FetchStorageSecretName will return the name of the Secret to use for the export process.
func FqdnServiceRef ¶
FqdnServiceRef will return the FQDN referencing a specific service name, as set up by the operator, with the given port.
func GenerateAgentPrincipalRedisProxyServiceName ¶
GenerateAgentPrincipalRedisProxyServiceName generates a deterministic Service name for the agent's principal Redis proxy. It truncates the Custom Resource (CR) name to ensure the final appended name stays within Kubernetes length limits.
func GetClusterDomain ¶
GetClusterDomain returns the cluster domain suffix for the given ArgoCD instance. If not specified in the CR, defaults to the standard cluster domain.
func GetImagePullPolicy ¶
func GetImagePullPolicy(policy corev1.PullPolicy) corev1.PullPolicy
GetImagePullPolicy returns the effective image pull policy for Argo CD components. It follows this precedence: 1. Instance specific policy defined in the ArgoCD CR 2. Global policy defined via the IMAGE_PULL_POLICY environment variable 3. Default policy (IfNotPresent)
func GetMaxCRNameLength ¶
func GetMaxCRNameLength() int
GetMaxCRNameLength returns the maximum length for ArgoCD CR names to accommodate longest suffix This is exposed for external packages that need to check CR name length
func GetMaxLabelLength ¶
func GetMaxLabelLength() int
GetMaxLabelLength returns the maximum length for Kubernetes labels and names This is exposed for testing purposes
func GetMaxStatefulSetNameLength ¶
func GetMaxStatefulSetNameLength() int
GetMaxStatefulSetNameLength returns the maximum length for StatefulSet names. This is exposed for testing purposes.
func GetOperatorNamespace ¶
func GetRedisAuthEnv ¶
func GetRedisConf ¶
GetRedisConf will load the redis configuration from a template on disk for the given ArgoCD. If an error occurs, an empty string value will be returned.
func GetRedisContainerImage ¶
GetRedisContainerImage will return the container image for the Redis server.
func GetRedisHAContainerImage ¶
GetRedisHAContainerImage will return the container image for the Redis server in HA mode.
func GetRedisHAProxyConfig ¶
func GetRedisHAProxyConfig(cr *argoproj.ArgoCD, useTLSForRedis bool, centralTLSConfigProfile tlsprofile.TLSConfigProfile) string
GetRedisHAProxyConfig will load the Redis HA Proxy configuration from a template on disk for the given ArgoCD. If an error occurs, an empty string value will be returned.
func GetRedisHAProxyContainerImage ¶
GetRedisHAProxyContainerImage will return the container image for the Redis HA Proxy.
func GetRedisHAProxyScript ¶
GetRedisHAProxyScript will load the Redis HA Proxy init script from a template on disk for the given ArgoCD. If an error occurs, an empty string value will be returned.
func GetRedisHAReplicas ¶
func GetRedisHAReplicas() *int32
func GetRedisHAResources ¶
func GetRedisHAResources(cr *argoproj.ArgoCD) corev1.ResourceRequirements
GetRedisHAResources will return the ResourceRequirements for the Redis HA.
func GetRedisInitScript ¶
GetRedisInitScript will load the redis init script from a template on disk for the given ArgoCD. If an error occurs, an empty string value will be returned.
func GetRedisLivenessScript ¶
GetRedisLivenessScript will load the redis liveness script from a template on disk for the given ArgoCD. If an error occurs, an empty string value will be returned.
func GetRedisReadinessScript ¶
GetRedisReadinessScript will load the redis readiness script from a template on disk for the given ArgoCD. If an error occurs, an empty string value will be returned.
func GetRedisResources ¶
func GetRedisResources(cr *argoproj.ArgoCD) corev1.ResourceRequirements
GetRedisResources will return the ResourceRequirements for the Redis container.
func GetRedisSecretData ¶
func GetRedisSentinelConf ¶
GetRedisSentinelConf will load the redis sentinel configuration from a template on disk for the given ArgoCD. If an error occurs, an empty string value will be returned.
func GetRedisServerAddress ¶
GetRedisServerAddress will return the Redis service address for the given ArgoCD.
func GetSecretNameWithSuffix ¶
GetSecretNameWithSuffix returns the secret name using truncated CR name + full suffix. This function should be used when referencing secret names in other resources.
func GetSentinelLivenessScript ¶
GetSentinelLivenessScript will load the redis liveness script from a template on disk for the given ArgoCD. If an error occurs, an empty string value will be returned.
func GetTruncatedCRName ¶
GetTruncatedCRName returns the truncated CR name using the deterministic truncate function
func IsAPIRegistered ¶
IsAPIRegistered returns true if the API is registered irrespective of whether the API status is available or not.
func IsObjectFound ¶
func IsObjectFound(client client.Client, namespace string, name string, obj client.Object) (bool, error)
IsObjectFound will perform a basic check that the given object exists via the Kubernetes API. If an error occurs as part of the check, the function will return false.
func IsRouteAPIAvailable ¶
func IsRouteAPIAvailable() bool
IsRouteAPIAvailable returns true if the Route API is present.
func IsTrackedByOperator ¶
IsTrackedByOperator checks if the resource is tracked by the operator
func LabelsForCluster ¶
LabelsForCluster returns the labels for all cluster resources.
func LogResourceAction ¶
func LogResourceCreation ¶
func LogResourceDeletion ¶
func LogResourceUpdate ¶
func MapCipherSuites ¶
MapCipherSuites converts OpenSSL-style cipher names to their IANA equivalents (via library-go's canonical mapping), keeping only ciphers that Go's crypto/tls considers secure and can actually negotiate. TLS 1.3 ciphers are always included since Go negotiates them automatically and they aren't independently configurable.
func MapOpenShiftTLSGroupsToGoCurves ¶
MapOpenShiftTLSGroupsToGoCurves converts OpenShift TLS groups to a colon-separated list of Go crypto/tls curve names (e.g. CurveP256, X25519) for Go-based components (gitops-backend, argocd-agent principal, etc.). Callers that need a different separator (e.g. commas for the agent principal ARGOCD_PRINCIPAL_TLS_CURVE_PREFERENCES) should replace ":" as needed. Unsupported groups are skipped and logged. If groups is non-empty but none are supported by Go, an error is returned so callers do not treat an incompatible profile as an absent preference.
func MapOpenShiftTLSGroupsToOpenSSL ¶
MapOpenShiftTLSGroupsToOpenSSL converts OpenShift TLS groups to a colon-separated OpenSSL Groups string. Unknown groups are skipped and logged. component is included in the log message to identify the caller (e.g. "Redis HAProxy", "gitops-plugin httpd").
func MountRedisAuthToArgo ¶
MountRedisAuthToArgo mounts subset of redis secret for consumption by argocd components.
func MountRedisAuthToRedis ¶
MountRedisAuthToRedis mounts entire redis secret for consumption by redis components.
func NameWithSuffix ¶
func NameWithSuffix(meta metav1.ObjectMeta, suffix string) string
NameWithSuffix will return a name based on the given resource using the better truncation approach. The object name is truncated first, then the full suffix is appended to preserve suffix readability. Example: Given a long resource name, this ensures suffixes like "redis-initial-password" remain intact.
func NameWithSuffixForStatefulSet ¶
func NameWithSuffixForStatefulSet(meta metav1.ObjectMeta, suffix string) string
NameWithSuffixForStatefulSet returns a StatefulSet name that stays within the Kubernetes label length limit after controller revision hash suffixes are applied. Preserves the original suffix when possible to maintain backward compatibility. Only abbreviates or truncates when the full name would exceed maxStatefulSetNameLength.
func NewPersistentVolumeClaim ¶
func NewPersistentVolumeClaim(meta metav1.ObjectMeta) *corev1.PersistentVolumeClaim
NewPersistentVolumeClaim returns a new PersistentVolumeClaim instance for the ObjectMeta resource.
func NewPersistentVolumeClaimWithName ¶
func NewPersistentVolumeClaimWithName(name string, meta metav1.ObjectMeta) *corev1.PersistentVolumeClaim
NewPersistentVolumeClaimWithName returns a new PersistentVolumeClaim instance with the given name.
func NewPrivateKey ¶
func NewPrivateKey() (*rsa.PrivateKey, error)
NewPrivateKey returns randomly generated RSA private key.
func NewSecretWithName ¶
NewSecretWithName returns a new Secret based on the given metadata with the provided Name.
func NewSecretWithSuffix ¶
NewSecretWithSuffix returns a new Secret based on the given metadata with the provided suffix on the Name. This uses the better truncation approach: truncate CR name first, then append full suffix
func NewSelfSignedCACertificate ¶
func NewSelfSignedCACertificate(name string, key *rsa.PrivateKey) (*x509.Certificate, error)
NewSelfSignedCACertificate returns a self-signed CA certificate based on given configuration and private key. The certificate has one-year lease.
func NewSignedCertificate ¶
func NewSignedCertificate(cfg *certmanagerv1.CertificateSpec, dnsNames []string, key *rsa.PrivateKey, caCert *x509.Certificate, caKey *rsa.PrivateKey) (*x509.Certificate, error)
NewSignedCertificate signs a certificate using the given private key, CA and returns a signed certificate. The certificate could be used for both client and server auth. The certificate has one-year lease.
func NewTLSSecret ¶
NewTLSSecret returns a new TLS Secret based on the given metadata with the provided suffix on the Name.
func ParsePEMEncodedCert ¶
func ParsePEMEncodedCert(pemdata []byte) (*x509.Certificate, error)
ParsePEMEncodedCert parses a certificate from the given pemdata
func ParsePEMEncodedPrivateKey ¶
func ParsePEMEncodedPrivateKey(pemdata []byte) (*rsa.PrivateKey, error)
ParsePEMEncodedPrivateKey parses a private key from given pemdata
func RedisTLSProtocolVersionString ¶
func RedisTLSProtocolVersionString(v configv1.TLSProtocolVersion) string
func SetRouteAPIFound ¶
func SetRouteAPIFound(found bool)
func TLSProtocolVersionString ¶
func TLSProtocolVersionString(v configv1.TLSProtocolVersion) string
func TruncateCRName ¶
TruncateCRName truncates an ArgoCD CR name to allow for the longest possible suffix This ensures that when suffixes like "redis-initial-password" are appended, the total length stays within Kubernetes 63-character limit
func TruncateWithHash ¶
TruncateWithHash truncates a string to a maximum length and adds a hash suffix to ensure uniqueness
func VerifyRouteAPI ¶
func VerifyRouteAPI() error
VerifyRouteAPI will verify that the Route API is present.
Types ¶
type FipsConfigChecker ¶
FipsConfigChecker defines the behavior for reading the FIPS config.
type LinuxFipsConfigChecker ¶
type LinuxFipsConfigChecker struct {
ConfigFilePath string
}
LinuxFipsConfigChecker implements the config reader for checking if the Linux based host is running in FIPS enabled mode.
func NewLinuxFipsConfigChecker ¶
func NewLinuxFipsConfigChecker() *LinuxFipsConfigChecker
NewLinuxFipsConfigChecker returns a Linux based config checker
func (*LinuxFipsConfigChecker) IsFipsEnabled ¶
func (l *LinuxFipsConfigChecker) IsFipsEnabled() (bool, error)
IsFipsEnabled reads the specified FIPS config file in a Linux based host and returns true FIPS is enabled, false otherwise.