Skip to content

Commit

Permalink
Added custom image pull secrets integ test
Browse files Browse the repository at this point in the history
  • Loading branch information
chan-tim-sumo committed Jul 24, 2024
1 parent 2ea0cff commit 324ee68
Show file tree
Hide file tree
Showing 14 changed files with 208 additions and 30 deletions.
1 change: 1 addition & 0 deletions .changelog/3808.changed.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
test: Added custom image pull secrets tests for global configuration attributes
3 changes: 3 additions & 0 deletions deploy/helm/sumologic/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ The following table lists the configurable parameters of the Sumo Logic chart an
| `kube-prometheus-stack.kube-state-metrics.resources` | Resource limits for kube state metrics. Uses sub-chart defaults. | `{"limits": {"cpu": "100m", "memory": "64Mi"}, "requests": {"cpu": "10m", "memory": "32Mi"}}` |
| `kube-prometheus-stack.kube-state-metrics.customLabels` | Custom labels to apply to service, deployment and pods. Uses sub-chart defaults. | `{}` |
| `kube-prometheus-stack.kube-state-metrics.podAnnotations` | Additional annotations for pods in the DaemonSet. Uses sub-chart defaults. | `{}` |
| `kube-prometheus-stack.kube-state-metrics.imagePullSecrets` | Pull secrets for falco images. For more information on using Kubernetes secrets with container registries please refer to [Creating a Secret with a Docker config at kubernetes.io](https://kubernetes.io/docs/concepts/containers/images/ | `[]` |
| `kube-prometheus-stack.prometheus.enabled` | Enable Prometheus | `false` |
| `kube-prometheus-stack.prometheus.additionalServiceMonitors` | List of ServiceMonitor objects to create. | See [values.yaml] |
| `kube-prometheus-stack.prometheus.prometheusSpec.image.repository` | Container repository for Prometheus. | `public.ecr.aws/sumologic/prometheus` |
Expand All @@ -240,6 +241,7 @@ The following table lists the configurable parameters of the Sumo Logic chart an
| `kube-prometheus-stack.prometheus-node-exporter.image.repository` | Prometheus Node Exporter container image repository. | `public.ecr.aws/sumologic/node-exporter` |
| `kube-prometheus-stack.prometheus-node-exporter.podLabels` | Additional labels for prometheus-node-exporter pods. | `{}` |
| `kube-prometheus-stack.prometheus-node-exporter.podAnnotations` | Additional annotations for prometheus-node-exporter pods. | `{}` |
| `kube-prometheus-stack.prometheus-node-exporter.imagePullSecrets` | Pull secrets for falco images. For more information on using Kubernetes secrets with container registries please refer to [Creating a Secret with a Docker config at kubernetes.io](https://kubernetes.io/docs/concepts/containers/images/ | `[]` |
| `kube-prometheus-stack.prometheus-node-exporter.resources` | Resource limits for node exporter. Uses sub-chart defaults. | `{"limits": {"cpu": "200m", "memory": "50Mi"}, "requests": {"cpu": "100m", "memory": "30Mi"}}` |
| `kube-prometheus-stack.prometheus-node-exporter.nodeSelector` | Node selector for prometheus node exporter. [See help.sumologic.com/docs/send-data/kubernetes/best-practices for more information.](https://help.sumologic.com/docs/send-data/kubernetes/best-practices/) | `{"kubernetes.io/os": "linux"}` |
| `kube-prometheus-stack.kube-state-metrics.nodeSelector` | Node selector for kube-state-metrics. [See help.sumologic.com/docs/send-data/kubernetes/best-practices for more information.](https://help.sumologic.com/docs/send-data/kubernetes/best-practices/) | `{"kubernetes.io/os": "linux"}` |
Expand Down Expand Up @@ -378,6 +380,7 @@ The following table lists the configurable parameters of the Sumo Logic chart an
| `tracesGateway.autoscaling.maxReplicas` | Default max replicas for autoscaling | `10` |
| `tracesGateway.autoscaling.targetCPUUtilizationPercentage` | The desired target CPU utilization for autoscaling. | `100` |
| `tracesGateway.autoscaling.targetMemoryUtilizationPercentage` | The desired target memory utilization for autoscaling. | `50` |
| `tracesGateway.deployment.imagePullSecrets` | Pull secrets for falco images. For more information on using Kubernetes secrets with container registries please refer to [Creating a Secret with a Docker config at kubernetes.io](https://kubernetes.io/docs/concepts/containers/images/ | `[]` |
| `tracesGateway.deployment.replicas` | Set the number of OpenTelemetry Collector replicas. | `1` |
| `tracesGateway.deployment.nodeSelector` | Node selector for otelcol deployment. [See help.sumologic.com/docs/send-data/kubernetes/best-practices for more information.](https://help.sumologic.com/docs/send-data/kubernetes/best-practices/) | `{}` |
| `tracesGateway.deployment.priorityClassName` | Priority class name for OpenTelemetry Collector log pods. | `Nil` |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ spec:
{{ toYaml .Values.otelevents.statefulset.podLabels | indent 8 }}
{{- end }}
spec:
{{- if $.Values.sumologic.pullSecrets }}
imagePullSecrets:
{{- range $.Values.sumologic.pullSecrets }}
- name: {{ .name }}
{{- end }}
{{- end }}
serviceAccountName: {{ template "sumologic.metadata.name.roles.serviceaccount" . }}
{{- if not (empty (include "events.statefulset.nodeSelector" .)) }}
nodeSelector:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@ spec:
{{ toYaml $otelcolInstrumentation.statefulset.podLabels | indent 8 }}
{{- end }}
spec:
{{- if $.Values.sumologic.pullSecrets }}
imagePullSecrets:
{{- range $.Values.sumologic.pullSecrets }}
- name: {{ .name }}
{{- end }}
{{- end }}
serviceAccountName: {{ template "sumologic.metadata.name.roles.serviceaccount" . }}
{{- if not (empty (include "otelcolInstrumentation.statefulset.nodeSelector" .)) }}
nodeSelector:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@ spec:
{{ toYaml $tracesGateway.deployment.podLabels | indent 8 }}
{{- end }}
spec:
{{- if $.Values.sumologic.pullSecrets }}
imagePullSecrets:
{{- range $.Values.sumologic.pullSecrets }}
- name: {{ .name }}
{{- end }}
{{- end }}
serviceAccountName: {{ template "sumologic.metadata.name.roles.serviceaccount" . }}
{{- if not (empty (include "tracesGateway.deployment.nodeSelector" .)) }}
nodeSelector:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@ spec:
{{ toYaml $tracesSampler.deployment.podLabels | indent 8 }}
{{- end }}
spec:
{{- if $.Values.sumologic.pullSecrets }}
imagePullSecrets:
{{- range $.Values.sumologic.pullSecrets }}
- name: {{ .name }}
{{- end }}
{{- end }}
serviceAccountName: {{ template "sumologic.metadata.name.roles.serviceaccount" . }}
{{- if not (empty (include "tracesSampler.deployment.nodeSelector" .)) }}
nodeSelector:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{{- $instance := "" -}}
{{- $defaultTolerations := (include "sumologic.logs.collector.tolerations" .) }}
{{- $defaultAffinity := (include "kubernetes.defaultAffinity" .) }}
{{- $daemonsets := dict "" $.Values.otellogs.daemonset -}}
{{- $daemonsets := dict "" $.Values.otellogs.daemonset -}}
{{- $daemonsets = deepCopy $daemonsets | merge $.Values.otellogs.additionalDaemonSets -}}
{{- range $name, $daemonset := $daemonsets }}
{{- $defaultDaemonset := deepCopy $.Values.otellogs.daemonset }}
Expand All @@ -29,17 +29,17 @@ apiVersion: apps/v1
kind: DaemonSet
metadata:
name: {{ printf "%s%s" (include "sumologic.metadata.name.logs.collector.daemonset" $ctx) $instance | trunc 63 | trimSuffix "-" }}
namespace: {{ template "sumologic.namespace" $ctx }}
namespace: {{ template "sumologic.namespace" $ctx }}
{{- if $daemonset.annotations }}
annotations:
{{ toYaml $daemonset.annotations| indent 4 }}
{{- end }}
{{ toYaml $daemonset.annotations | indent 4 }}
{{- end }}
labels:
app: {{ template "sumologic.labels.app.logs.collector.daemonset" $ctx }}
{{- include "sumologic.labels.common" $ctx | nindent 4 }}
{{- if $daemonset.labels }}
{{- if $daemonset.labels }}
{{ toYaml $daemonset.labels | indent 4 }}
{{- end }}
{{- end }}
spec:
selector:
matchLabels:
Expand All @@ -48,35 +48,41 @@ spec:
metadata:
annotations:
checksum/config: {{ include (print $.Template.BasePath "/logs/collector/otelcol/configmap.yaml") $ctx | sha256sum }}
{{- if $.Values.sumologic.podAnnotations }}
{{- if $.Values.sumologic.podAnnotations }}
{{ toYaml $.Values.sumologic.podAnnotations | indent 8 }}
{{- end }}
{{- if $daemonset.podAnnotations }}
{{- end }}
{{- if $daemonset.podAnnotations }}
{{ toYaml $daemonset.podAnnotations | indent 8 }}
{{- end }}
{{- end }}
labels:
app.kubernetes.io/name: {{ printf "%s%s" (include "sumologic.labels.app.logs.collector.pod" $ctx) $instance | trunc 63 | trimSuffix "-" }}
app.kubernetes.io/app-name: {{ (include "sumologic.labels.app.logs.collector.pod" $ctx) | trunc 63 | trimSuffix "-" }}
{{- include "sumologic.labels.common" $ctx | nindent 8 }}
{{- if $.Values.sumologic.podLabels }}
{{- if $.Values.sumologic.podLabels }}
{{ toYaml $.Values.sumologic.podLabels | indent 8 }}
{{- end }}
{{- if $daemonset.podLabels }}
{{- end }}
{{- if $daemonset.podLabels }}
{{ toYaml $daemonset.podLabels | indent 8 }}
{{- end }}
{{- end }}
spec:
{{- if $nodeSelector }}
{{- if $nodeSelector }}
nodeSelector:
{{ $nodeSelector | indent 8 }}
{{- end }}
{{- if $affinity }}
{{- end }}
{{- if $affinity }}
affinity:
{{ $affinity | indent 8 }}
{{- end }}
{{- if $tolerations }}
{{- end }}
{{- if $tolerations }}
tolerations:
{{ $tolerations | indent 8 }}
{{- end }}
{{- if $.Values.sumologic.pullSecrets }}
imagePullSecrets:
{{- range $.Values.sumologic.pullSecrets }}
- name: {{ .name }}
{{- end }}
{{- end }}
securityContext:
{{- toYaml $daemonset.securityContext | nindent 8 }}
{{- if $daemonset.priorityClassName }}
Expand Down Expand Up @@ -114,9 +120,9 @@ spec:
- mountPath: /var/log/journal
name: varlogjournal
readOnly: true
{{- if $daemonset.extraVolumeMounts }}
{{- if $daemonset.extraVolumeMounts }}
{{ toYaml $daemonset.extraVolumeMounts | indent 8 }}
{{- end }}
{{- end }}
env:
- name: LOGS_METADATA_SVC
valueFrom:
Expand All @@ -127,9 +133,9 @@ spec:
valueFrom:
fieldRef:
fieldPath: metadata.namespace
{{- if $daemonset.extraEnvVars }}
{{- if $daemonset.extraEnvVars }}
{{ toYaml $daemonset.extraEnvVars | nindent 8 }}
{{- end }}
{{- end }}
securityContext:
{{- toYaml $daemonset.containers.otelcol.securityContext | nindent 10 }}
ports:
Expand Down Expand Up @@ -180,13 +186,13 @@ spec:
path: /var/log/journal/
type: ""
name: varlogjournal
{{- if $daemonset.extraVolumes }}
{{- if $daemonset.extraVolumes }}
{{ toYaml $daemonset.extraVolumes | indent 6 }}
{{- end }}
{{- end }}
serviceAccountName: {{ template "sumologic.metadata.name.logs.collector.serviceaccount" $ctx }}
{{- if $daemonset.updateStrategy }}
{{- if $daemonset.updateStrategy }}
updateStrategy:
{{ toYaml $daemonset.updateStrategy | indent 4 }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
6 changes: 6 additions & 0 deletions deploy/helm/sumologic/templates/logs/otelcol/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@ spec:
{{ toYaml .Values.metadata.logs.statefulset.podLabels | indent 8 }}
{{- end }}
spec:
{{- if $.Values.sumologic.pullSecrets }}
imagePullSecrets:
{{- range $.Values.sumologic.pullSecrets }}
- name: {{ .name }}
{{- end }}
{{- end }}
serviceAccountName: {{ template "sumologic.metadata.name.roles.serviceaccount" . }}
{{- if not (empty (include "metadata.logs.statefulset.nodeSelector" .)) }}
nodeSelector:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@ spec:
{{ toYaml .Values.metadata.metrics.statefulset.podLabels | indent 8 }}
{{- end }}
spec:
{{- if $.Values.sumologic.pullSecrets }}
imagePullSecrets:
{{- range $.Values.sumologic.pullSecrets }}
- name: {{ .name }}
{{- end }}
{{- end }}
serviceAccountName: {{ template "sumologic.metadata.name.roles.serviceaccount" . }}
{{- if not (empty (include "metadata.metrics.statefulset.nodeSelector" .)) }}
nodeSelector:
Expand Down
6 changes: 6 additions & 0 deletions deploy/helm/sumologic/templates/setup/job.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ spec:
{{- end }}
spec:
restartPolicy: OnFailure
{{- if $.Values.sumologic.pullSecrets }}
imagePullSecrets:
{{- range $.Values.sumologic.pullSecrets }}
- name: {{ .name }}
{{- end }}
{{- end }}
serviceAccountName: {{ template "sumologic.metadata.name.setup.roles.serviceaccount" . }}
{{- if not (empty (include "setup.job.nodeSelector" .)) }}
nodeSelector:
Expand Down
Loading

0 comments on commit 324ee68

Please sign in to comment.