Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[cleanup] move uncommon items from api/common/v1 #1407

Merged
merged 5 commits into from
Sep 20, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
97 changes: 0 additions & 97 deletions api/datadoghq/common/common.go

This file was deleted.

101 changes: 0 additions & 101 deletions api/datadoghq/common/common_test.go

This file was deleted.

33 changes: 2 additions & 31 deletions api/datadoghq/common/const.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import (
appsv1 "k8s.io/api/apps/v1"
)

// TODO move most of these constants out of common

// This file tracks constants related to setting up the Datadog Agents

const (
Expand Down Expand Up @@ -61,10 +63,6 @@ const (
DefaultDogstatsdPort = 8125
// DefaultDogstatsdPortName default dogstatsd port name
DefaultDogstatsdPortName = "dogstatsdport"
// DefaultApmPort default apm port
DefaultApmPort = 8126
// DefaultApmPortName default apm port name
DefaultApmPortName = "traceport"
// DefaultMetricsProviderPort default metrics provider port
DefaultMetricsProviderPort int32 = 8443
// DefaultKubeStateMetricsCoreConf default ksm core ConfigMap name
Expand All @@ -82,33 +80,6 @@ const (
// DefaultHelmCheckConf default Helm Check ConfigMap name
DefaultHelmCheckConf string = "helm-check-config"

// DefaultAgentHealthPort default agent health port
DefaultAgentHealthPort int32 = 5555

// Liveness probe default config
DefaultLivenessProbeInitialDelaySeconds int32 = 15
DefaultLivenessProbePeriodSeconds int32 = 15
DefaultLivenessProbeTimeoutSeconds int32 = 5
DefaultLivenessProbeSuccessThreshold int32 = 1
DefaultLivenessProbeFailureThreshold int32 = 6
DefaultLivenessProbeHTTPPath = "/live"

// Readiness probe default config
DefaultReadinessProbeInitialDelaySeconds int32 = 15
DefaultReadinessProbePeriodSeconds int32 = 15
DefaultReadinessProbeTimeoutSeconds int32 = 5
DefaultReadinessProbeSuccessThreshold int32 = 1
DefaultReadinessProbeFailureThreshold int32 = 6
DefaultReadinessProbeHTTPPath = "/ready"

// Startup probe default config
DefaultStartupProbeInitialDelaySeconds int32 = 15
DefaultStartupProbePeriodSeconds int32 = 15
DefaultStartupProbeTimeoutSeconds int32 = 5
DefaultStartupProbeSuccessThreshold int32 = 1
DefaultStartupProbeFailureThreshold int32 = 6
DefaultStartupProbeHTTPPath = "/startup"

// Default Image name
DefaultAgentImageName string = "agent"
DefaultClusterAgentImageName string = "cluster-agent"
Expand Down
2 changes: 2 additions & 0 deletions api/datadoghq/common/envvar.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

package common

// TODO move most of these out of common

// Datadog env var names
const (
DatadogHost = "DATADOG_HOST"
Expand Down
tbavelier marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -5,63 +5,33 @@

package common

import corev1 "k8s.io/api/core/v1"

// SecretConfig contains a secret name and an included key.
// +kubebuilder:object:generate=true
type SecretConfig struct {
// SecretName is the name of the secret.
SecretName string `json:"secretName"`

// KeyName is the key of the secret to use.
// +optional
KeyName string `json:"keyName,omitempty"`
}

// ConfigMapConfig contains ConfigMap information used to store a configuration file.
// +kubebuilder:object:generate=true
type ConfigMapConfig struct {
// Name is the name of the ConfigMap.
Name string `json:"name,omitempty"`

// Items maps a ConfigMap data `key` to a file `path` mount.
// +listType=map
// +listMapKey=key
// +optional
Items []corev1.KeyToPath `json:"items,omitempty"`
}
import (
"k8s.io/apimachinery/pkg/util/intstr"
)

// CustomConfig allows one to put custom configurations for the agent.
// The deployment strategy to use to replace existing pods with new ones.
// +k8s:openapi-gen=true
// +kubebuilder:object:generate=true
type CustomConfig struct {
// ConfigData corresponds to the configuration file content.
// +optional
ConfigData *string
// Enable to specify a reference to an already existing ConfigMap.
// +optional
ConfigMap *ConfigMapConfig
type UpdateStrategy struct {
// Type can be "RollingUpdate" or "OnDelete" for DaemonSets and "RollingUpdate"
// or "Recreate" for Deployments
Type string `json:"type,omitempty"`
// Configure the rolling update strategy of the Deployment or DaemonSet.
RollingUpdate *RollingUpdate `json:"rollingUpdate,omitempty"`
}

// KubeletConfig contains the kubelet configuration parameters.
// RollingUpdate describes how to replace existing pods with new ones.
// +k8s:openapi-gen=true
// +kubebuilder:object:generate=true
type KubeletConfig struct {
// Host overrides the host used to contact kubelet API (default to status.hostIP).
// +optional
Host *corev1.EnvVarSource `json:"host,omitempty"`

// TLSVerify toggles kubelet TLS verification.
// Default: true
// +optional
TLSVerify *bool `json:"tlsVerify,omitempty"`

// HostCAPath is the host path where the kubelet CA certificate is stored.
// +optional
HostCAPath string `json:"hostCAPath,omitempty"`

// AgentCAPath is the container path where the kubelet CA certificate is stored.
// Default: '/var/run/host-kubelet-ca.crt' if hostCAPath is set, else '/var/run/secrets/kubernetes.io/serviceaccount/ca.crt'
// +optional
AgentCAPath string `json:"agentCAPath,omitempty"`
type RollingUpdate struct {
// The maximum number of pods that can be unavailable during the update.
// Value can be an absolute number (ex: 5) or a percentage of desired pods (ex: 10%).
// Refer to the Kubernetes API documentation for additional details..
MaxUnavailable *intstr.IntOrString `json:"maxUnavailable,omitempty"`

// MaxSurge behaves differently based on the Kubernetes resource. Refer to the
// Kubernetes API documentation for additional details.
MaxSurge *intstr.IntOrString `json:"maxSurge,omitempty"`
}

// AgentContainerName is the name of a container inside an Agent component
Expand Down
Loading
Loading