render

package
v1.45.0-0.dev Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2026 License: Apache-2.0 Imports: 63 Imported by: 0

Documentation

Overview

This renderer is responsible for all resources related to a Guardian Deployment in a multicluster setup.

Index

Constants

View Source
const (
	APIServerPort       = 5443
	APIServerPortName   = "apiserver"
	APIServerPolicyName = networkpolicy.CalicoComponentPolicyPrefix + "apiserver-access"

	TieredPolicyPassthruClusterRoleName = "calico-tiered-policy-passthrough"

	// APIServiceName is the aggregated APIService that fronts the projectcalico.org/v3 API group.
	APIServiceName = "v3.projectcalico.org"
)
View Source
const (
	APIServerResourceName  = "apiserver"
	APIServerNamespace     = common.CalicoNamespace
	QueryServerPort        = 8080
	QueryServerPortName    = "queryserver"
	QueryserverNamespace   = "calico-system"
	QueryserverServiceName = "calico-api"

	// Use the same API server container name for both OSS and Enterprise.
	APIServerName                           = "calico-apiserver"
	APIServerContainerName                  = "calico-apiserver"
	TigeraAPIServerQueryServerContainerName = "tigera-queryserver"

	CalicoAPIServerTLSSecretName = "calico-apiserver-certs"
	APIServerServiceName         = "calico-api"
	APIServerServiceAccountName  = "calico-apiserver"

	APIServerSecretsRBACName                        = "calico-extension-apiserver-secrets-access"
	MultiTenantManagedClustersAccessClusterRoleName = "calico-managed-cluster-access"
	ManagedClustersWatchClusterRoleName             = "calico-managed-cluster-watch"
	L7AdmissionControllerContainerName              = "calico-l7-admission-controller"
	L7AdmissionControllerPort                       = 6443
	L7AdmissionControllerPortName                   = "l7admctrl"
)
View Source
const (
	ComponentNameNode = "node"

	// ComponentNameCNIPlugins keys the upstream CNI plugins image. The node
	// component renders the cni-plugins init container, so the image resolves
	// through its own override key.
	ComponentNameCNIPlugins = "cni-plugins"

	// The two windows images get their own keys, since one component renders both.
	ComponentNameWindowsNodeImg = "windows-node-image"
	ComponentNameWindowsCNIImg  = "windows-cni-image"

	ComponentNameKubeControllers = "kube-controllers"
)

Component names, which key the image overrides a variant resolves through.

View Source
const (
	CSIDriverName             = "csi.tigera.io"
	CSIDaemonSetName          = "csi-node-driver"
	CSIDaemonSetNamespace     = "calico-system"
	CSIContainerName          = "calico-csi"
	CSIRegistrarContainerName = "csi-node-driver-registrar"
)
View Source
const (
	DexNamespace     = "tigera-dex"
	DexObjectName    = "tigera-dex"
	DexPort          = 5556
	DexTLSSecretName = "tigera-dex-tls"
	DexClientId      = "tigera-manager"
	DexPolicyName    = networkpolicy.CalicoComponentPolicyPrefix + "dex"

	// TigeraCAPublicSecretName holds a copy of the operator's CA certificate (from tigera-ca-private)
	// in calico-system. It exists so that an OpenShift Ingress fronting the manager can reference it
	// via the destination-CA-certificate annotation on a reencrypt route. Only rendered when the
	// Authentication CR is configured to use the OpenShift IDP.
	TigeraCAPublicSecretName = "tigera-ca-public"
)
View Source
const (
	ClientSecretSecretField = "clientSecret"

	RootCASecretField           = "rootCA"
	OIDCSecretName              = "tigera-oidc-credentials"
	OIDCSecretProviderClassName = "tigera-oidc-credentials"
	OpenshiftSecretName         = "tigera-openshift-credentials"
	LDAPSecretName              = "tigera-ldap-credentials"

	ClientIDSecretField = "clientID"
	BindDNSecretField   = "bindDN"
	BindPWSecretField   = "bindPW"

	// Default claims to use to data from a JWT.
	DefaultGroupsClaim = "groups"
)
View Source
const (
	// OperatorCompleteFinalizer is applied by the core controller as part of Installation defaulting to ensure it can
	// clean up resources if the Installation is ever deleted. This Finalizer is only removed after all operator
	// finalization logic has completed.
	OperatorCompleteFinalizer = "tigera.io/operator-cleanup"

	// APIServerFinalizer is added to the Installation by the API server controller when installing the API server so that
	// Calico CNI resources are not removed until the API server controller has had time to properly tear down pods.
	APIServerFinalizer = "operator.tigera.io/apiserver-controller"

	// InstallationControllerFinalizer is added to the Installation by the core Installation controller when installing Calico
	// so that Calico CNI resources are not removed until calico-kube-controllers has had time to properly be torn down.
	InstallationControllerFinalizer = "operator.tigera.io/installation-controller"

	// WhiskerFinalizer is added to the Installation by the whisker controller when the whisker CR is created so that
	// Calico CNI resources are not removed until the whisker controller has had time to properly delete the whisker deployment.
	WhiskerFinalizer = "operator.tigera.io/whisker-controller"

	// GuardianFinalizer is added to the Installation by the cluster connection controller when the management cluster connection CR
	//  is created so that Calico CNI resources are not removed until the controller has had time to properly delete the guardian deployment.
	GuardianFinalizer = "operator.tigera.io/guardian-controller"

	// GoldmaneFinalizer is added to the Installation by the goldmane controller when the goldmane CR is created so that
	// Calico CNI resources are not removed until the goldmane controller has had time to properly delete the goldmane deployment.
	GoldmaneFinalizer = "operator.tigera.io/goldmane-controller"

	// GatewayAPIFinalizer is added to the Installation by the GatewayAPI controller when installing the Gateway API so that
	// Calico CNI resources are not removed until the GatewayAPI Deployment has had time to properly tear down pods.
	GatewayAPIFinalizer = "operator.tigera.io/gatewayapi-controller"
)
View Source
const (
	GuardianName                   = "guardian"
	GuardianNamespace              = common.CalicoNamespace
	GuardianServiceAccountName     = GuardianName
	GuardianClusterRoleName        = "calico-guardian"
	GuardianClusterRoleBindingName = "calico-guardian"
	GuardianDeploymentName         = GuardianName

	// GuardianContainerName name is the name of the container running guardian. It's named `tigera-guardian`, instead
	// of `guardian` so that the API for the container overrides don't have to change (`tigera-guardian` is a legacy name).
	GuardianContainerName = "tigera-guardian"
	GuardianServiceName   = "guardian"
	GuardianVolumeName    = "guardian-certs"
	GuardianSecretName    = "tigera-managed-cluster-connection"
	GuardianTargetPort    = 8080
	GuardianPolicyName    = networkpolicy.CalicoComponentPolicyPrefix + "guardian-access"
	GuardianKeyPairSecret = "guardian-key-pair"

	GoldmaneDeploymentName         = "goldmane"
	GuardianSecretsRole            = "calico-guardian-secrets"
	GuardianSecretsRoleBindingName = "calico-guardian-secrets"
)

The names of the components related to the Guardian related rendered objects.

View Source
const (
	IntrusionDetectionNamespace = "tigera-intrusion-detection"
	IntrusionDetectionName      = "intrusion-detection-controller"

	ElasticsearchIntrusionDetectionUserSecret    = "tigera-ee-intrusion-detection-elasticsearch-access"
	ElasticsearchIntrusionDetectionJobUserSecret = "tigera-ee-installer-elasticsearch-access"
	ElasticsearchPerformanceHotspotsUserSecret   = "tigera-ee-performance-hotspots-elasticsearch-access"

	IntrusionDetectionInstallerJobName                     = "intrusion-detection-es-job-installer"
	IntrusionDetectionControllerName                       = "intrusion-detection-controller"
	IntrusionDetectionControllerPolicyName                 = networkpolicy.CalicoComponentPolicyPrefix + IntrusionDetectionControllerName
	IntrusionDetectionInstallerPolicyName                  = networkpolicy.CalicoComponentPolicyPrefix + "intrusion-detection-elastic"
	MultiTenantManagedClustersAccessClusterRoleBindingName = "tigera-intrusion-detection-managed-cluster-access"
	IntrusionDetectionManagedClustersWatchRoleBindingName  = "tigera-intrusion-detection-managed-cluster-watch"

	ADAPIObjectName                 = "anomaly-detection-api"
	IntrusionDetectionTLSSecretName = "intrusion-detection-tls"
	DPITLSSecretName                = "deep-packet-inspection-tls"
	ADAPIPolicyName                 = networkpolicy.CalicoComponentPolicyPrefix + ADAPIObjectName

	ADPersistentVolumeClaimName = "tigera-anomaly-detection"
	ADJobPodTemplateBaseName    = "tigera.io.detectors"

	ADDetectorPolicyName = networkpolicy.CalicoComponentPolicyPrefix + adDetectorName
)
View Source
const (
	LogCollectorNamespace = "calico-system"

	// FluentBitNodeName / FluentBitNodeWindowsName are the k8s-app label values of the
	// fluent-bit DaemonSet pods, used to select them as a NetworkPolicy source.
	FluentBitNodeName        = "calico-fluent-bit"
	FluentBitNodeWindowsName = "calico-fluent-bit-windows"

	// FluentBitInputService is the Service fronting fluent-bit's HTTP input, which
	// Manager/Voltron egresses to when forwarding non-cluster-host logs.
	FluentBitInputService = "calico-fluent-bit-http-input"

	EKSLogForwarderName = "eks-log-forwarder"

	// SplunkFluentBitSecretCertificateKey is the key under which the Splunk CA cert is
	// mounted; the shared TrustedBundleVolume below also exposes the trusted bundle at
	// this path, so it lives here alongside that helper.
	SplunkFluentBitSecretCertificateKey = "ca.pem"

	// Linseed token volume mounting constants, shared by several components
	// (compliance, apiserver, intrusion detection, policy recommendation, fluent-bit).
	LinseedTokenVolumeName = "linseed-token"
	LinseedTokenKey        = "token"
	LinseedTokenSubPath    = "token"
	LinseedTokenSecret     = "%s-tigera-linseed-token"
	LinseedVolumeMountPath = "/var/run/secrets/tigera.io/linseed/"
	LinseedTokenPath       = "/var/run/secrets/tigera.io/linseed/token"
)
View Source
const (
	ElasticsearchObjectName = "tigera-elasticsearch"
	ElasticsearchNamespace  = ElasticsearchObjectName

	// TigeraLinseedSecret is the name of the secret that holds the TLS key pair mounted into Linseed.
	// The secret contains server key and certificate.
	TigeraLinseedSecret = "tigera-secure-linseed-cert"

	// TigeraLinseedSecretsClusterRole is the name of the ClusterRole used to make RoleBindings in namespaces where Linseed
	// needs to be able to manipulate secrets
	TigeraLinseedSecretsClusterRole = "tigera-linseed-secrets"

	// TigeraLinseedTokenSecret is the name of the secret that holds the access token signing key for Linseed.
	TigeraLinseedTokenSecret = "tigera-secure-linseed-token-tls"

	// TigeraElasticsearchGatewaySecret is the TLS key pair that is mounted by Elasticsearch gateway.
	TigeraElasticsearchGatewaySecret = "tigera-secure-elasticsearch-cert"

	// TigeraElasticsearchInternalCertSecret is the TLS key pair that is mounted by the Elasticsearch pods.
	TigeraElasticsearchInternalCertSecret = "tigera-secure-internal-elasticsearch-cert"

	// Linseed vars.
	LinseedServiceName = "tigera-linseed"

	ElasticsearchName               = "tigera-secure"
	ElasticsearchServiceName        = "tigera-secure-es-http"
	ESGatewayServiceName            = "tigera-secure-es-gateway-http"
	ElasticsearchDefaultPort        = 9200
	ElasticsearchInternalPort       = 9300
	ElasticsearchAdminUserSecret    = "tigera-secure-es-elastic-user"
	ElasticsearchLinseedUserSecret  = "tigera-ee-linseed-elasticsearch-user-secret"
	ElasticsearchPolicyName         = networkpolicy.CalicoComponentPolicyPrefix + "elasticsearch-access"
	ElasticsearchInternalPolicyName = networkpolicy.CalicoComponentPolicyPrefix + "elasticsearch-internal"

	KibanaBasePath = "tigera-kibana"

	DefaultElasticsearchClusterName = "cluster"
	DefaultElasticsearchReplicas    = 0
	DefaultElasticStorageGi         = 10

	ESCuratorName                  = "elastic-curator"
	EsCuratorServiceAccount        = "tigera-elastic-curator"
	EsCuratorPolicyName            = networkpolicy.CalicoComponentPolicyPrefix + "allow-elastic-curator"
	ElasticsearchCuratorUserSecret = "tigera-ee-curator-elasticsearch-access"

	OIDCUsersConfigMapName = "tigera-known-oidc-users"
	OIDCUsersESSecretName  = "tigera-oidc-users-elasticsearch-credentials"

	ElasticsearchLicenseTypeBasic           ElasticsearchLicenseType = "basic"
	ElasticsearchLicenseTypeEnterprise      ElasticsearchLicenseType = "enterprise"
	ElasticsearchLicenseTypeEnterpriseTrial ElasticsearchLicenseType = "enterprise_trial"
	ElasticsearchLicenseTypeUnknown         ElasticsearchLicenseType = ""

	EsManagerRole        = "es-manager"
	EsManagerRoleBinding = "es-manager"

	CalicoKubeControllerSecret = "calico-kube-controller-secrets"

	ElasticsearchTLSHashAnnotation = "hash.operator.tigera.io/es-secrets"
)
View Source
const (
	// Volume that is added by ECK and is overridden if certificate management is used.
	CSRVolumeNameHTTP = "elastic-internal-http-certificates"
	// Volume that is added by ECK and is overridden if certificate management is used.
	CSRVolumeNameTransport = "elastic-internal-transport-certificates"
	// Volume name that is added by ECK for the purpose of mounting certs.
	CAVolumeName = "elasticsearch-certs"
)

Certificate management constants.

View Source
const (
	ManagerPort = 9443

	ManagerServiceName          = "calico-manager"
	LegacyManagerServiceName    = "tigera-manager"
	ManagerDeploymentName       = "calico-manager"
	LegacyManagerDeploymentName = "tigera-manager"
	ManagerNamespace            = common.CalicoNamespace
	LegacyManagerNamespace      = "tigera-manager"
	ManagerServiceAccount       = "calico-manager"
	LegacyManagerServiceAccount = "tigera-manager"

	// Default manager RBAC resources.
	ManagerClusterRole              = "calico-manager-role"
	LegacyManagerClusterRole        = "tigera-manager-role"
	ManagerClusterRoleBinding       = "calico-manager-binding"
	LegacyManagerClusterRoleBinding = "tigera-manager-binding"

	// Manager RBAC resources for Calico managed clusters.
	ManagerManagedCalicoClusterRole              = "calico-manager-managed-calico"
	LegacyManagerManagedCalicoClusterRole        = "tigera-manager-managed-calico"
	ManagerManagedCalicoClusterRoleBinding       = "calico-manager-managed-calico"
	LegacyManagerManagedCalicoClusterRoleBinding = "tigera-manager-managed-calico"

	ManagerTLSSecretName         = "manager-tls"
	ManagerInternalTLSSecretName = "internal-manager-tls"
	ManagerPolicyName            = networkpolicy.CalicoComponentPolicyPrefix + "manager-access"
	ManagerPortName              = "https"

	// The name of the TLS certificate used by Voltron to authenticate connections from managed
	// cluster clients talking to Linseed.
	VoltronLinseedTLS              = "calico-voltron-linseed-tls"
	VoltronLinseedPublicCert       = "calico-voltron-linseed-certs-public"
	LegacyVoltronLinseedPublicCert = "tigera-voltron-linseed-certs-public"

	ManagerClusterSettings            = "cluster-settings"
	ManagerUserSettings               = "user-settings"
	ManagerClusterSettingsLayerTigera = "cluster-settings.layer.tigera-infrastructure"
	ManagerClusterSettingsViewDefault = "cluster-settings.view.default"

	ElasticsearchUserHashAnnotation                                     = "hash.operator.tigera.io/elasticsearch-user"
	ManagerMultiTenantManagedClustersAccessClusterRoleBindingName       = "calico-manager-managed-cluster-access"
	LegacyManagerMultiTenantManagedClustersAccessClusterRoleBindingName = "tigera-manager-managed-cluster-access"
	ManagerManagedClustersWatchRoleBindingName                          = "calico-manager-managed-cluster-watch"
	LegacyManagerManagedClustersWatchRoleBindingName                    = "tigera-manager-managed-cluster-watch"
	ManagerManagedClustersUpdateRBACName                                = "calico-manager-managed-cluster-write-access"
	LegacyManagerManagedClustersUpdateRBACName                          = "tigera-manager-managed-cluster-write-access"
)
View Source
const (
	ManagerName             = "calico-manager"
	UIAPIsName              = "calico-ui-apis"
	VoltronName             = "calico-voltron"
	VoltronTunnelSecretName = "calico-management-cluster-connection"

	DashboardAPIPort       = "8444"
	DashboardAPIHealthPort = "8090"
	DashboardAPIName       = "calico-dashboard-api"

	// VoltronAdditionalTunnelSecretName is the name of an optional, pre-provisioned secret
	// in the truth namespace that holds an additional CA used by Voltron for tunnel server
	// certificates. When the secret is present the manager controller wires it into the
	// Voltron deployment. It is managed out-of-band; the operator only consumes it.
	VoltronAdditionalTunnelSecretName = "calico-management-additional-cluster-connection"
)

ManagementClusterConnection configuration constants

View Source
const (
	PSSPrivileged = "privileged"
	PSSBaseline   = "baseline"
	PSSRestricted = "restricted"
)
View Source
const (
	BirdTemplatesConfigMapName = "bird-templates"

	BPFOperatorAnnotation = "operator.tigera.io/bpfEnabled"

	DisableKubeProxyKey = "operator.tigera.io/disable-kube-proxy"

	BGPLayoutConfigMapName      = "bgp-layout"
	BGPLayoutConfigMapKey       = "earlyNetworkConfiguration"
	BGPLayoutVolumeName         = "bgp-layout"
	BGPLayoutPath               = "/etc/calico/early-networking.yaml"
	K8sSvcEndpointConfigMapName = "kubernetes-services-endpoint"

	CNIFinalizer = "tigera.io/cni-protector"

	CalicoNodeMetricsService      = "calico-node-metrics"
	NodePrometheusTLSServerSecret = "calico-node-prometheus-server-tls"
	CalicoNodeObjectName          = "calico-node"
	CalicoCNIPluginObjectName     = "calico-cni-plugin"
	BPFVolumeName                 = "bpffs"

	InstallCNIContainerName = "install-cni"
)
View Source
const (
	PacketCaptureContainerName          = "tigera-packetcapture-server"
	PacketCaptureName                   = "tigera-packetcapture"
	PacketCaptureNamespace              = PacketCaptureName
	PacketCaptureServiceAccountName     = PacketCaptureName
	PacketCaptureClusterRoleName        = PacketCaptureName
	PacketCaptureClusterRoleBindingName = PacketCaptureName
	// PacketCapturePodExecRole/Binding grant the PacketCapture API pod/exec
	// access in the calico-system namespace. These keep their historical names
	// (previously rendered by the log-collector component) so the move to this
	// component adopts the existing objects in place.
	PacketCapturePodExecRoleName        = "packetcapture-api-role"
	PacketCapturePodExecRoleBindingName = "packetcapture-api-role-binding"
	PacketCaptureDeploymentName         = PacketCaptureName
	PacketCaptureServiceName            = PacketCaptureName
	PacketCapturePolicyName             = networkpolicy.CalicoComponentPolicyPrefix + PacketCaptureName
	PacketCapturePort                   = 8444
	PacketCaptureServerCert             = "tigera-packetcapture-server-tls"
)

The names of the components related to the PacketCapture APIs related rendered objects.

View Source
const (
	ElasticsearchPolicyRecommendationUserSecret = "tigera-ee-policy-recommendation-elasticsearch-access"

	PolicyRecommendationName       = "tigera-policy-recommendation"
	PolicyRecommendationNamespace  = common.CalicoNamespace
	PolicyRecommendationPolicyName = networkpolicy.CalicoComponentPolicyPrefix + PolicyRecommendationName

	PolicyRecommendationTLSSecretName                                   = "policy-recommendation-tls"
	PolicyRecommendationMultiTenantManagedClustersAccessRoleBindingName = "tigera-policy-recommendation-managed-cluster-access"
	PolicyRecommendationManagedClustersWatchRoleBindingName             = "tigera-policy-recommendation-managed-cluster-watch"
)

The names of the components related to the PolicyRecommendation APIs related rendered objects.

View Source
const (
	TyphaServiceName              = "calico-typha"
	TyphaPortName                 = "calico-typha"
	TyphaK8sAppName               = "calico-typha"
	TyphaServiceAccountName       = "calico-typha"
	AppLabelName                  = "k8s-app"
	TyphaPort               int32 = 5473
	TyphaMetricsName              = "calico-typha-metrics"

	TyphaContainerName = "calico-typha"

	TyphaClusterRoleName = "calico-typha"

	TyphaNonClusterHostSuffix            = "-noncluster-host"
	TyphaNonClusterHostNetworkPolicyName = networkpolicy.CalicoComponentPolicyPrefix + "typha-noncluster-host-access"
)
View Source
const (
	WindowsNodeObjectName     = "calico-node-windows"
	WindowsNodeMetricsService = "calico-node-metrics-windows"

	WindowsInstallCNIContainerName = "install-cni"
	WindowsNodeContainerName       = "node"
	WindowsFelixContainerName      = "felix"
	WindowsConfdContainerName      = "confd"
)
View Source
const TigeraAWSSGSetupName = "tigera-aws-security-group-setup"
View Source
const (
	TigeraOperatorSecrets = "tigera-operator-secrets"
)

Variables

View Source
var (
	ElasticsearchSelector   = fmt.Sprintf("elasticsearch.k8s.elastic.co/cluster-name == '%s'", ElasticsearchName)
	ElasticsearchEntityRule = v3.EntityRule{
		NamespaceSelector: fmt.Sprintf("kubernetes.io/metadata.name == '%s'", ElasticsearchNamespace),
		Selector:          ElasticsearchSelector,
		Ports:             []numorstring.Port{{MinPort: ElasticsearchDefaultPort, MaxPort: ElasticsearchDefaultPort}},
	}
)
View Source
var (
	SourceKibanaEntityRule      = networkpolicy.CreateSourceEntityRule("tigera-kibana", "tigera-secure")
	ECKOperatorSourceEntityRule = networkpolicy.CreateSourceEntityRule("tigera-eck-operator", "elastic-operator")
)
View Source
var (
	// NodeBGPReporterPort is the port used by calico/node to report Calico Enterprise BGP metrics.
	// This is currently not intended to be user configurable.
	NodeBGPReporterPort int32 = 9900

	NodeTLSSecretName               = "node-certs"
	NodeTLSSecretNameNonClusterHost = NodeTLSSecretName + TyphaNonClusterHostSuffix
)
View Source
var (
	CommonName               = "common-name"
	URISAN                   = "uri-san"
	TyphaCommonName          = "typha-server"
	FelixCommonName          = "typha-client"
	NodePriorityClassName    = "system-node-critical"
	ClusterPriorityClassName = "system-cluster-critical"
)
View Source
var (
	TyphaTLSSecretName               = "typha-certs"
	TyphaTLSSecretNameNonClusterHost = TyphaTLSSecretName + TyphaNonClusterHostSuffix

	TyphaCAConfigMapName = "typha-ca"
	TyphaCABundleName    = "caBundle"
)

EKSLogForwarderEntityRule selects the EKS log-forwarder pods as a NetworkPolicy source.

View Source
var FluentBitSourceEntityRule = v3.EntityRule{
	NamespaceSelector: fmt.Sprintf("name == '%s'", LogCollectorNamespace),
	Selector:          networkpolicy.KubernetesAppSelector(FluentBitNodeName, FluentBitNodeWindowsName),
}

FluentBitSourceEntityRule selects the fluent-bit pods as a NetworkPolicy source.

View Source
var InternalElasticsearchEntityRule = v3.EntityRule{
	NamespaceSelector: fmt.Sprintf("kubernetes.io/metadata.name == '%s'", ElasticsearchNamespace),
	Selector:          ElasticsearchSelector,
	Ports:             []numorstring.Port{{MinPort: ElasticsearchInternalPort, MaxPort: ElasticsearchInternalPort}},
}
View Source
var IntrusionDetectionInstallerSourceEntityRule = v3.EntityRule{
	NamespaceSelector: intrusionDetectionNamespaceSelector,
	Selector:          fmt.Sprintf("job-name == '%s'", IntrusionDetectionInstallerJobName),
}
View Source
var (
	IntrusionDetectionSourceEntityRule = v3.EntityRule{
		NamespaceSelector: intrusionDetectionNamespaceSelector,
		Selector:          fmt.Sprintf("k8s-app == '%s'", IntrusionDetectionControllerName),
	}
)

Register secret/certs that need Server and Client Key usage

View Source
var (
	TigeraAPIServerEntityRule = v3.EntityRule{
		Services: &v3.ServiceMatch{
			Namespace: QueryserverNamespace,
			Name:      QueryserverServiceName,
		},
	}
)
View Source
var WindowsNodeContainerNames = []string{
	WindowsNodeContainerName,
	WindowsFelixContainerName,
}

WindowsNodeContainerNames are the calico-node-windows containers that always render. Confd is gated on BGP, so callers add it separately.

Functions

func APIServerDeploymentObjectMeta

func APIServerDeploymentObjectMeta() []client.Object

APIServerDeploymentObjectMeta returns empty-shell copies of the API server Deployment and its supporting objects, identifying them by name/kind/namespace. The base queues these for deletion when it isn't running an aggregation API server; a variant modifier matches against them to pull them back out of the delete list when it renders the deployment skeleton itself.

func APIServerDeploymentObjects

func APIServerDeploymentObjects(cfg *APIServerConfiguration, calicoImage string) []client.Object

APIServerDeploymentObjects returns the API server Deployment and its supporting objects (ServiceAccount, Service, PodDisruptionBudget). The base renders these when running an aggregation API server; a variant modifier renders them itself when it needs the deployment but the base did not (e.g. a query-server-only deployment in v3-CRD mode). calicoImage is the resolved image for any base containers.

func CNIPluginFinalizedObjects added in v1.34.1

func CNIPluginFinalizedObjects() []client.Object

CNIPluginFinalizedObjects returns a list of objects that use the CNIFinalizer that should be removed only after the CNI plugin is removed.

func Container

func Container(spec *corev1.PodSpec, name string) (*corev1.Container, bool)

Container returns the named container in spec, init containers included. The returned pointer aliases spec. Use it for containers a component only renders under some configurations; for the rest, use MustContainer.

func CreateCertificateConfigMap added in v1.25.1

func CreateCertificateConfigMap(caPem string, secretName string, namespace string) *corev1.ConfigMap

CreateCertificateConfigMap is a convenience method for creating a configmap that contains only a ca or cert to trust.

func CreateCertificateSecret added in v1.18.0

func CreateCertificateSecret(caPem []byte, secretName string, namespace string) *corev1.Secret

CreateCertificateSecret is a convenience method for creating a secret that contains only a ca or cert to trust.

func CreateNamespace added in v1.22.0

func CreateNamespace(name string, provider operatorv1.Provider, pss PodSecurityStandard, azure *operatorv1.Azure) *corev1.Namespace

func CreateOperatorSecretsRoleBinding added in v1.37.0

func CreateOperatorSecretsRoleBinding(namespace string) *rbacv1.RoleBinding

CreateOperatorSecretsRoleBinding binds the tigera-operator-secrets ClusterRole to the operator's ServiceAccount in the given namespace, granting permission to manipulate secrets.

func DefaultCNIDirectories added in v1.39.0

func DefaultCNIDirectories(provider operatorv1.Provider) (string, string)

DefaultCNIDirectories returns the binary and network config directories for the configured platform.

func DefaultWindowsCNIDirectories added in v1.32.0

func DefaultWindowsCNIDirectories(installation operatorv1.InstallationSpec) (string, string, string)

DefaultWindowsCNIDirectories returns the CNI binary, network config and log directories and the CNI conf filename for the configured platform. FIXME: populate with known default for other providers

func ExtractExtensionData

func ExtractExtensionData[T any](ri Inputs) T

ExtractExtensionData returns the Extension slot asserted to T, or the zero value of T when it is empty or holds a different type.

func GetIPv4Pool added in v1.2.0

func GetIPv4Pool(pools []operatorv1.IPPool) *operatorv1.IPPool

GetIPv4Pool returns the IPv4 IPPool in an installation, or nil if one can't be found.

func GetIPv6Pool added in v1.2.0

func GetIPv6Pool(pools []operatorv1.IPPool) *operatorv1.IPPool

GetIPv6Pool returns the IPv6 IPPool in an installation, or nil if one can't be found.

func GetLinseedTokenPath added in v1.30.0

func GetLinseedTokenPath(managedCluster bool) string

func GuardianService added in v1.38.0

func GuardianService(clusterDomain string) string

func HostNetwork

func HostNetwork(cfg *APIServerConfiguration) bool

HostNetwork reports whether the API server deployment runs on the host network, accounting for both the forced setting and the provider-driven requirement.

func HostNetworkRequired added in v1.42.0

func HostNetworkRequired(installation *operatorv1.InstallationSpec) bool

func JoinServiceEndpoints added in v1.40.0

func JoinServiceEndpoints(endpoints []k8sapi.ServiceEndpoint) string

JoinServiceEndpoints joins a list of ServiceEndpoint into a comma-separated string of ip:port.

func LinseedNamespace added in v1.33.0

func LinseedNamespace(tenant *operatorv1.Tenant) string

LinseedNamespace determine the namespace in which Linseed is running. For management and standalone clusters, this is always the tigera-elasticsearch namespace. For multi-tenant management clusters, this is the tenant namespace

func ManagerClusterWideDefaultView

func ManagerClusterWideDefaultView() *v3.UISettings

ManagerClusterWideDefaultView returns a UISettings view belonging to the cluster-wide settings group that shows everything and uses the tigera-infrastructure layer.

Calico Enterprise only

func ManagerClusterWideSettingsGroup

func ManagerClusterWideSettingsGroup() *v3.UISettingsGroup

ManagerClusterWideSettingsGroup returns a UISettingsGroup with the description "cluster-wide settings"

Calico Enterprise only

func ManagerClusterWideTigeraLayer

func ManagerClusterWideTigeraLayer() *v3.UISettings

ManagerClusterWideTigeraLayer returns a UISettings layer belonging to the cluster-wide settings group that contains all of the tigera namespaces.

Calico Enterprise only

func ManagerService added in v1.33.0

func ManagerService(tenant *operatorv1.Tenant) string

ManagerService determine the name of the calico manager service. For management and standalone clusters, this is always the calico-manager.calico-system namespace. For multi-tenant management clusters, this is a service that resides within the tenant namespace

func ManagerUserSpecificSettingsGroup

func ManagerUserSpecificSettingsGroup() *v3.UISettingsGroup

ManagerUserSpecificSettingsGroup returns a UISettingsGroup with the description "user settings"

Calico Enterprise only

func MustContainer

func MustContainer(spec *corev1.PodSpec, name string) *corev1.Container

MustContainer returns the named container, panicking if it is absent. A modifier asking for a container that is always rendered and not finding one means render and the modifier have drifted apart, which no caller can recover from.

func MustContainers

func MustContainers(spec *corev1.PodSpec, names ...string) []*corev1.Container

MustContainers returns the named containers, panicking if any is absent.

func NewDexKeyValidatorConfig added in v1.12.0

func NewDexKeyValidatorConfig(
	authentication *oprv1.Authentication,
	clusterDomain string) authentication.KeyValidatorConfig

func ProcessPodProxies added in v1.35.3

func ProcessPodProxies(podProxies []*httpproxy.Config) []*httpproxy.Config

func SetClusterCriticalPod added in v1.22.0

func SetClusterCriticalPod(t *corev1.PodTemplateSpec)

func SetNodeCriticalPod

func SetNodeCriticalPod(t *corev1.PodTemplateSpec)

func SetTestLogger

func SetTestLogger(l logr.Logger)

func TrustedBundleVolume

func TrustedBundleVolume(bundle certificatemanagement.TrustedBundle) corev1.Volume

TrustedBundleVolume mounts the trusted CA bundle under the standard name plus a few legacy/compatibility paths (including the Elastic and Splunk cert keys). It is shared by Dex and the log-collector components.

func TunnelSecretName added in v1.42.0

func TunnelSecretName(mc *operatorv1.ManagementCluster) string

TunnelSecretName returns the name of the tunnel CA secret based on the ManagementCluster spec. If the ManagementCluster has a custom TLS secret name configured, that is returned; otherwise the default VoltronTunnelSecretName is used.

func TunnelSecretRBAC added in v1.42.0

func TunnelSecretRBAC(rbacName string, serviceAccountName string, mc *operatorv1.ManagementCluster, multiTenant bool) []client.Object

TunnelSecretRBAC returns RBAC objects granting get access to the tunnel CA secret. For multi-tenant management clusters, this returns a ClusterRole/ClusterRoleBinding so the service account can read per-tenant secrets across namespaces. For single-tenant clusters, this returns a namespace-scoped Role/RoleBinding in calico-system.

Types

type APIServerComponent

type APIServerComponent interface {
	Component
	APIServerConfig() *APIServerConfiguration
}

A component that exposes an extension point hands a variant the config it rendered from. The accessor names differ per component, so an unrelated one can't match.

type APIServerConfiguration added in v1.25.0

type APIServerConfiguration struct {
	K8SServiceEndpoint           k8sapi.ServiceEndpoint
	K8SServiceEndpointPodNetwork k8sapi.ServiceEndpoint
	Installation                 *operatorv1.InstallationSpec
	APIServer                    *operatorv1.APIServerSpec
	ForceHostNetwork             bool
	TLSKeyPair                   certificatemanagement.KeyPairInterface
	PullSecrets                  []*corev1.Secret
	OpenShift                    bool
	TrustedBundle                certificatemanagement.TrustedBundle
	MultiTenant                  bool
	KubernetesVersion            *common.VersionInfo
	ClusterDomain                string

	// Whether or not we should run the aggregation API server for projectcalico.org/v3 APIs
	// as part of this component.
	RequiresAggregationServer bool

	// HoldAPIServiceCutover leaves the previous API server in service, so its
	// APIService and the resources it needs are left alone.
	HoldAPIServiceCutover bool
}

APIServerConfiguration contains all the config information needed to render the component.

type APIServerPolicyComponent

type APIServerPolicyComponent interface {
	Component
	APIServerPolicyConfig() *APIServerConfiguration
}

A component that exposes an extension point hands a variant the config it rendered from. The accessor names differ per component, so an unrelated one can't match.

type AWSSGSetupConfiguration added in v1.25.0

type AWSSGSetupConfiguration struct {
	PullSecrets     []corev1.LocalObjectReference
	Installation    *operatorv1.InstallationSpec
	HostedOpenShift bool
}

AWSSGSetupConfiguration contains all the config information needed to render the component.

type CSIConfiguration added in v1.28.0

type CSIConfiguration struct {
	Installation *operatorv1.InstallationSpec
	Terminating  bool
	OpenShift    bool
}

type Component

type Component interface {
	// ResolveImages should call components.GetReference for all images that the Component
	// needs, passing 'is' to the GetReference call and if there are any errors those
	// are returned. It is valid to pass nil for 'is' as GetReference accepts the value.
	// ResolveImages must be called before Objects is called for the component.
	ResolveImages(is *operatorv1.ImageSet) error

	// Objects returns the lists of objects in this component that should be created and/or deleted during
	// rendering.
	Objects() (objsToCreate, objsToDelete []client.Object)

	// Ready returns true if the component is ready to be created.
	Ready() bool

	// SupportedOSTypes returns operating systems that is supported of the components returned by the Objects() function.
	// The "componentHandler" converts the returned OSTypes to a node selectors for the "kubernetes.io/os" label on client.Objects
	// that create pods. Return OSTypeAny means that no node selector should be set for the "kubernetes.io/os" label.
	SupportedOSType() rmeta.OSType
}

func APIServer

func APIServer(cfg *APIServerConfiguration) (Component, error)

func APIServerPolicy added in v1.28.0

func APIServerPolicy(cfg *APIServerConfiguration) Component

func AWSSecurityGroupSetup added in v1.0.0

func AWSSecurityGroupSetup(cfg *AWSSGSetupConfiguration) (Component, error)

func CSI added in v1.28.0

func CSI(cfg *CSIConfiguration) Component

func Dex added in v1.12.0

func Guardian added in v1.2.0

func Guardian(cfg *GuardianConfiguration) Component

func GuardianPolicy added in v1.28.0

func GuardianPolicy(cfg *GuardianConfiguration) (Component, error)

GuardianPolicy renders the OSS guardian network policy. A variant may replace it with its own. The error return is always nil, and is kept for callers.

func IntrusionDetection

func IntrusionDetection(cfg *IntrusionDetectionConfiguration) Component

func LogStorage added in v1.4.0

func LogStorage(cfg *ElasticsearchConfiguration) Component

LogStorage renders the components necessary for kibana and elasticsearch

func Manager added in v1.0.0

func Manager(cfg *ManagerConfiguration) (Component, error)

Manager returns a component for rendering namespaced manager resources.

func Namespaces

func Namespaces(cfg *NamespaceConfiguration) Component

func NewCreationPassthrough added in v1.42.0

func NewCreationPassthrough(objs ...client.Object) Component

func NewCreationPassthroughWithLog added in v1.42.0

func NewCreationPassthroughWithLog(l logr.Logger, objs ...client.Object) Component

func NewDeletionPassthrough added in v1.29.1

func NewDeletionPassthrough(objs ...client.Object) Component

func NewManagedClusterLogStorage added in v1.32.0

func NewManagedClusterLogStorage(cfg *ManagedClusterLogStorageConfiguration) Component

NewManagedClusterLogStorage returns a component for managed cluster log storage resources.

func NewPassthrough added in v1.22.0

func NewPassthrough(objsToCreate, objsToDelete []client.Object) Component

func NewSetup added in v1.40.0

func NewSetup(cfg *SetUpConfiguration) Component

func NewTyphaNonClusterHostPolicy added in v1.38.0

func NewTyphaNonClusterHostPolicy(cfg *TyphaConfiguration) Component

func Node

func Node(cfg *NodeConfiguration) Component

Node creates the node daemonset and other resources for the daemonset to operate normally.

func PacketCaptureAPI added in v1.21.0

func PacketCaptureAPI(cfg *PacketCaptureApiConfiguration) Component

func PacketCaptureAPIPolicy added in v1.28.0

func PacketCaptureAPIPolicy(cfg *PacketCaptureApiConfiguration) Component

func PolicyRecommendation added in v1.30.0

func PolicyRecommendation(cfg *PolicyRecommendationConfiguration) Component

func Typha added in v1.0.0

func Typha(cfg *TyphaConfiguration) Component

Typha creates the typha daemonset and other resources for the daemonset to operate normally.

func Windows added in v1.23.0

func Windows(
	cfg *WindowsConfiguration,
) Component

type DexComponentConfiguration added in v1.25.0

type DexComponentConfiguration struct {
	PullSecrets   []*corev1.Secret
	OpenShift     bool
	Installation  *operatorv1.InstallationSpec
	DexConfig     DexConfig
	ClusterDomain string
	DeleteDex     bool
	TLSKeyPair    certificatemanagement.KeyPairInterface
	TrustedBundle certificatemanagement.TrustedBundle

	// TigeraCAKeyPair is the operator CA keypair (backed by tigera-ca-private). Its certificate is
	// copied into the tigera-ca-public Secret when the OpenShift IDP is configured.
	TigeraCAKeyPair certificatemanagement.KeyPairInterface

	Authentication *operatorv1.Authentication

	// PodProxies represents the resolved proxy configuration for each Dex pod.
	// If this slice is empty, then resolution has not yet occurred. Pods with no proxy
	// configured are represented with a nil value.
	PodProxies []*httpproxy.Config
}

DexComponentConfiguration contains all the config information needed to render the component.

type DexConfig added in v1.12.0

type DexConfig interface {
	// Connector returns the dex connector configuration block.
	Connector() map[string]interface{}
	// RedirectURIs returns the list of redirect URIs for the dex static client.
	RedirectURIs() []string
	// Issuer returns the issuer URL for dex.
	Issuer() string
	// RequiredEnv returns env variables required by the dex deployment.
	RequiredEnv(prefix string) []corev1.EnvVar
	// RequiredAnnotations returns pod annotations required by the dex deployment.
	RequiredAnnotations() map[string]string
	// RequiredSecrets returns secrets required by the dex deployment in the given namespace.
	RequiredSecrets(namespace string) []*corev1.Secret
	// RequiredVolumeMounts returns volume mounts required by the dex deployment.
	RequiredVolumeMounts() []corev1.VolumeMount
	// RequiredVolumes returns volumes required by the dex deployment.
	RequiredVolumes() []corev1.Volume
	// RequiredSecretProviderClass returns SecretProviderClass objects required by the dex deployment.
	RequiredSecretProviderClass(namespace string) []*csisecret.SecretProviderClass
}

DexConfig is a config for DexIdP itself.

func NewDexConfig added in v1.12.0

func NewDexConfig(
	certificateManagement *oprv1.CertificateManagement,
	authentication *oprv1.Authentication,
	idpSecret *corev1.Secret,
	secretProviderClass *csisecret.SecretProviderClass,
	clusterDomain string) DexConfig

Create a new DexConfig.

type DexKeyValidatorConfig added in v1.12.0

type DexKeyValidatorConfig struct {
	// contains filtered or unexported fields
}

func (*DexKeyValidatorConfig) BaseURL added in v1.18.0

func (d *DexKeyValidatorConfig) BaseURL() string

func (*DexKeyValidatorConfig) ClientID added in v1.18.0

func (d *DexKeyValidatorConfig) ClientID() string

func (*DexKeyValidatorConfig) Issuer added in v1.18.0

func (d *DexKeyValidatorConfig) Issuer() string

func (*DexKeyValidatorConfig) RequiredAnnotations added in v1.12.0

func (d *DexKeyValidatorConfig) RequiredAnnotations() map[string]string

RequiredAnnotations returns the annotations that are relevant for a validator config.

func (*DexKeyValidatorConfig) RequiredConfigMaps added in v1.18.0

func (d *DexKeyValidatorConfig) RequiredConfigMaps(string) []*corev1.ConfigMap

func (*DexKeyValidatorConfig) RequiredEnv added in v1.12.0

func (d *DexKeyValidatorConfig) RequiredEnv(prefix string) []corev1.EnvVar

Append variables that are necessary for using the dex authenticator.

func (*DexKeyValidatorConfig) RequiredSecrets added in v1.12.0

func (d *DexKeyValidatorConfig) RequiredSecrets(namespace string) []*corev1.Secret

func (*DexKeyValidatorConfig) RequiredVolumeMounts added in v1.12.0

func (d *DexKeyValidatorConfig) RequiredVolumeMounts() []corev1.VolumeMount

func (*DexKeyValidatorConfig) RequiredVolumes added in v1.12.0

func (d *DexKeyValidatorConfig) RequiredVolumes() []corev1.Volume

func (*DexKeyValidatorConfig) UsernameClaim added in v1.18.0

func (d *DexKeyValidatorConfig) UsernameClaim() string

type ElasticsearchConfiguration added in v1.25.0

type ElasticsearchConfiguration struct {
	LogStorage              *operatorv1.LogStorage
	Installation            *operatorv1.InstallationSpec
	ManagementCluster       *operatorv1.ManagementCluster
	Elasticsearch           *esv1.Elasticsearch
	ClusterConfig           *relasticsearch.ClusterConfig
	ElasticsearchUserSecret *corev1.Secret
	ElasticsearchKeyPair    certificatemanagement.KeyPairInterface
	PullSecrets             []*corev1.Secret
	Provider                operatorv1.Provider
	CuratorSecrets          []*corev1.Secret
	ESService               *corev1.Service
	ClusterDomain           string
	ElasticLicenseType      ElasticsearchLicenseType
	TrustedBundle           certificatemanagement.TrustedBundleRO
	UnusedTLSSecret         *corev1.Secret
}

ElasticsearchConfiguration contains all the config information needed to render the component.

type ElasticsearchLicenseType added in v1.14.0

type ElasticsearchLicenseType string

type GuardianComponent added in v1.2.0

type GuardianComponent interface {
	Component
	GuardianConfig() *GuardianConfiguration
}

A component that exposes an extension point hands a variant the config it rendered from. The accessor names differ per component, so an unrelated one can't match.

type GuardianConfiguration added in v1.25.0

type GuardianConfiguration struct {
	URL                         string
	PullSecrets                 []*corev1.Secret
	OpenShift                   bool
	Installation                *operatorv1.InstallationSpec
	TunnelSecret                *corev1.Secret
	TrustedCertBundle           certificatemanagement.TrustedBundleRO
	TunnelCAType                operatorv1.CAType
	ManagementClusterConnection *operatorv1.ManagementClusterConnection
	IncludeEgressNetworkPolicy  bool

	// PodProxies represents the resolved proxy configuration for each Guardian pod.
	// If this slice is empty, then resolution has not yet occurred. Pods with no proxy
	// configured are represented with a nil value.
	PodProxies []*httpproxy.Config

	GuardianClientKeyPair certificatemanagement.KeyPairInterface

	// Version stores the version of the cluster, as reported by the ClusterInformation object. It is used to restart
	// guardian when the version changes, which triggers the management cluster to re-check for version skew.
	Version string
}

GuardianConfiguration contains all the config information needed to render the component.

type GuardianPolicyComponent

type GuardianPolicyComponent interface {
	Component
	GuardianPolicyConfig() *GuardianConfiguration
}

A component that exposes an extension point hands a variant the config it rendered from. The accessor names differ per component, so an unrelated one can't match.

type GuardianRenderData

type GuardianRenderData struct {
	// Version is the managed cluster version reported by ClusterInformation
	// (CNXVersion for Enterprise, CalicoVersion for the OSS default).
	Version string

	// IncludeEgressNetworkPolicy enables the domain-based egress rules in the
	// Guardian policy, gated on an Enterprise license feature.
	IncludeEgressNetworkPolicy bool
}

GuardianRenderData is the variant-specific Guardian input a controller extension computes during reconcile and stashes in Inputs.Extension. The clusterconnection controller reads it back to fill GuardianConfiguration without depending on the extension: when present it carries the enterprise values (the management-cluster version and the license-gated egress policy flag) and signals that the controller should not create the OSS Guardian client keypair. It lives in render so the controller can read it generically.

func GuardianRenderDataFromInputs

func GuardianRenderDataFromInputs(ri Inputs) (GuardianRenderData, bool)

GuardianRenderDataFromInputs returns the GuardianRenderData a controller extension stashed in the render inputs, and whether it was present. Absent means the OSS path: the controller applies its own defaults.

type Inputs

type Inputs struct {
	Installation       *operatorv1.InstallationSpec
	FelixConfiguration *v3.FelixConfiguration
	ClusterDomain      string

	// TrustedBundle is the shared CA bundle for the calico-system namespace.
	TrustedBundle certificatemanagement.TrustedBundle

	// Extension is opaque data the controller extension produced, usually an artifact
	// that can only be created controller-side because it has cluster side effects
	// (a keypair, say). Where a controller needs to read it back, the payload is a
	// render type so it does not depend on the extension. Nil when none is active.
	Extension any
}

Inputs is the raw cluster state a controller gathered, carried into render modifiers. Only modifiers read it; core operator code never does.

Per-component config is not carried here. A modifier is handed the same typed config the core operator rendered the component from.

type IntrusionDetectionConfiguration added in v1.25.0

type IntrusionDetectionConfiguration struct {
	IntrusionDetection        *operatorv1.IntrusionDetection
	LogCollector              *operatorv1.LogCollector
	Installation              *operatorv1.InstallationSpec
	PullSecrets               []*corev1.Secret
	OpenShift                 bool
	ClusterDomain             string
	ESLicenseType             ElasticsearchLicenseType
	ManagedCluster            bool
	ManagementCluster         bool
	SyslogForwardingIsEnabled bool

	HasNoLicense                 bool
	TrustedCertBundle            certificatemanagement.TrustedBundleRO
	IntrusionDetectionCertSecret certificatemanagement.KeyPairInterface

	Namespace       string
	BindNamespaces  []string
	Tenant          *operatorv1.Tenant
	ExternalElastic bool
}

IntrusionDetectionConfiguration contains all the config information needed to render the component.

type ManagedClusterLogStorageConfiguration added in v1.32.0

type ManagedClusterLogStorageConfiguration struct {
	Installation  *operatorv1.InstallationSpec
	ClusterDomain string
	Provider      operatorv1.Provider
}

ManagedClusterLogStorageConfiguration contains configuration for managed cluster log storage.

type ManagerCloudResources

type ManagerCloudResources struct {
	VoltronMetricsEnabled    bool
	VoltronInternalHttpsPort uint16
	VoltronExtraEnv          map[string]string

	ManagerImage    string
	ManagerExtraEnv map[string]string
}

ManagerCloudResources contains all the resources needed for the cloud manager.

type ManagerConfiguration added in v1.25.0

type ManagerConfiguration struct {
	VoltronRouteConfig *manager.VoltronRouteConfig

	KeyValidatorConfig authentication.KeyValidatorConfig
	PullSecrets        []*corev1.Secret
	OpenShift          bool
	Installation       *operatorv1.InstallationSpec
	ManagementCluster  *operatorv1.ManagementCluster
	NonClusterHost     *operatorv1.NonClusterHost

	// If provided, the KeyPair to used for external connections terminated by Voltron,
	// and connections from the manager pod to Linseed.
	TLSKeyPair certificatemanagement.KeyPairInterface

	// The key pair to use for TLS between Linseed clients in managed clusters and Voltron
	// in the management cluster.
	VoltronLinseedKeyPair certificatemanagement.KeyPairInterface

	// KeyPair used by Voltron as the server certificate when establishing an mTLS tunnel with Guardian.
	TunnelServerCert certificatemanagement.KeyPairInterface

	// AdditionalTunnelServerCert is an optional additional CA used by Voltron for tunnel server
	// certificates. It is populated by the manager controller when a pre-provisioned secret named
	// VoltronAdditionalTunnelSecretName exists in the truth namespace, and is mounted into the
	// Voltron container so Voltron can serve TLS from it.
	AdditionalTunnelServerCert certificatemanagement.KeyPairInterface

	// TLS KeyPair used by both Voltron and ui-apis, presented by each as part of the mTLS handshake with
	// other services within the cluster. This is used in both management and standalone clusters.
	InternalTLSKeyPair certificatemanagement.KeyPairInterface

	// Certificate bundle used by the manager pod to verify certificates presented
	// by clients as part of mTLS authentication.
	TrustedCertBundle certificatemanagement.TrustedBundleRO

	ClusterDomain string
	ESLicenseType ElasticsearchLicenseType
	Replicas      *int32

	Namespace      string
	TruthNamespace string

	// Single namespace to which RBAC should be bound, in single-tenant systems.
	// List of all tenant namespaces, in a multi-tenant system.
	BindingNamespaces []string

	// List of namespaces for Tenants who manage Calico OSS clusters, in a multi-tenant system.
	OSSTenantNamespaces []string

	// Whether to run the rendered components in multi-tenant, single-tenant, or zero-tenant mode
	Tenant          *operatorv1.Tenant
	ExternalElastic bool

	Manager        *operatorv1.Manager
	Authentication *operatorv1.Authentication
	KibanaEnabled  bool

	// RBACManagementEnabled reports whether to render the RBAC management UI access.
	// The controller has already applied the variant, the admin's gate and tenancy.
	RBACManagementEnabled bool

	// CACertCommonName is the CommonName from the CA certificate used for operator-managed certificates.
	// Passed to Voltron so it can identify the correct CA issuer public key.
	CACertCommonName string

	// Cloud indicates the manager is being rendered for a Calico Cloud install. When false (regular
	// Calico/Calico Enterprise) all cloud decorations below are inert and CloudResources is ignored.
	Cloud bool

	// CloudResources holds Calico Cloud specific manager/voltron customizations. Only consumed when
	// Cloud is true.
	CloudResources ManagerCloudResources
}

ManagerConfiguration contains all the config information needed to render the component.

type NamespaceConfiguration added in v1.25.0

type NamespaceConfiguration struct {
	Installation *operatorv1.InstallationSpec
	PullSecrets  []*corev1.Secret
	Terminating  bool
}

NamespaceConfiguration contains all the config information needed to render the component.

type NodeComponent

type NodeComponent interface {
	Component
	NodeConfig() *NodeConfiguration
}

A component that exposes an extension point hands a variant the config it rendered from. The accessor names differ per component, so an unrelated one can't match.

type NodeConfiguration added in v1.22.0

type NodeConfiguration struct {
	GoldmaneRunning  bool
	K8sServiceEp     k8sapi.ServiceEndpoint
	K8sServiceAddrs  []k8sapi.ServiceEndpoint
	K8sEndpointSlice []k8sapi.ServiceEndpoint
	Installation     *operatorv1.InstallationSpec
	IPPools          []operatorv1.IPPool
	TLS              *TyphaNodeTLS
	ClusterDomain    string

	// Defaults for DNS.
	DefaultDNSPolicy corev1.DNSPolicy
	DefaultDNSConfig *corev1.PodDNSConfig

	// Goldmane IP, to avoid DNS resolution using kube-dns.
	GoldmaneIP string

	// Optional fields.
	MigrateNamespaces   bool
	NodeAppArmorProfile string
	BirdTemplates       map[string]string

	// CanRemoveCNIFinalizer specifies whether CNI plugin is still needed during uninstall since the CNI plugin and
	// associated RBAC resources are required for pod teardown to succeed. Setting this to true removes
	// the finalizer from the CNI plugin and associated RBAC resources, allowing them to be deleted.
	// For details on why this is needed see 'Node and Installation finalizer' in the core_controller.
	CanRemoveCNIFinalizer bool

	// BGPLayouts is returned by the rendering code after modifying its namespace
	// so that it can be deployed into the cluster.
	// TODO: The controller should pass the contents, the renderer should build its own
	// configmap, rather than this "copy" semantic.
	BGPLayouts *corev1.ConfigMap

	// The health port that Felix should bind to. The controller reads FelixConfiguration
	// and sets this.
	FelixHealthPort int

	// Node's CgroupV2Path override. The controller reads FelixConfiguration and sets this.
	NodeCgroupV2Path string

	// The bindMode read from the default BGPConfiguration. Used to trigger rolling updates
	// should this value change.
	BindMode string

	V3CRDs bool

	// ImageOverrides lets a variant swap the node and cni-plugins images. The
	// controller wires in the operator's image overrides; nil resolves to the
	// core images.
	ImageOverrides *imageoverride.Overrides
}

NodeConfiguration is the public API used to provide information to the render code to generate Kubernetes objects for installing calico/node on a cluster.

type PacketCaptureApiConfiguration added in v1.25.0

type PacketCaptureApiConfiguration struct {
	PullSecrets                 []*corev1.Secret
	OpenShift                   bool
	Installation                *operatorv1.InstallationSpec
	KeyValidatorConfig          authentication.KeyValidatorConfig
	ServerCertSecret            certificatemanagement.KeyPairInterface
	TrustedBundle               certificatemanagement.TrustedBundle
	ClusterDomain               string
	ManagementClusterConnection *operatorv1.ManagementClusterConnection

	PacketCaptureAPI *operatorv1.PacketCaptureAPI
}

PacketCaptureApiConfiguration contains all the config information needed to render the component.

type PodSecurityStandard added in v1.28.0

type PodSecurityStandard string

type PolicyRecommendationConfiguration added in v1.30.0

type PolicyRecommendationConfiguration struct {
	ClusterDomain                  string
	Installation                   *operatorv1.InstallationSpec
	ManagedCluster                 bool
	ManagementCluster              bool
	OpenShift                      bool
	PullSecrets                    []*corev1.Secret
	TrustedBundle                  certificatemanagement.TrustedBundleRO
	PolicyRecommendationCertSecret certificatemanagement.KeyPairInterface

	Namespace         string
	BindingNamespaces []string

	// Whether or not to run the rendered components in multi-tenant mode.
	Tenant          *operatorv1.Tenant
	ExternalElastic bool

	PolicyRecommendation *operatorv1.PolicyRecommendation
}

PolicyRecommendationConfiguration contains all the config information needed to render the component.

type Renderer

type Renderer interface {
	Render() []Component
}

A Renderer is capable of generating components to be installed on the cluster.

type SetUpComponent added in v1.40.0

type SetUpComponent struct {
	// contains filtered or unexported fields
}

SetUpComponent is an implementation of a Component that setup common resource between controllers

func (*SetUpComponent) Objects added in v1.40.0

func (p *SetUpComponent) Objects() (objsToCreate []client.Object, objsToDelete []client.Object)

Objects returns the lists of objects in this component that should be created and/or deleted during rendering.

func (*SetUpComponent) Ready added in v1.40.0

func (p *SetUpComponent) Ready() bool

Ready returns true if the component is ready to be created.

func (*SetUpComponent) ResolveImages added in v1.40.0

func (p *SetUpComponent) ResolveImages(is *operatorv1.ImageSet) error

ResolveImages should call components.GetReference for all images that the Component needs, passing 'is' to the GetReference call and if there are any errors those are returned. It is valid to pass nil for 'is' as GetReference accepts the value. ResolveImages must be called before Objects is called for the component.

func (*SetUpComponent) SupportedOSType added in v1.40.0

func (p *SetUpComponent) SupportedOSType() rmeta.OSType

SupportedOSType returns operating systems that is supported of the components returned by the Objects() function. The "componentHandler" converts the returned OSTypes to a node selectors for the "kubernetes.io/os" label on client.Objects that create pods. Return OSTypeAny means that no node selector should be set for the "kubernetes.io/os" label.

type SetUpConfiguration added in v1.40.0

type SetUpConfiguration struct {
	OpenShift    bool
	Installation *operatorv1.InstallationSpec
	PullSecrets  []*corev1.Secret
	Namespace    string
	PSS          PodSecurityStandard

	CreateNamespace bool
}

type TyphaComponent

type TyphaComponent interface {
	Component
	TyphaConfig() *TyphaConfiguration
}

A component that exposes an extension point hands a variant the config it rendered from. The accessor names differ per component, so an unrelated one can't match.

type TyphaConfiguration added in v1.22.0

type TyphaConfiguration struct {
	K8sServiceEp k8sapi.ServiceEndpoint

	// K8sServiceEpPodNetwork is used for pod-networked Typha (i.e. the non-cluster-host
	// deployment), where K8sServiceEp may be unreachable from pods.
	K8sServiceEpPodNetwork k8sapi.ServiceEndpoint

	Installation      *operatorv1.InstallationSpec
	TLS               *TyphaNodeTLS
	MigrateNamespaces bool
	ClusterDomain     string
	NonClusterHost    *operatorv1.NonClusterHost

	// The health port that Felix is bound to. We configure Typha to bind to the port
	// that is one less.
	FelixHealthPort int
}

TyphaConfiguration is the public API used to provide information to the render code to generate Kubernetes objects for installing calico/typha on a cluster.

type TyphaNodeTLS added in v1.0.0

type TyphaNodeTLS struct {
	TrustedBundle             certificatemanagement.TrustedBundle
	TyphaSecret               certificatemanagement.KeyPairInterface
	TyphaSecretNonClusterHost certificatemanagement.KeyPairInterface
	TyphaCommonName           string
	TyphaURISAN               string
	NodeSecret                certificatemanagement.KeyPairInterface
	NodeCommonName            string
	NodeURISAN                string

	NodeNonClusterHostCommonName string
	NodeNonClusterHostURISAN     string
}

TyphaNodeTLS holds configuration for Node and Typha to establish TLS.

type WindowsComponent

type WindowsComponent interface {
	Component
	WindowsConfig() *WindowsConfiguration
}

A component that exposes an extension point hands a variant the config it rendered from. The accessor names differ per component, so an unrelated one can't match.

type WindowsConfiguration added in v1.32.0

type WindowsConfiguration struct {
	K8sServiceEp  k8sapi.ServiceEndpoint
	K8sDNSServers []string
	Installation  *operatorv1.InstallationSpec
	ClusterDomain string
	TLS           *TyphaNodeTLS
	VXLANVNI      int

	// ImageOverrides lets a variant swap the windows node and CNI images. The
	// controller wires in the operator's image overrides; nil resolves to the
	// core images.
	ImageOverrides *imageoverride.Overrides
}

Directories

Path Synopsis
common
rbacmanagement
Package rbacmanagement reads the admin-owned gate that switches the RBAC management UI on for a cluster.
Package rbacmanagement reads the admin-owned gate that switches the RBAC management UI on for a cluster.
intrusiondetection
dpi
eck

Jump to

Keyboard shortcuts

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