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

feat: remove cert-manager as dependency & support HTTP/HTTPs endpoints #88

Merged
merged 2 commits into from
Aug 13, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
10 changes: 0 additions & 10 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,6 @@ Contributing

## Deploying to a Local Cluster for Testing Purposes

Make sure your cluster has cert-manager running. If not, refer to https://cert-manager.io/docs/installation/.

E.g.:

```
helm repo add jetstack https://charts.jetstack.io --force-update
helm repo update
helm install cert-manager jetstack/cert-manager --namespace cert-manager --create-namespace --version v1.14.5 --set installCRDs=true
```

This approach is suitable for deploying the operator to a cluster running locally on your machine, for example
via the Kubernetes support included in Docker Desktop.

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
[![Artifact Hub](https://img.shields.io/endpoint?url=https://artifacthub.io/badge/repository/dash0-operator)](https://artifacthub.io/packages/search?repo=dash0-operator)

The Dash0 Kubernetes Operator makes observability for Kubernetes _easy_.
Simply install the operator into your cluster to get OpenTelemetry data flowing from your applications and
Install the operator into your cluster and create a Dash0 monitoring resource to get OpenTelemetry data flowing from your applications and
infrastructure to Dash0.

## Description
Expand Down
7 changes: 3 additions & 4 deletions api/dash0monitoring/v1alpha1/dash0monitoring_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,9 @@ type Dash0MonitoringSpec struct {
// +kubebuilder:validation:Optional
AuthorizationToken string `json:"authorizationToken"`

// A reference to a Kubernetes secret containing the Dash0 authorization token. This property is optional, but either
// this property or the AuthorizationToken property has to be provided. If both are provided, the AuthorizationToken
// will be used and SecretRef will be ignored. The authorization token for your Dash0 organization can be copied
// from https://app.dash0.com/settings.
// A reference to a Kubernetes secret containing the Dash0 authorization token. This property is optional, and is
// ignored if the AuthorizationToken property is set. The authorization token for your Dash0 organization
// can be copied from https://app.dash0.com/settings.
//
// +kubebuilder:validation:Optional
SecretRef string `json:"secretRef"`
Expand Down
26 changes: 1 addition & 25 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,6 @@ type environmentVariables struct {
collectorImagePullPolicy corev1.PullPolicy
configurationReloaderImage string
configurationReloaderImagePullPolicy corev1.PullPolicy
e2eTestMode bool
e2eTestExportDir string
}

const (
Expand All @@ -63,9 +61,7 @@ const (
configurationReloaderImageEnvVarName = "DASH0_CONFIGURATION_RELOADER_IMAGE"
configurationReloaderImageImagePullPolicyEnvVarName = "DASH0_CONFIGURATION_RELOADER_IMAGE_PULL_POLICY"

developmentModeEnvVarName = "DASH0_DEVELOPMENT_MODE"
e2eTestModeEnvVarName = "DASH0_DEV_E2E_TEST_MODE"
e2eTestExportDirEnvVarName = "DASH0_DEV_E2E_TEST_EXPORT_DIR"
developmentModeEnvVarName = "DASH0_DEVELOPMENT_MODE"

//nolint
mandatoryEnvVarMissingMessageTemplate = "cannot start the Dash0 operator, the mandatory environment variable \"%s\" is missing"
Expand Down Expand Up @@ -231,13 +227,6 @@ func startOperatorManager(
"otel collector name prefix",
envVars.oTelCollectorNamePrefix,
)
if envVars.e2eTestMode {
setupLog.Info(
"!E2E test mode is active!",
"export dir",
envVars.e2eTestExportDir,
)
}

err = startDash0Controller(mgr, clientset, envVars)
if err != nil {
Expand Down Expand Up @@ -281,10 +270,6 @@ func startDash0Controller(mgr manager.Manager, clientset *kubernetes.Clientset,
oTelColResourceManager := &otelcolresources.OTelColResourceManager{
Client: mgr.GetClient(),
OTelCollectorNamePrefix: envVars.oTelCollectorNamePrefix,
E2eTestConfig: otelcolresources.E2eTestConfig{
Enabled: envVars.e2eTestMode,
ExportDir: envVars.e2eTestExportDir,
},
}
backendConnectionManager := &backendconnection.BackendConnectionManager{
Client: mgr.GetClient(),
Expand Down Expand Up @@ -370,13 +355,6 @@ func readEnvironmentVariables() (*environmentVariables, error) {
configurationReloaderImagePullPolicy :=
readOptionalPullPolicyFromEnvironmentVariable(configurationReloaderImageImagePullPolicyEnvVarName)

e2eTestModeRaw, isSet := os.LookupEnv(e2eTestModeEnvVarName)
e2eTestMode := isSet && strings.ToLower(e2eTestModeRaw) == "true"
e2eTestExportDir := ""
if e2eTestMode {
e2eTestExportDir, _ = os.LookupEnv(e2eTestExportDirEnvVarName)
}

return &environmentVariables{
operatorNamespace: operatorNamespace,
oTelCollectorNamePrefix: oTelCollectorNamePrefix,
Expand All @@ -387,8 +365,6 @@ func readEnvironmentVariables() (*environmentVariables, error) {
collectorImagePullPolicy: collectorImagePullPolicy,
configurationReloaderImage: configurationReloaderImage,
configurationReloaderImagePullPolicy: configurationReloaderImagePullPolicy,
e2eTestMode: e2eTestMode,
e2eTestExportDir: e2eTestExportDir,
}, nil
}

Expand Down
7 changes: 3 additions & 4 deletions config/crd/bases/operator.dash0.com_dash0monitorings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,9 @@ spec:
type: string
secretRef:
description: |-
A reference to a Kubernetes secret containing the Dash0 authorization token. This property is optional, but either
this property or the AuthorizationToken property has to be provided. If both are provided, the AuthorizationToken
will be used and SecretRef will be ignored. The authorization token for your Dash0 organization can be copied
from https://app.dash0.com/settings.
A reference to a Kubernetes secret containing the Dash0 authorization token. This property is optional, and is
ignored if the AuthorizationToken property is set. The authorization token for your Dash0 organization
can be copied from https://app.dash0.com/settings.
type: string
uninstrumentWorkloadsOnDelete:
description: |-
Expand Down
2 changes: 1 addition & 1 deletion helm-chart/dash0-operator/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ helm.sh/chart: {{ include "dash0-operator.chartNameWithVersion" . }}

{{/* service account name */}}
{{- define "dash0-operator.serviceAccountName" -}}
{{- default (printf "%s-controller-manager" (include "dash0-operator.chartName" .)) .Values.operator.serviceAccount.name }}
{{- default (printf "%s-controller" (include "dash0-operator.chartName" .)) .Values.operator.serviceAccount.name }}
{{- end }}

{{/* the controller manager container image */}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ kind: ClusterRoleBinding
metadata:
name: {{ template "dash0-operator.chartName" . }}-manager-rolebinding
labels:
app.kubernetes.io/name: clusterrolebinding
app.kubernetes.io/instance: manager-rolebinding
app.kubernetes.io/component: rbac
app.kubernetes.io/name: dash0-operator
app.kubernetes.io/component: controller
app.kubernetes.io/instance: role-binding
{{- include "dash0-operator.labels" . | nindent 4 }}
roleRef:
apiGroup: rbac.authorization.k8s.io
Expand All @@ -21,9 +21,9 @@ kind: ClusterRoleBinding
metadata:
name: {{ template "dash0-operator.chartName" . }}-proxy-rolebinding
labels:
app.kubernetes.io/name: clusterrolebinding
app.kubernetes.io/instance: proxy-rolebinding
app.kubernetes.io/component: kube-rbac-proxy
app.kubernetes.io/name: dash0-operator
app.kubernetes.io/component: proxy
app.kubernetes.io/instance: role-binding
{{- include "dash0-operator.labels" . | nindent 4 }}
roleRef:
apiGroup: rbac.authorization.k8s.io
Expand Down
14 changes: 7 additions & 7 deletions helm-chart/dash0-operator/templates/operator/cluster-roles.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ kind: ClusterRole
metadata:
name: {{ template "dash0-operator.chartName" . }}-manager-role
labels:
app.kubernetes.io/name: clusterrole
app.kubernetes.io/name: dash0-operator
app.kubernetes.io/component: controller
app.kubernetes.io/instance: manager-role
app.kubernetes.io/component: kube-rbac-proxy
{{- include "dash0-operator.labels" . | nindent 4 }}

rules:
Expand Down Expand Up @@ -179,9 +179,9 @@ kind: ClusterRole
metadata:
name: {{ template "dash0-operator.chartName" . }}-metrics-reader
labels:
app.kubernetes.io/name: clusterrole
app.kubernetes.io/instance: metrics-reader
app.kubernetes.io/component: kube-rbac-proxy
app.kubernetes.io/name: dash0-operator
app.kubernetes.io/component: controller
app.kubernetes.io/instance: metrics-role
{{- include "dash0-operator.labels" . | nindent 4 }}
rules:
- nonResourceURLs:
Expand All @@ -194,9 +194,9 @@ kind: ClusterRole
metadata:
name: {{ template "dash0-operator.chartName" . }}-proxy-role
labels:
app.kubernetes.io/name: clusterrole
app.kubernetes.io/name: dash0-operator
app.kubernetes.io/component: controller
app.kubernetes.io/instance: proxy-role
app.kubernetes.io/component: kube-rbac-proxy
{{- include "dash0-operator.labels" . | nindent 4 }}
rules:
- apiGroups:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
cert-manager.io/inject-ca-from: {{ .Release.Namespace }}/{{ template "dash0-operator.chartName" . }}-serving-cert
controller-gen.kubebuilder.io/version: v0.14.0
name: dash0monitorings.operator.dash0.com
spec:
Expand Down
Loading