common

package
v1.29.6 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

GetWindowsNodes returns Windows nodes, optionally filtering the list of nodes with the given filter functions.

Index

Constants

View Source
const (
	CalicoNamespace               = "calico-system"
	TyphaDeploymentName           = "calico-typha"
	NodeDaemonSetName             = "calico-node"
	KubeControllersDeploymentName = "calico-kube-controllers"

	// Monitor + Prometheus related const
	TigeraPrometheusNamespace = "tigera-prometheus"

	// ComplianceFeature name
	ComplianceFeature = "compliance-reports"
	// ThreatDefenseFeature feature name
	ThreatDefenseFeature = "threat-defense"
	// ExportLogsFeature to 3rd party systems feature name
	ExportLogsFeature = "export-logs"
	// TiersFeature enables creation/update of Tiers
	TiersFeature = "tiers"
	// EgressAccessControl enables creation/update of NetworkPolicy with Domains
	EgressAccessControlFeature = "egress-access-control"
	// MultipleOwnersLabel used to indicate multiple owner references.
	// If the render code places this label on an object, the object mergeState machinery will merge owner
	// references with any that already exist on the object rather than replace the owner references. Further
	// the controller in the owner reference will not be set.
	MultipleOwnersLabel = "operator.tigera.io/multipleOwners"
)
View Source
const (
	CalicoWindowsUpgradeResourceName    = "calico-windows-upgrade"
	CalicoWindowsUpgradeVolumePath      = `c:\CalicoUpgrade`
	CalicoWindowsUpgradeLabel           = "projectcalico.org/windows-upgrade"
	CalicoWindowsUpgradeLabelInProgress = "in-progress"
	CalicoVersionAnnotation             = "projectcalico.org/version"
	CalicoVariantAnnotation             = "projectcalico.org/variant"
	CalicoWindowsUpgradeTaintKey        = "projectcalico.org/windows-upgrade"
)

Variables

View Source
var (
	// This taint is applied to nodes upgrading Calico Windows.
	CalicoWindowsUpgradingTaint = &corev1.Taint{
		Key:    CalicoWindowsUpgradeTaintKey,
		Effect: corev1.TaintEffectNoSchedule,
	}
)

Functions

func GetExpectedTyphaScale added in v1.15.1

func GetExpectedTyphaScale(nodes int) int

GetExpectedTyphaScale will return the number of Typhas needed for the number of nodes.

Nodes Replicas

  1-2              1
  3-4              2
 <200              3
 >400              4
 >600              5
 >800              6
>1000              7
...
>2000             12
...
>3600             20

func GetNodeVariantAndVersion added in v1.23.0

func GetNodeVariantAndVersion(n *corev1.Node) (bool, operatorv1.ProductVariant, string)

GetNodeVariantAndVersion gets the node's variant and version annotation values and returns whether both annotations exist.

func MapExistsOrInitialize added in v1.27.17

func MapExistsOrInitialize(m map[string]string) map[string]string

MapExistsOrInitialize returns the given map if non-nil or returns an empty map.

func MergeMaps added in v1.27.17

func MergeMaps(current, desired map[string]string) map[string]string

MergeMaps merges current and desired maps. If both current and desired maps contain the same key, the desired map's value is used.

func MergeOwnerReferences added in v1.29.2

func MergeOwnerReferences(desired, current []metav1.OwnerReference) []metav1.OwnerReference

MergeOwnerReferences merges desired and current owner references, removing the duplicates.

func OperatorNamespace added in v1.23.0

func OperatorNamespace() string

OperatorNamespace returns the namespace the operator is running in. The value returned is based on the following priority (these are evaluated at startup):

If the OPERATOR_NAMESPACE environment variable is non-empty then that is return.
If the file /var/run/secrets/kubernetes.io/serviceaccount/namespace is non-empty
then the contents is returned.
The default "tigera-operator" is returned.

func OperatorServiceAccount added in v1.24.2

func OperatorServiceAccount() string

OperatorServiceAccount returns the ServiceAccount name the operator is running in. The value returned is based on the following priority (these are evaluated at startup):

If the OPERATOR_SERVICEACCOUNT environment variable is non-empty then that is return.
If the file /var/run/secrets/kubernetes.io/serviceaccount/namespace is non-empty
then the contents is returned.
The default "tigera-operator" is returned.

Types

type VersionInfo added in v1.18.0

type VersionInfo struct {
	Major int
	Minor int
}

VersionInfo contains information about the version of Kubernetes API the cluster is using Major and Minor fields map to the v<Major>.<Minor>+ part of the version string

func GetKubernetesVersion added in v1.18.0

func GetKubernetesVersion(clientset kubernetes.Interface) (*VersionInfo, error)

func (*VersionInfo) ProvidesCertV1API added in v1.18.0

func (v *VersionInfo) ProvidesCertV1API() bool

ProvidesCertV1API returns if k8s.io/api/certificates/v1 is supported given the current k8s version

Jump to

Keyboard shortcuts

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