kubernetes

package
v1.31.0 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// AppKubernetesComponentLabelKey is the key for the component within the architecture
	AppKubernetesComponentLabelKey = "app.kubernetes.io/component"
	// AppKubernetesInstanceLabelKey is the key for a unique name identifying the instance of an application
	AppKubernetesInstanceLabelKey = "app.kubernetes.io/instance"
	// AppKubernetesManageByLabelKey is the key for the tool being used to manage the operation of an application
	AppKubernetesManageByLabelKey = "app.kubernetes.io/managed-by"
	// AppKubernetesNameLabelKey is the key for the name of the application
	AppKubernetesNameLabelKey = "app.kubernetes.io/name"
	// AppKubernetesPartOfLabelKey is the key for the name of a higher level application this one is part of
	AppKubernetesPartOfLabelKey = "app.kubernetes.io/part-of"
	// AppKubernetesVersionLabelKey is the key for the current version of the application
	AppKubernetesVersionLabelKey = "app.kubernetes.io/version"
)
View Source
const (
	// APIServiceKind is the APIService resource kind
	APIServiceKind = "apiservices"
	// CiliumNetworkPoliciesKind is the CiliumNetworkPolicies resource kind
	CiliumNetworkPoliciesKind = "ciliumnetworkpolicies"
	// ClusterRolesKind is the ClusterRoles resource kind
	ClusterRolesKind = "clusterroles"
	// ClusterRoleBindingKind is the ClusterRoleBindings resource kind
	ClusterRoleBindingKind = "clusterrolebindings"
	// ConfigMapKind is the ConfigMaps resource kind
	ConfigMapKind ObjectKind = "configmaps"
	// MutatingWebhookConfigurationsKind is the MutatingWebhookConfigurations resource kind
	MutatingWebhookConfigurationsKind = "mutatingwebhookconfigurations"
	// NetworkPoliciesKind is the NetworkPolicies resource kind
	NetworkPoliciesKind = "networkpolicies"
	// NodeKind is the Nodes resource kind
	NodeKind = "nodes"
	// PodDisruptionBudgetsKind is the PodDisruptionBudgets resource kind
	PodDisruptionBudgetsKind = "poddisruptionbudgets"
	// RoleBindingKind is the RoleBinding resource kind
	RoleBindingKind = "rolebindings"
	// RolesKind is the Roles resource kind
	RolesKind = "roles"
	// SecretsKind is the Secrets resource kind
	SecretsKind = "secrets"
	// ServiceAccountsKind is the ServiceAccounts resource kind
	ServiceAccountsKind = "serviceaccounts"
	// ServicesKind is the Services resource kind
	ServicesKind = "services"
	// ValidatingWebhookConfigurationsKind is the ValidatingWebhookConfigurations resource kind
	ValidatingWebhookConfigurationsKind = "validatingwebhookconfigurations"
)
View Source
const (
	// DaemonSetKind is the Daemonset resource kind
	DaemonSetKind = "daemonset"
	// DeploymentKind is the Deployment resource kind
	DeploymentKind = "deployment"
)

These constants are used in Datadog event submission

View Source
const (
	// DDA/DDAI annotation key for provider used in reconciler to apply provider-specific configs
	ProviderAnnotationKey = "agent.datadoghq.com/cluster-provider"

	// LegacyProvider Legacy Provider (empty name)
	LegacyProvider = ""
	// DefaultProvider Default provider name
	DefaultProvider = "default"

	// GKE provider types: https://cloud.google.com/kubernetes-engine/docs/concepts/node-images#available_node_images
	// GKECosType is the Container-Optimized OS node image offered by GKE
	GKECosType = "cos"

	// GKECloudProvider GKE CloudProvider name
	GKECloudProvider = "gke"

	// GKECosProvider is the full provider string for GKE on Container-Optimized OS
	// nodes (matches the `{cloudProvider}-{value}` convention from
	// generateValidProviderName). Used as a ProviderCapabilityMap key.
	GKECosProvider = "gke-cos"

	// GKEAutopilotProvider is the provider string for GKE Autopilot clusters. It is
	// not node-label-derived; it is declared via the `datadoghq.com/provider`
	// annotation (or mapped from the experimental autopilot opt-in annotation) and
	// used as a NodeAgentProviderCapabilities map key.
	GKEAutopilotProvider = "gke-autopilot"

	// GKEProviderLabel is the GKE node label used to determine the node's provider
	GKEProviderLabel = "cloud.google.com/gke-os-distribution"

	// WindowsProvider marks a DatadogAgent(Internal)/DatadogAgentProfile whose node agent
	// targets Windows nodes. Set via the datadoghq.com/provider annotation on a
	// DatadogAgentProfile that selects Windows nodes; the node-agent reconcile then builds a
	// Windows-compatible DaemonSet (CONTP-1448).
	WindowsProvider = "windows"

	// OpenshiftProvider is the OpenShift Provider name
	OpenshiftProvider = "openshift"

	// TalosProvider is the provider string for Talos Linux clusters.
	TalosProvider = "talos"

	// OpenShiftProviderLabel is the OpenShift node label used to determine the node's provider
	OpenShiftProviderLabel = "node.openshift.io/os_id"

	// AKSProvider is the Azure Kubernetes Service provider name (mirrors helm's providers.aks).
	AKSProvider = "aks"

	// EKSCloudProvider is the Amazon EKS CloudProvider name
	EKSCloudProvider = "eks"

	// EKSEC2UseHostnameFromFileProvider is the EKS-EC2 provider variant where
	// the agent reads its hostname from the cloud-init instance-id file mounted
	// from the host (mirrors helm's providers.eks.ec2.useHostnameFromFile).
	EKSEC2UseHostnameFromFileProvider = "eks-ec2-use-hostname-from-file"

	// EKSProviderLabel is a common EKS node label containing the AMI ID
	EKSProviderLabel = "eks.amazonaws.com/nodegroup-image"
)

Variables

This section is empty.

Functions

func ClusterProviderFromNode added in v1.31.0

func ClusterProviderFromNode(node *corev1.Node) string

ClusterProviderFromNode maps a single node to the cluster-level provider. Most providers are label-derived; Talos is detected from osImage because Talos does not expose a default stable node label.

func ClusterProviderFromNodeLabels added in v1.29.0

func ClusterProviderFromNodeLabels(labels map[string]string) string

ClusterProviderFromNodeLabels maps a single node's labels to the cluster-level provider (eks, aks, openshift-<os>, or default). It is the node-label signal for the cluster dimension.

Node-OS distinctions such as gke-cos belong to the node dimension and are intentionally NOT returned here, so a node-OS variation doesn't appear as a cluster provider. GKE therefore maps to default at cluster scope.

func GetAgentNameWithProvider added in v1.4.0

func GetAgentNameWithProvider(overrideDSName, provider string) string

GetAgentNameWithProvider returns the agent name based on the ds name and provider

func GetClusterProviderFromNodeList added in v1.29.0

func GetClusterProviderFromNodeList(nodeList []corev1.Node) string

GetClusterProviderFromNodeList returns the cluster-level provider for a node list, preferring a specific provider over the default (first match wins).

func GetProviderLabelKeyValue added in v1.4.0

func GetProviderLabelKeyValue(provider string) (string, string)

GetProviderLabelKeyValue gets the corresponding cloud provider label key and value from a provider name

func IsSpecificProvider added in v1.29.0

func IsSpecificProvider(p string) bool

IsSpecificProvider reports whether p is a recognized cloud provider (i.e. not empty and not the generic "default").

func ObjectFromKind added in v1.0.0

func ObjectFromKind(kind ObjectKind, platformInfo PlatformInfo) client.Object

ObjectFromKind returns the corresponding object list from a kind

func ObjectListFromKind added in v1.0.0

func ObjectListFromKind(kind ObjectKind, platformInfo PlatformInfo) client.ObjectList

ObjectListFromKind returns the corresponding object list from a kind

func ShouldUseDefaultDaemonset added in v1.24.0

func ShouldUseDefaultDaemonset(providerList map[string]struct{}) bool

ShouldUseDefaultDaemonset checks if the provider list contains providers that don't support provider-specific daemonsets and should use a single default daemonset without node affinity. Currently applies to EKS and OpenShift providers.

func UpdateFromObject added in v0.8.0

func UpdateFromObject(ctx context.Context, c client.Client, newObject client.Object, oldMeta metav1.ObjectMeta) error

UpdateFromObject performs an update and forces previous ResourceVersion to be set

Types

type ObjectKind added in v1.0.0

type ObjectKind string

ObjectKind identifies a Kubernetes resource kind. These strings are plural because their list kind is used to query the Kubernetes API when cleaning up resources. They are also used in the store for DatadogAgent dependencies.

type PlatformInfo added in v1.0.0

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

func NewPlatformInfo added in v1.0.0

func NewPlatformInfo(versionInfo *version.Info, groups []*v1.APIGroup, resources []*v1.APIResourceList) PlatformInfo

func NewPlatformInfoFromVersionMaps added in v1.0.0

func NewPlatformInfoFromVersionMaps(versionInfo *version.Info, apiPreferredVersions, apiOtherVersions map[string]string) PlatformInfo

func (*PlatformInfo) CreatePDBObject added in v1.0.0

func (platformInfo *PlatformInfo) CreatePDBObject() client.Object

func (*PlatformInfo) CreatePDBObjectList added in v1.0.0

func (platformInfo *PlatformInfo) CreatePDBObjectList() client.ObjectList

func (*PlatformInfo) GetAPIVersions added in v1.31.0

func (platformInfo *PlatformInfo) GetAPIVersions(name string) (preferred string, other string)

GetAPIVersions returns the preferred and alternate API versions for a resource.

func (*PlatformInfo) GetAgentResourcesKind added in v1.0.0

func (platformInfo *PlatformInfo) GetAgentResourcesKind(withCiliumResources bool) []ObjectKind

func (*PlatformInfo) GetApiVersions added in v1.0.0

func (platformInfo *PlatformInfo) GetApiVersions(name string) (preferred string, other string)

GetApiVersions returns the preferred and alternate API versions for a resource. Deprecated: use GetAPIVersions.

func (*PlatformInfo) GetVersionInfo added in v1.10.0

func (platformInfo *PlatformInfo) GetVersionInfo() *version.Info

func (*PlatformInfo) IsResourceSupported added in v1.0.0

func (platformInfo *PlatformInfo) IsResourceSupported(resource string) bool

IsResourceSupported returns true if a Kubernetes resource is supported by the server

func (*PlatformInfo) SupportsAppArmorProfile added in v1.30.0

func (platformInfo *PlatformInfo) SupportsAppArmorProfile() bool

SupportsAppArmorProfile returns whether the Kubernetes API server supports the appArmorProfile security context field. The field is available starting with Kubernetes 1.30.

func (*PlatformInfo) UseV1Beta1PDB added in v1.0.0

func (platformInfo *PlatformInfo) UseV1Beta1PDB() bool

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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