config

package
v0.1.89 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2026 License: Apache-2.0 Imports: 21 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	// NeedManagementKASAccessLabel is used by network policies
	// to prevent any pod which doesn't contain the label from accessing the management cluster KAS.
	NeedManagementKASAccessLabel = "hypershift.openshift.io/need-management-kas-access"

	// NeedMetricsServerAccessLabel is used by network policies
	// to allow egress communication to the metrics server on the management cluster.
	NeedMetricsServerAccessLabel = "hypershift.openshift.io/need-metrics-server-access"

	// EtcdPriorityClass is for etcd pods.
	EtcdPriorityClass = "hypershift-etcd"

	// APICriticalPriorityClass is for pods that are required for API calls and
	// resource admission to succeed. This includes pods like kube-apiserver,
	// aggregated API servers, and webhooks.
	APICriticalPriorityClass = "hypershift-api-critical"

	// DefaultPriorityClass is for pods in the Hypershift control plane that are
	// not API critical but still need elevated priority.
	DefaultPriorityClass = "hypershift-control-plane"

	DefaultServiceAccountIssuer = "https://kubernetes.default.svc"
	// KubeconfigKey is the key used for kubeconfig data in Secrets.
	KubeconfigKey = "kubeconfig"
	// AWSCloudProviderName is the cloud provider identifier for AWS.
	AWSCloudProviderName         = "aws"
	DefaultImageRegistryHostname = "image-registry.openshift-image-registry.svc:5000"
	DefaultAdvertiseIPv4Address  = "172.20.0.1"
	DefaultAdvertiseIPv6Address  = "fd00::1"
	DefaultEtcdURL               = "https://etcd-client:2379"
	EtcdClientPort               = 2379
	// KASSVCLBAzurePort is needed because for Azure we currently hardcode 7443 for the SVC LB as 6443 collides with public LB rule for the management cluster.
	// https://bugzilla.redhat.com/show_bug.cgi?id=2060650
	// TODO(alberto): explore exposing multiple Azure frontend IPs on the load balancer.
	KASSVCLBAzurePort           = 7443
	KASSVCPort                  = 6443
	KASPodDefaultPort           = 6443
	KASSVCIBMCloudPort          = 2040
	DefaultServiceNodePortRange = "30000-32767"
	DefaultSecurityContextUser  = 1001
	RecommendedLeaseDuration    = "137s"
	RecommendedRenewDeadline    = "107s"
	RecommendedRetryPeriod      = "26s"
	KCMRecommendedRenewDeadline = "12s"
	KCMRecommendedRetryPeriod   = "3s"

	DefaultIngressDomainEnvVar                    = "DEFAULT_INGRESS_DOMAIN"
	EnableCVOManagementClusterMetricsAccessEnvVar = "ENABLE_CVO_MANAGEMENT_CLUSTER_METRICS_ACCESS"
	CVOPrometheusURLEnvVar                        = "CVO_PROMETHEUS_URL"

	EnableEtcdRecoveryEnvVar = "ENABLE_ETCD_RECOVERY"
	ReconcileLegacyEnvVar    = "HYPERSHIFT_RECONCILE_LEGACY"

	AuditWebhookService = "audit-webhook"

	// DefaultMachineNetwork is the default network CIDR for the machine network.
	DefaultMachineNetwork = "10.0.0.0/16"

	// Constants related to supported OCP versions.
	ConfigMapVersionsKey      = "supported-versions"
	ConfigMapServerVersionKey = "server-version"
	SupportedVersionsLabel    = "hypershift.openshift.io/supported-versions"
	DefaultReleaseStream      = "4-stable-multi"

	// Constants related to HyperShift operator image.
	HypershiftImageBase = "quay.io/hypershift/hypershift-operator"
	HypershiftImageTag  = "latest"
)
View Source
const (
	// DefaultAzureLocation is the default Azure region for resource creation
	DefaultAzureLocation = "eastus"
	// DefaultAzureCloud is the default Azure cloud environment
	DefaultAzureCloud = "AzurePublicCloud"
)

Azure Default Values

View Source
const (
	// AROHCPKeyVaultManagedIdentityClientID captures the client ID of the managed identity created on an ARO HCP
	// management cluster. This managed identity is used to pull secrets and certificates out of Azure Key Vaults in the
	// management cluster's resource group in Azure.
	AROHCPKeyVaultManagedIdentityClientID = "ARO_HCP_KEY_VAULT_USER_CLIENT_ID"

	ManagedAzureCredentialsFilePath          = "MANAGED_AZURE_HCP_CREDENTIALS_FILE_PATH"
	ManagedAzureSecretProviderClassEnvVarKey = "ARO_HCP_SECRET_PROVIDER_CLASS"
	ManagedAzureCertificateMountPath         = "/mnt/certs"
	ManagedAzureCredentialsMountPathForKMS   = "/mnt/kms"
	ManagedAzureCertificatePath              = "/mnt/certs/"
	ManagedAzureCredentialsPathForKMS        = "/mnt/kms/"
	ManagedAzureSecretsStoreCSIDriver        = "secrets-store.csi.k8s.io"
	ManagedAzureSecretProviderClass          = "secretProviderClass"

	ManagedAzureCPOSecretProviderClassName                = "managed-azure-cpo"
	ManagedAzureCPOSecretStoreVolumeName                  = "cpo-cert"
	ManagedAzureCloudProviderSecretProviderClassName      = "managed-azure-cloud-provider"
	ManagedAzureCloudProviderSecretStoreVolumeName        = "cloud-provider-cert"
	ManagedAzureDiskCSISecretStoreProviderClassName       = "managed-azure-disk-csi"
	ManagedAzureFileCSISecretStoreProviderClassName       = "managed-azure-file-csi"
	ManagedAzureImageRegistrySecretStoreProviderClassName = "managed-azure-image-registry"
	ManagedAzureImageRegistrySecretStoreVolumeName        = "image-registry-cert"
	ManagedAzureIngressSecretStoreProviderClassName       = "managed-azure-ingress"
	ManagedAzureIngressSecretStoreVolumeName              = "ingress-cert"
	ManagedAzureKMSSecretProviderClassName                = "managed-azure-kms"
	ManagedAzureKMSSecretStoreVolumeName                  = "kms-cert"
	ManagedAzureNetworkSecretStoreProviderClassName       = "managed-azure-network"
	ManagedAzureNodePoolMgmtSecretProviderClassName       = "managed-azure-nodepool-management"
	ManagedAzureNodePoolMgmtSecretStoreVolumeName         = "nodepool-management-cert"

	// Azure Role Definitions
	ContributorRoleDefinitionID   = "b24988ac-6180-42a0-ab88-20f7382dd24c"
	CloudProviderRoleDefinitionID = "a1f96423-95ce-4224-ab27-4e3dc72facd4"
	IngressRoleDefinitionID       = "0336e1d3-7a87-462b-b6db-342b63f7802c"
	CPOCustomRoleDefinitionID     = "7d8bb4e4-6fa7-4545-96cf-20fce11b705d"
	AzureFileRoleDefinitionID     = "0d7aedc0-15fd-4a67-a412-efad370c947e"
	AzureDiskRoleDefinitionID     = "5b7237c5-45e1-49d6-bc18-a1f62f400748"
	NetworkRoleDefinitionID       = "be7a6435-15ae-4171-8f30-4a343eff9e8f"
	ImageRegistryRoleDefinitionID = "8b32b316-c2f5-4ddf-b05b-83dacd2d08b5"
	CAPZCustomRoleDefinitionID    = "Azure Red Hat OpenShift NodePool Management Role"

	// Built-in Azure roles used by Karpenter (see Azure/karpenter-provider-azure)
	// https://github.com/Azure/karpenter-provider-azure/blob/59a10962faf8eb6afca2aec6e63da12f712fd886/README.md?plain=1#L136-L144
	//
	// az role definition list \
	// --query "[?contains(['Virtual Machine Contributor', 'Network Contributor', 'Managed Identity Operator'], roleName)].{roleName:roleName,roleId:name}" \
	// --output table
	// RoleName                     RoleId
	// ---------------------------  ------------------------------------
	// Managed Identity Operator    f1a07417-d97a-45cb-824c-7a7467783830
	// Network Contributor          4d97b98b-1d4f-4787-a291-c67834d212e7
	// Virtual Machine Contributor  9980e02c-c2be-4d73-94e8-173b1dc7cf3c
	VirtualMachineContributorRoleDefinitionID = "9980e02c-c2be-4d73-94e8-173b1dc7cf3c"
	NetworkContributorRoleDefinitionID        = "4d97b98b-1d4f-4787-a291-c67834d212e7"
	ManagedIdentityOperatorRoleDefinitionID   = "f1a07417-d97a-45cb-824c-7a7467783830"

	// Azure Components with Control Plane Managed Identities
	AzureDisk        = "azure-disk"
	AzureFile        = "azure-file"
	CIRO             = "ciro"
	CloudProvider    = "cloud-provider"
	CNCC             = "cncc"
	CPO              = "cpo"
	Ingress          = "ingress"
	NodePoolMgmt     = "capz"
	KarpenterVM      = "karpenter-vm"
	KarpenterNetwork = "karpenter-network"
	KarpenterMI      = "karpenter-mi"
)

Managed Azure Related Constants

View Source
const (
	FeatureGateConfigMapName = "feature-gate"
	FeatureGateConfigKey     = "feature-gate.yaml"
)
View Source
const (
	// PodSafeToEvictLocalVolumesKey is an annotation used by the CA operator which makes sure
	// all the pods annotated with it and the picking the desired local volumes that are safe to evict, could be drained properly.
	PodSafeToEvictLocalVolumesKey = "cluster-autoscaler.kubernetes.io/safe-to-evict-local-volumes"

	// HCCOUser references the user used by the HostedClusterConfigOperator
	HCCOUser = "hosted-cluster-config"
	// HCCOUserAgent references the userAgent used by the HostedClusterConfigOperator
	HCCOUserAgent = "hosted-cluster-config-operator-manager"

	// KASBootstrapContainerUser references the user used by the KAS bootstrap container
	KASBootstrapContainerUser = "kas-bootstrap-container"
)
View Source
const CloudTokenMountPath = "/var/run/secrets/openshift/serviceaccount"

CloudTokenMountPath is the mount path for federated workload identity tokens used by cloud provider components in self-managed Azure clusters.

Variables

View Source
var (
	Version419 = semver.MustParse("4.19.0")
	Version420 = semver.MustParse("4.20.0")
	Version510 = semver.MustParse("5.1.0")
)

Functions

func AESCBCEncryptedObjects added in v0.1.78

func AESCBCEncryptedObjects() []string

AESCBCEncryptedObjects returns the resources declared in the KAS EncryptionConfiguration for AESCBC encryption. TODO(https://github.com/openshift/enhancements/pull/1969#discussion_r3192690488): AESCBC currently only encrypts secrets; configmaps are not covered. This should be expanded to match the full set of sensitive resources once the encryption scope is broadened.

func ApplyServingInfoFromTLSProfile added in v0.1.83

func ApplyServingInfoFromTLSProfile(servingInfo *configv1.ServingInfo, profile *configv1.TLSSecurityProfile) error

ApplyServingInfoFromTLSProfile sets the MinTLSVersion and CipherSuites fields on the provided ServingInfo struct based on the given TLS security profile. This is a convenience function for components that use ServingInfo configuration.

func BuildGenericControllerConfigData added in v0.1.81

func BuildGenericControllerConfigData(ctx context.Context, bindAddress, bindNetwork string, profile *configv1.TLSSecurityProfile, featureGates []string, payloadVersion semver.Version) (string, error)

BuildGenericControllerConfigData builds a GenericControllerConfig YAML string with the specified bind address, bind network, and TLS security profile. This is used by various control plane operators to configure their serving info.

func CipherSuites

func CipherSuites(securityProfile *configv1.TLSSecurityProfile) ([]string, error)

func ControllerOwnerRef

func ControllerOwnerRef(obj client.Object) *metav1.OwnerReference

func CurvePreferences added in v0.1.87

func CurvePreferences(ctx context.Context, profile *configv1.TLSSecurityProfile) ([]tls.CurveID, error)

CurvePreferences resolves a TLS profile's groups to Go curve IDs. Unrecognized or non approved (FIPS) groups are logged and skipped.

func FeatureGateConfigMap added in v0.1.58

func FeatureGateConfigMap(ctx context.Context, c client.Reader, ns string) (*corev1.ConfigMap, error)

func FeatureGatesFromConfigMap added in v0.1.58

func FeatureGatesFromConfigMap(ctx context.Context, c client.Reader, ns string) ([]string, error)

func KMSEncryptedObjects added in v0.1.18

func KMSEncryptedObjects() []string

KMSEncryptedObjects returns the resources declared in the KAS EncryptionConfiguration. TODO(https://github.com/openshift/enhancements/pull/1969#discussion_r3192690488): routes, oauthaccesstokens, and oauthauthorizetokens are listed here but are not actually encrypted today because the OpenShift API servers lack KMS sidecars.

func MinTLSVersion

func MinTLSVersion(securityProfile *configv1.TLSSecurityProfile) (string, error)

func OpenSSLToIANACipherSuites

func OpenSSLToIANACipherSuites(ciphers []string) []string

OpenSSLToIANACipherSuites maps input OpenSSL Cipher Suite names to their IANA counterparts. Unknown ciphers are left out.

func ParseFeatureGates added in v0.1.58

func ParseFeatureGates(cm *corev1.ConfigMap) (*configv1.FeatureGate, error)

func SerializeAuditPolicy

func SerializeAuditPolicy(policy *auditv1.Policy) ([]byte, error)

func SetCipherSuitesUsingAPIServer added in v0.1.75

func SetCipherSuitesUsingAPIServer(apiServerConfig *configv1.APIServer) (func(*tls.Config), error)

SetCipherSuitesUsingAPIServer returns a function that is capable of setting the right cipher suites on a tls config using the provided api server as input. Returns an error if the provided api server contains an invalid suite.

func SetGenericControllerConfig added in v0.1.81

func SetGenericControllerConfig(ctx context.Context, bindAddress, bindNetwork string, profile *configv1.TLSSecurityProfile, cm *corev1.ConfigMap, featureGates []string, payloadVersion semver.Version) error

SetGenericControllerConfig builds a GenericControllerConfig YAML and sets it in the ConfigMap's config.yaml data field. This is a helper function used by NewGenericControllerConfigAdapter in support/controlplane-component.

func SetMinTLSVersionUsingAPIServer added in v0.1.75

func SetMinTLSVersionUsingAPIServer(apiServerConfig *configv1.APIServer) (func(*tls.Config), error)

SetMinTLSVersionUsingAPIServer returns a function capable of setting the min tls version on a provided tls config struct. If the provided api server has an invalid tls version this function returns an error.

func SupportedEtcdCipherSuites added in v0.1.80

func SupportedEtcdCipherSuites(ctx context.Context, cipherSuites []string) []string

SupportedEtcdCipherSuites filters the input cipher suites to only those supported by etcd. It validates each cipher against etcd's tlsutil.GetCipherSuite(). Unknown suites are logged.

func TLSArgs added in v0.1.82

func TLSArgs(profile *configv1.TLSSecurityProfile) ([]string, error)

TLSArgs returns TLS-related command-line arguments for a given TLS security profile. It returns a slice of strings containing --tls-min-version and --tls-cipher-suites flags based on the provided profile. The caller is responsible for appending these to their argument list using the spread operator (...).

Types

type OwnerRef

type OwnerRef struct {
	Reference *metav1.OwnerReference
}

func OwnerRefFrom

func OwnerRefFrom(obj client.Object) OwnerRef

func (OwnerRef) ApplyTo

func (c OwnerRef) ApplyTo(obj client.Object)

type ResourceOverrides

type ResourceOverrides map[string]ResourcesSpec

func (ResourceOverrides) ApplyRequestsTo

func (o ResourceOverrides) ApplyRequestsTo(name string, podSpec *corev1.PodSpec)

type ResourcesSpec

type ResourcesSpec map[string]corev1.ResourceRequirements

func (ResourcesSpec) ApplyRequestsOverrideTo

func (s ResourcesSpec) ApplyRequestsOverrideTo(podSpec *corev1.PodSpec)

func (ResourcesSpec) ApplyTo

func (s ResourcesSpec) ApplyTo(podSpec *corev1.PodSpec)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL