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: allow setting the cluster DNS domain #3362

Merged
merged 1 commit into from
Oct 30, 2023
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
1 change: 1 addition & 0 deletions .changelog/3362.added.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
feat: allow setting the cluster DNS domain
1 change: 1 addition & 0 deletions deploy/helm/sumologic/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ The following table lists the configurable parameters of the Sumo Logic chart an
| `sumologic.collectionMonitoring` | If you set it to false, it would set `EXCLUDE_NAMESPACE=<release-namespace>` and not add the Prometheus remotestorage metrics. | `true` |
| `sumologic.collectorName` | The name of the Sumo Logic collector that will be created in the SetUp job. Defaults to `clusterName` if not specified. | `Nil` |
| `sumologic.clusterName` | An identifier for the Kubernetes cluster. Whitespaces in the cluster name will be replaced with dashes. | `kubernetes` |
| `sumologic.clusterDNSDomain` | The DNS domain for the cluster. Change this if you're using a custom domain. | `cluster.local` |
andrzej-stencel marked this conversation as resolved.
Show resolved Hide resolved
| `sumologic.cluster` | Configuration of Kubernetes for [Terraform client](https://www.terraform.io/docs/providers/kubernetes/index.html#argument-reference). | See [values.yaml] |
| `sumologic.collector.sources` | Configuration of HTTP sources. [See docs/Terraform.md for more information](/docs/terraform.md). All double quotes should be escaped here regarding Terraform syntax. | See [values.yaml] |
| `sumologic.collector.fields` | Configuration of Sumo Logic fields. [See Sumo Logic Terraform Plugin documentation for more information](https://registry.terraform.io/providers/SumoLogic/sumologic/latest/docs/resources/collector#fields). All double quotes should be escaped here regarding Terraform syntax. | See [values.yaml] |
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
exporters:
otlphttp:
endpoint: http://${LOGS_METADATA_SVC}.${NAMESPACE}.svc.cluster.local.:4318
endpoint: http://${LOGS_METADATA_SVC}.${NAMESPACE}.svc.{{ .Values.sumologic.clusterDNSDomain }}.:4318
sending_queue:
queue_size: 10
# this improves load balancing at the cost of more network traffic
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
exporters:
otlphttp:
endpoint: http://${LOGS_METADATA_SVC}.${NAMESPACE}.svc.cluster.local.:4318
endpoint: http://${LOGS_METADATA_SVC}.${NAMESPACE}.svc.{{ .Values.sumologic.clusterDNSDomain }}.:4318
sending_queue:
queue_size: 10
# this improves load balancing at the cost of more network traffic
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{{- $scrapeConfigsPresent := or $collectorConfig.kubelet.enabled $collectorConfig.cAdvisor.enabled $collectorConfig.annotatedPods.enabled -}}
exporters:
otlphttp:
endpoint: http://${METADATA_METRICS_SVC}.${NAMESPACE}.svc.cluster.local.:4318
endpoint: http://${METADATA_METRICS_SVC}.${NAMESPACE}.svc.{{ .Values.sumologic.clusterDNSDomain }}.:4318
sending_queue:
queue_size: 10000
num_consumers: 10
Expand Down
4 changes: 2 additions & 2 deletions deploy/helm/sumologic/templates/_helpers/_metrics.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ Generate list of remoteWrite endpoints for telegraf configuration
{{- $endpoints := list -}}
{{- $kps := get .Values "kube-prometheus-stack" -}}
{{- range $remoteWrite := $kps.prometheus.prometheusSpec.remoteWrite }}
{{- $endpoints = append $endpoints ($remoteWrite.url | trimPrefix "http://$(METADATA_METRICS_SVC).$(NAMESPACE).svc.cluster.local.:9888" | quote) -}}
{{- $endpoints = append $endpoints ($remoteWrite.url | trimPrefix "http://$(METADATA_METRICS_SVC).$(NAMESPACE):9888" | quote) -}}
{{- end }}
{{- range $remoteWrite := $kps.prometheus.prometheusSpec.additionalRemoteWrite }}
{{- $endpoints = append $endpoints ($remoteWrite.url | trimPrefix "http://$(METADATA_METRICS_SVC).$(NAMESPACE).svc.cluster.local.:9888" | quote) -}}
{{- $endpoints = append $endpoints ($remoteWrite.url | trimPrefix "http://$(METADATA_METRICS_SVC).$(NAMESPACE):9888" | quote) -}}
{{- end -}}
aboguszewski-sumo marked this conversation as resolved.
Show resolved Hide resolved
{{- range $endpoint := .Values.metadata.metrics.config.additionalEndpoints }}
{{- $endpoints = append $endpoints ($endpoint | quote) -}}
Expand Down
7 changes: 6 additions & 1 deletion deploy/helm/sumologic/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ sumologic:
## Cluster name: Note spaces are not allowed and will be replaced with dashes.
clusterName: "kubernetes"

## Cluster DNS Domain
## We use the DNS domain in internal urls to speed up DNS resolution, see https://github.com/kubernetes/kubernetes/issues/56903
## Change this if you have set a non-default DNS domain in your cluster
clusterDNSDomain: "cluster.local"

## Configuration of Kubernetes for Terraform client
## https://www.terraform.io/docs/providers/kubernetes/index.html#argument-reference
## All double quotes should be escaped here regarding Terraform syntax
Expand Down Expand Up @@ -1226,7 +1231,7 @@ kube-prometheus-stack:
action: replace
remoteWrite:
## infrastructure metrics
- url: http://$(METADATA_METRICS_SVC).$(NAMESPACE).svc.cluster.local.:9888/prometheus.metrics
- url: http://$(METADATA_METRICS_SVC).$(NAMESPACE):9888/prometheus.metrics
remoteTimeout: 5s

serviceMonitor:
Expand Down
3 changes: 3 additions & 0 deletions tests/integration/values/values_common.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ sumologic:
accessKey: "dummy"
endpoint: http://receiver-mock.receiver-mock:3000/terraform/api/

# This is set in yamls/cluster.yaml to check if we work correctly with a custom domain
clusterDNSDomain: "my.cluster"

metrics:
collector:
otelcol:
Expand Down
3 changes: 3 additions & 0 deletions tests/integration/yamls/cluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ nodes:
# these changes allow us to scrape control plane metrics
# see kind docs on customizing kubeadm: https://kind.sigs.k8s.io/docs/user/configuration/#kubeadm-config-patches
# and kubeadm docs on configuring control plane components: https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/control-plane-flags/
# The DNS domain is changed to verify we work correctly in that environment
- |
kind: ClusterConfiguration
scheduler:
Expand All @@ -19,3 +20,5 @@ nodes:
dataDir: /tmp/etcd
extraArgs:
listen-metrics-urls: http://0.0.0.0:2381
networking:
dnsDomain: "my.cluster"