Documentation ¶
Overview ¶
Package configuration contains the configuration of the operator, reading if from environment variables and from the ConfigMap
Index ¶
Constants ¶
const ( // DefaultOperatorPullSecretName is implicitly copied into newly created clusters. DefaultOperatorPullSecretName = "cnpg-pull-secret" // #nosec // CertificateDuration is the default value for the lifetime of the generated certificates CertificateDuration = 90 // ExpiringCheckThreshold is the default threshold to consider a certificate as expiring ExpiringCheckThreshold = 7 )
const DefaultPluginSocketDir = "/plugins"
DefaultPluginSocketDir is the default directory where the plugin sockets are located.
Variables ¶
var Current = NewConfiguration()
Current is the configuration used by the operator
Functions ¶
This section is empty.
Types ¶
type Data ¶
type Data struct { // WebhookCertDir is the directory where the certificates for the webhooks // need to written. This is different between plain Kubernetes and OpenShift WebhookCertDir string `json:"webhookCertDir" env:"WEBHOOK_CERT_DIR"` // PluginSocketDir is the directory where the plugins sockets are to be // found PluginSocketDir string `json:"pluginSocketDir" env:"PLUGIN_SOCKET_DIR"` // WatchNamespace is the namespace where the operator should watch and // is configurable via environment variables in the OpenShift console. // Multiple namespaces can be specified separated by comma WatchNamespace string `json:"watchNamespace" env:"WATCH_NAMESPACE"` // OperatorNamespace is the namespace where the operator is installed OperatorNamespace string `json:"operatorNamespace" env:"OPERATOR_NAMESPACE"` // OperatorPullSecretName is the pull secret used to download the // pull secret name OperatorPullSecretName string `json:"operatorPullSecretName" env:"PULL_SECRET_NAME"` // OperatorImageName is the name of the image of the operator, that is // used to bootstrap Pods OperatorImageName string `json:"operatorImageName" env:"OPERATOR_IMAGE_NAME"` // PostgresImageName is the name of the image of PostgreSQL that is // used by default for new clusters PostgresImageName string `json:"postgresImageName" env:"POSTGRES_IMAGE_NAME"` // InheritedAnnotations is a list of annotations that every resource could inherit from // the owning Cluster InheritedAnnotations []string `json:"inheritedAnnotations" env:"INHERITED_ANNOTATIONS"` // InheritedLabels is a list of labels that every resource could inherit from // the owning Cluster InheritedLabels []string `json:"inheritedLabels" env:"INHERITED_LABELS"` // MonitoringQueriesConfigmap is the name of the configmap in the operator namespace which contain // the monitoring queries. The queries will be read from the data key: "queries". MonitoringQueriesConfigmap string `json:"monitoringQueriesConfigmap" env:"MONITORING_QUERIES_CONFIGMAP"` // MonitoringQueriesSecret is the name of the secret in the operator namespace which contain // the monitoring queries. The queries will be read from the data key: "queries". MonitoringQueriesSecret string `json:"monitoringQueriesSecret" env:"MONITORING_QUERIES_SECRET"` // EnableInstanceManagerInplaceUpdates enables the instance manager to apply in-place updates, // replacing the executable in a pod without restarting EnableInstanceManagerInplaceUpdates bool `json:"enableInstanceManagerInplaceUpdates" env:"ENABLE_INSTANCE_MANAGER_INPLACE_UPDATES"` //nolint // EnableAzurePVCUpdates enables the live update of PVC in Azure environment EnableAzurePVCUpdates bool `json:"enableAzurePVCUpdates" env:"ENABLE_AZURE_PVC_UPDATES"` // EnablePodDebugging enable debugging mode in new generated pods EnablePodDebugging bool `json:"enablePodDebugging" env:"POD_DEBUG"` // This is the lifetime of the generated certificates CertificateDuration int `json:"certificateDuration" env:"CERTIFICATE_DURATION"` // Threshold to consider a certificate as expiring ExpiringCheckThreshold int `json:"expiringCheckThreshold" env:"EXPIRING_CHECK_THRESHOLD"` // CreateAnyService is true when the user wants the operator to create // the <cluster-name>-any service. Defaults to false. CreateAnyService bool `json:"createAnyService" env:"CREATE_ANY_SERVICE"` }
Data is the struct containing the configuration of the operator. Usually the operator code will use the "Current" configuration.
func NewConfiguration ¶
func NewConfiguration() *Data
NewConfiguration create a new CNPG configuration by reading the environment variables
func (*Data) IsAnnotationInherited ¶
IsAnnotationInherited checks if an annotation with a certain name should be inherited from the Cluster specification to the generated objects
func (*Data) IsLabelInherited ¶
IsLabelInherited checks if a label with a certain name should be inherited from the Cluster specification to the generated objects
func (*Data) ReadConfigMap ¶
ReadConfigMap reads the configuration from the environment and the passed in data map
func (*Data) WatchedNamespaces ¶
WatchedNamespaces get the list of additional watched namespaces. The result is a list of namespaces specified in the WATCHED_NAMESPACE where each namespace is separated by comma