From 76bcdaaf529ee27685e7105f8c113de0a495976e Mon Sep 17 00:00:00 2001 From: Madison Grubb Date: Wed, 13 Mar 2024 16:45:26 -0400 Subject: [PATCH 1/8] move chart to subdirectory. make the image config much simpler --- .gitignore | 2 +- .helmignore => charts/netobserv/.helmignore | 0 Chart.lock => charts/netobserv/Chart.lock | 0 Chart.yaml => charts/netobserv/Chart.yaml | 0 .../netobserv/templates}/_helpers.tpl | 36 +++++++++---------- .../netobserv/templates}/deployment.yaml | 4 +-- .../netobserv/templates}/service.yaml | 0 .../netobserv/templates}/serviceaccount.yaml | 0 values.yaml => charts/netobserv/values.yaml | 1 - 9 files changed, 19 insertions(+), 24 deletions(-) rename .helmignore => charts/netobserv/.helmignore (100%) rename Chart.lock => charts/netobserv/Chart.lock (100%) rename Chart.yaml => charts/netobserv/Chart.yaml (100%) rename {templates => charts/netobserv/templates}/_helpers.tpl (60%) rename {templates/netobserv => charts/netobserv/templates}/deployment.yaml (94%) rename {templates/netobserv => charts/netobserv/templates}/service.yaml (100%) rename {templates/netobserv => charts/netobserv/templates}/serviceaccount.yaml (100%) rename values.yaml => charts/netobserv/values.yaml (99%) diff --git a/.gitignore b/.gitignore index fcb7db5..c1ccfe1 100644 --- a/.gitignore +++ b/.gitignore @@ -7,4 +7,4 @@ # Misc tmp.* -charts/** +charts/netobserv/charts/** diff --git a/.helmignore b/charts/netobserv/.helmignore similarity index 100% rename from .helmignore rename to charts/netobserv/.helmignore diff --git a/Chart.lock b/charts/netobserv/Chart.lock similarity index 100% rename from Chart.lock rename to charts/netobserv/Chart.lock diff --git a/Chart.yaml b/charts/netobserv/Chart.yaml similarity index 100% rename from Chart.yaml rename to charts/netobserv/Chart.yaml diff --git a/templates/_helpers.tpl b/charts/netobserv/templates/_helpers.tpl similarity index 60% rename from templates/_helpers.tpl rename to charts/netobserv/templates/_helpers.tpl index c0a053e..991ba00 100644 --- a/templates/_helpers.tpl +++ b/charts/netobserv/templates/_helpers.tpl @@ -2,7 +2,23 @@ Expand the name of the chart. */}} {{- define "netobserv.name" -}} -{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Create a default fully qualified app name. +*/}} +{{- define "netobserv.fullname" -}} +{{- if .Values.fullnameOverride }} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- $name := default .Chart.Name .Values.nameOverride }} +{{- if contains $name .Release.Name }} +{{- .Release.Name | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} +{{- end }} +{{- end }} {{- end }} {{/* @@ -31,21 +47,3 @@ Selector labels app.kubernetes.io/name: {{ include "netobserv.name" . }} app.kubernetes.io/instance: {{ .Release.Name }} {{- end -}} - -{{/* -Create image name and tag used by the deployment. -*/}} -{{- define "netobserv.image" -}} -{{- $fullOverride := .Values.image.fullOverride | default "" -}} -{{- $registry := .Values.image.registry | default .Values.image.registry -}} -{{- $repository := .Values.image.repository -}} -{{- $separator := ":" -}} -{{- $tag := .Values.image.tag | default .Chart.AppVersion -}} -{{- if $fullOverride }} - {{- printf "%s" $fullOverride -}} -{{- else if $registry }} - {{- printf "%s/%s%s%s" $registry $repository $separator $tag -}} -{{- else -}} - {{- printf "%s%s%s" $repository $separator $tag -}} -{{- end -}} -{{- end -}} \ No newline at end of file diff --git a/templates/netobserv/deployment.yaml b/charts/netobserv/templates/deployment.yaml similarity index 94% rename from templates/netobserv/deployment.yaml rename to charts/netobserv/templates/deployment.yaml index 1c6bb38..562938c 100644 --- a/templates/netobserv/deployment.yaml +++ b/charts/netobserv/templates/deployment.yaml @@ -44,9 +44,7 @@ spec: restartPolicy: Always containers: - name: {{ include "netobserv.name" . }} - # image: "elastiflow/flow-collector:{{ .Values.image.tag }}" - image: "{{ include "netobserv.image" . }}" - imagePullPolicy: {{ .Values.image.pullPolicy }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" {{- if .Values.args }} args: {{- .Values.args | toYaml | nindent 12 }} diff --git a/templates/netobserv/service.yaml b/charts/netobserv/templates/service.yaml similarity index 100% rename from templates/netobserv/service.yaml rename to charts/netobserv/templates/service.yaml diff --git a/templates/netobserv/serviceaccount.yaml b/charts/netobserv/templates/serviceaccount.yaml similarity index 100% rename from templates/netobserv/serviceaccount.yaml rename to charts/netobserv/templates/serviceaccount.yaml diff --git a/values.yaml b/charts/netobserv/values.yaml similarity index 99% rename from values.yaml rename to charts/netobserv/values.yaml index 861c5db..0a742a6 100644 --- a/values.yaml +++ b/charts/netobserv/values.yaml @@ -94,7 +94,6 @@ service: labels: {} image: - registry: "" repository: elastiflow/flow-collector tag: "" pullPolicy: IfNotPresent From 1eae35b98b02d39d3704a03d9b7f223dd0761974 Mon Sep 17 00:00:00 2001 From: "Keli (Madison) Grubb" Date: Wed, 13 Mar 2024 16:54:58 -0400 Subject: [PATCH 2/8] Update charts/netobserv/values.yaml Co-authored-by: Mack (Maksym Iv) <146473578+maksym-iv-elf@users.noreply.github.com> --- charts/netobserv/values.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/charts/netobserv/values.yaml b/charts/netobserv/values.yaml index 0a742a6..faa5305 100644 --- a/charts/netobserv/values.yaml +++ b/charts/netobserv/values.yaml @@ -95,6 +95,7 @@ service: image: repository: elastiflow/flow-collector + # Overrides the image tag whose default is the chart appVersion. tag: "" pullPolicy: IfNotPresent From 853bd207d915025d53384b26da8e7a93e68587ac Mon Sep 17 00:00:00 2001 From: Madison Grubb Date: Wed, 13 Mar 2024 17:44:32 -0400 Subject: [PATCH 3/8] update chart with defaults --- .github/workflows/helm_checks.yml | 6 +- charts/netobserv/Chart.lock | 2 +- charts/netobserv/Chart.yaml | 4 +- charts/netobserv/templates/_helpers.tpl | 27 ++- charts/netobserv/templates/deployment.yaml | 77 ++++----- charts/netobserv/templates/hpa.yaml | 32 ++++ charts/netobserv/templates/ingress.yaml | 61 +++++++ charts/netobserv/templates/service.yaml | 20 +-- .../netobserv/templates/serviceaccount.yaml | 14 +- charts/netobserv/values.yaml | 157 ++++++++++-------- 10 files changed, 248 insertions(+), 152 deletions(-) create mode 100644 charts/netobserv/templates/hpa.yaml create mode 100644 charts/netobserv/templates/ingress.yaml diff --git a/.github/workflows/helm_checks.yml b/.github/workflows/helm_checks.yml index 8fd322f..1b1a4d7 100644 --- a/.github/workflows/helm_checks.yml +++ b/.github/workflows/helm_checks.yml @@ -34,7 +34,11 @@ jobs: fi - name: Run chart-testing (lint) if: steps.list-changed.outputs.changed == 'true' - run: ct lint --target-branch ${{ github.event.repository.default_branch }} + run: | + helm repo add eck-operator https://helm.elastic.co + helm repo add opensearch https://opensearch-project.github.io/helm-charts/ + helm dep build charts/netobserv + ct lint --target-branch ${{ github.event.repository.default_branch }} - name: Create kind cluster if: steps.list-changed.outputs.changed == 'true' diff --git a/charts/netobserv/Chart.lock b/charts/netobserv/Chart.lock index 8bdf149..4f3e89f 100644 --- a/charts/netobserv/Chart.lock +++ b/charts/netobserv/Chart.lock @@ -6,4 +6,4 @@ dependencies: repository: https://opensearch-project.github.io/helm-charts/ version: 2.12.2 digest: sha256:64f09ea1ac0c6cd6ea15eb5b360dcfa97417c19d4f3bea5a7e901a1193ca7990 -generated: "2024-03-12T10:57:35.890043-04:00" +generated: "2024-03-13T17:31:53.787976-04:00" diff --git a/charts/netobserv/Chart.yaml b/charts/netobserv/Chart.yaml index 909e8f4..11f9362 100644 --- a/charts/netobserv/Chart.yaml +++ b/charts/netobserv/Chart.yaml @@ -21,11 +21,11 @@ maintainers: dependencies: # https://github.com/elastic/cloud-on-k8s - name: eck-operator - repository: https://helm.elastic.co + repository: "https://helm.elastic.co" version: "2.11.*" condition: elasticsearch.enabled # https://opensearch.org/docs/latest/install-and-configure/install-opensearch/helm/ - name: opensearch - repository: https://opensearch-project.github.io/helm-charts/ + repository: "https://opensearch-project.github.io/helm-charts/" version: "2.12.*" condition: opensearch.enabled \ No newline at end of file diff --git a/charts/netobserv/templates/_helpers.tpl b/charts/netobserv/templates/_helpers.tpl index 991ba00..0b2a7a8 100644 --- a/charts/netobserv/templates/_helpers.tpl +++ b/charts/netobserv/templates/_helpers.tpl @@ -7,6 +7,8 @@ Expand the name of the chart. {{/* Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +If release name contains chart name it will be used as a full name. */}} {{- define "netobserv.fullname" -}} {{- if .Values.fullnameOverride }} @@ -25,20 +27,20 @@ Create a default fully qualified app name. Create chart name and version as used by the chart label. */}} {{- define "netobserv.chart" -}} -{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} -{{- end -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} {{/* Common labels */}} {{- define "netobserv.labels" -}} helm.sh/chart: {{ include "netobserv.chart" . }} -app: {{ include "netobserv.name" . }} {{ include "netobserv.selectorLabels" . }} -app.kubernetes.io/version: {{ .Values.image.tag | default .Chart.AppVersion | quote }} -version: {{ .Values.image.tag | default .Chart.AppVersion | quote }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} app.kubernetes.io/managed-by: {{ .Release.Service }} -{{- end -}} +{{- end }} {{/* Selector labels @@ -46,4 +48,15 @@ Selector labels {{- define "netobserv.selectorLabels" -}} app.kubernetes.io/name: {{ include "netobserv.name" . }} app.kubernetes.io/instance: {{ .Release.Name }} -{{- end -}} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "netobserv.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "netobserv.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} diff --git a/charts/netobserv/templates/deployment.yaml b/charts/netobserv/templates/deployment.yaml index 562938c..80eb894 100644 --- a/charts/netobserv/templates/deployment.yaml +++ b/charts/netobserv/templates/deployment.yaml @@ -1,28 +1,16 @@ apiVersion: apps/v1 kind: Deployment metadata: - name: {{ include "netobserv.name" . }} - annotations: - {{- if .Values.deployment.annotations }} - {{- toYaml .Values.deployment.annotations | nindent 4 }} - {{- end }} + name: {{ include "netobserv.fullname" . }} labels: {{- include "netobserv.labels" . | nindent 4 }} spec: + {{- if not .Values.autoscaling.enabled }} replicas: {{ .Values.replicaCount }} - strategy: - type: {{ .Values.strategy.type }} - {{- if eq .Values.strategy.type "RollingUpdate" }} - rollingUpdate: - maxUnavailable: {{ .Values.strategy.rollingUpdate.maxUnavailable }} - maxSurge: {{ .Values.strategy.rollingUpdate.maxSurge }} - {{- end }} + {{- end }} selector: matchLabels: {{- include "netobserv.selectorLabels" . | nindent 6 }} - {{- if .Values.deployment.labels }} - {{- toYaml .Values.deployment.labels | nindent 6 }} - {{- end }} template: metadata: {{- with .Values.podAnnotations }} @@ -31,61 +19,54 @@ spec: {{- end }} labels: {{- include "netobserv.labels" . | nindent 8 }} - {{- if .Values.deployment.labels }} - {{- toYaml .Values.deployment.labels | nindent 8 }} + {{- with .Values.podLabels }} + {{- toYaml . | nindent 8 }} {{- end }} spec: - {{- if (or .Values.serviceAccount.create .Values.serviceAccount.name) }} - serviceAccountName: {{ include "gitea.serviceAccountName" . }} + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} {{- end }} + serviceAccountName: {{ include "netobserv.serviceAccountName" . }} securityContext: {{- toYaml .Values.podSecurityContext | nindent 8 }} - terminationGracePeriodSeconds: {{ .Values.deployment.terminationGracePeriodSeconds }} - restartPolicy: Always containers: - - name: {{ include "netobserv.name" . }} + - name: {{ .Chart.Name }} + securityContext: + {{- toYaml .Values.securityContext | nindent 12 }} image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" - {{- if .Values.args }} - args: - {{- .Values.args | toYaml | nindent 12 }} - {{- end }} + imagePullPolicy: {{ .Values.image.pullPolicy }} env: {{- with .Values.env }} {{- toYaml . | nindent 12 }} {{- end }} ports: - - name: udp + - name: http containerPort: {{ .Values.service.port }} - protocol: UDP - {{- if .Values.netobserv.livenessProbe.enabled }} + protocol: TCP livenessProbe: - {{- toYaml (omit .Values.netobserv.livenessProbe "enabled") | nindent 12 }} - {{- end }} - {{- if .Values.netobserv.readinessProbe.enabled }} + {{- toYaml .Values.livenessProbe | nindent 12 }} readinessProbe: - {{- toYaml (omit .Values.netobserv.readinessProbe "enabled") | nindent 12 }} - {{- end }} - {{- if .Values.netobserv.startupProbe.enabled }} - startupProbe: - {{- toYaml (omit .Values.netobserv.startupProbe "enabled") | nindent 12 }} - {{- end }} + {{- toYaml .Values.readinessProbe | nindent 12 }} resources: {{- toYaml .Values.resources | nindent 12 }} - securityContext: - {{- toYaml .Values.securityContext | nindent 12 }} + {{- with .Values.volumeMounts }} + volumeMounts: + {{- toYaml . | nindent 12 }} + {{- end }} + {{- with .Values.volumes }} + volumes: + {{- toYaml . | nindent 8 }} + {{- end }} {{- with .Values.nodeSelector }} nodeSelector: {{- toYaml . | nindent 8 }} {{- end }} {{- with .Values.affinity }} - affinity: - {{- toYaml . | nindent 8 }} - {{- end }} - {{- with .Values.topologySpreadConstraints }} - topologySpreadConstraints: - {{- toYaml . | nindent 8 }} + affinity: + {{- toYaml . | nindent 8 }} {{- end }} {{- with .Values.tolerations }} - tolerations: - {{- toYaml . | nindent 8 }} + tolerations: + {{- toYaml . | nindent 8 }} {{- end }} diff --git a/charts/netobserv/templates/hpa.yaml b/charts/netobserv/templates/hpa.yaml new file mode 100644 index 0000000..b8962c5 --- /dev/null +++ b/charts/netobserv/templates/hpa.yaml @@ -0,0 +1,32 @@ +{{- if .Values.autoscaling.enabled }} +apiVersion: autoscaling/v2 +kind: HorizontalPodAutoscaler +metadata: + name: {{ include "netobserv.fullname" . }} + labels: + {{- include "netobserv.labels" . | nindent 4 }} +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: {{ include "netobserv.fullname" . }} + minReplicas: {{ .Values.autoscaling.minReplicas }} + maxReplicas: {{ .Values.autoscaling.maxReplicas }} + metrics: + {{- if .Values.autoscaling.targetCPUUtilizationPercentage }} + - type: Resource + resource: + name: cpu + target: + type: Utilization + averageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }} + {{- end }} + {{- if .Values.autoscaling.targetMemoryUtilizationPercentage }} + - type: Resource + resource: + name: memory + target: + type: Utilization + averageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }} + {{- end }} +{{- end }} diff --git a/charts/netobserv/templates/ingress.yaml b/charts/netobserv/templates/ingress.yaml new file mode 100644 index 0000000..2e2725c --- /dev/null +++ b/charts/netobserv/templates/ingress.yaml @@ -0,0 +1,61 @@ +{{- if .Values.ingress.enabled -}} +{{- $fullName := include "netobserv.fullname" . -}} +{{- $svcPort := .Values.service.port -}} +{{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }} + {{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }} + {{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}} + {{- end }} +{{- end }} +{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.k8s.io/v1 +{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.k8s.io/v1beta1 +{{- else -}} +apiVersion: extensions/v1beta1 +{{- end }} +kind: Ingress +metadata: + name: {{ $fullName }} + labels: + {{- include "netobserv.labels" . | nindent 4 }} + {{- with .Values.ingress.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + {{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }} + ingressClassName: {{ .Values.ingress.className }} + {{- end }} + {{- if .Values.ingress.tls }} + tls: + {{- range .Values.ingress.tls }} + - hosts: + {{- range .hosts }} + - {{ . | quote }} + {{- end }} + secretName: {{ .secretName }} + {{- end }} + {{- end }} + rules: + {{- range .Values.ingress.hosts }} + - host: {{ .host | quote }} + http: + paths: + {{- range .paths }} + - path: {{ .path }} + {{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }} + pathType: {{ .pathType }} + {{- end }} + backend: + {{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }} + service: + name: {{ $fullName }} + port: + number: {{ $svcPort }} + {{- else }} + serviceName: {{ $fullName }} + servicePort: {{ $svcPort }} + {{- end }} + {{- end }} + {{- end }} +{{- end }} diff --git a/charts/netobserv/templates/service.yaml b/charts/netobserv/templates/service.yaml index dc3623b..0ddd53b 100644 --- a/charts/netobserv/templates/service.yaml +++ b/charts/netobserv/templates/service.yaml @@ -1,27 +1,15 @@ -{{- if .Values.service.enabled -}} apiVersion: v1 kind: Service metadata: - name: {{ include "netobserv.name" . }} + name: {{ include "netobserv.fullname" . }} labels: {{- include "netobserv.labels" . | nindent 4 }} - {{- if .Values.service.labels }} - {{- toYaml .Values.service.labels | nindent 4 }} - {{- end }} - annotations: - {{- toYaml .Values.service.annotations | nindent 4 }} spec: type: {{ .Values.service.type }} ports: - - name: udp - port: {{ .Values.service.port }} - {{- if .Values.service.targetPort }} - targetPort: {{ .Values.service.targetPort }} - {{- end }} + - port: {{ .Values.service.port }} + targetPort: 9995 protocol: UDP - {{- if .Values.service.nodePort }} - nodePort: {{ .Values.service.nodePort }} - {{- end }} + name: udp selector: {{- include "netobserv.selectorLabels" . | nindent 4 }} -{{- end }} diff --git a/charts/netobserv/templates/serviceaccount.yaml b/charts/netobserv/templates/serviceaccount.yaml index f12b708..5037925 100644 --- a/charts/netobserv/templates/serviceaccount.yaml +++ b/charts/netobserv/templates/serviceaccount.yaml @@ -1,21 +1,13 @@ -{{- if .Values.serviceAccount.create }} +{{- if .Values.serviceAccount.create -}} apiVersion: v1 kind: ServiceAccount metadata: name: {{ include "netobserv.serviceAccountName" . }} - namespace: {{ template "netobserv.namespace" . }} labels: {{- include "netobserv.labels" . | nindent 4 }} - {{- with .Values.serviceAccount.labels }} - {{- . | toYaml | nindent 4 }} - {{- end }} {{- with .Values.serviceAccount.annotations }} annotations: - {{- . | toYaml | nindent 4 }} + {{- toYaml . | nindent 4 }} {{- end }} -automountServiceAccountToken: {{ .Values.serviceAccount.automountServiceAccountToken }} -{{- with .Values.serviceAccount.imagePullSecrets }} -imagePullSecrets: - {{- . | toYaml | nindent 2 }} -{{- end }} +automountServiceAccountToken: {{ .Values.serviceAccount.automount }} {{- end }} diff --git a/charts/netobserv/values.yaml b/charts/netobserv/values.yaml index 0a742a6..3b7bd79 100644 --- a/charts/netobserv/values.yaml +++ b/charts/netobserv/values.yaml @@ -6,30 +6,13 @@ opensearch: elasticsearch: enabled: true -deployment: - env: [] - terminationGracePeriodSeconds: 60 - labels: {} - annotations: {} - replicaCount: 1 -strategy: - type: "RollingUpdate" - rollingUpdate: - maxSurge: "100%" - maxUnavailable: 0 - -serviceAccount: - create: false - name: "" - automountServiceAccountToken: false - imagePullSecrets: [] - annotations: {} - labels: {} - -podAnnotations: {} -args: {} +image: + repository: elastiflow/flow-collector + pullPolicy: IfNotPresent + # Overrides the image tag whose default is the chart appVersion. + tag: "" env: - name: EF_LICENSE_ACCEPTED @@ -84,59 +67,101 @@ env: # EF_OUTPUT_GENERIC_HTTP_ADDRESSES: '' # EF_OUTPUT_RISKIQ_ENABLE: 'false' + +imagePullSecrets: [] +nameOverride: "" +fullnameOverride: "" + +serviceAccount: + # Specifies whether a service account should be created + create: false + # Automatically mount a ServiceAccount's API credentials? + automount: false + # Annotations to add to the service account + annotations: {} + # The name of the service account to use. + # If not set and create is true, a name is generated using the fullname template + name: "" + +podAnnotations: {} +podLabels: {} + +podSecurityContext: + runAsNonRoot: true + runAsUser: 1000 + runAsGroup: 1000 + +securityContext: {} + # capabilities: + # drop: + # - ALL + # readOnlyRootFilesystem: true + # runAsNonRoot: true + # runAsUser: 1000 + service: - enabled: true type: ClusterIP - port: 9995 - targetPort: 9995 - nodePort: - annotations: {} - labels: {} + port: 80 -image: - repository: elastiflow/flow-collector - tag: "" - pullPolicy: IfNotPresent +ingress: + enabled: false + className: "" + annotations: {} + # kubernetes.io/ingress.class: nginx + # kubernetes.io/tls-acme: "true" + hosts: + - host: chart-example.local + paths: + - path: / + pathType: ImplementationSpecific + tls: [] + # - secretName: chart-example-tls + # hosts: + # - chart-example.local resources: limits: - cpu: 200m - memory: 256Mi + cpu: 100m + memory: 128Mi requests: cpu: 100m - memory: 256Mi - -netobserv: - livenessProbe: - enabled: false - httpGet: - path: /liveness - port: http - initialDelaySeconds: 0 - periodSeconds: 10 - failureThreshold: 3 - timeoutSeconds: 10 - successThreshold: 1 - startupProbe: - enabled: false - httpGet: - path: /startup - port: http - initialDelaySeconds: 0 - periodSeconds: 5 - failureThreshold: 10 - # https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/#configure-probes - # Must be 1 for liveness and startup Probes. - timeoutSeconds: 3 - successThreshold: 1 - readinessProbe: - enabled: false + memory: 128Mi -podSecurityContext: - runAsNonRoot: true - runAsUser: 1000 - runAsGroup: 1000 +livenessProbe: + enabled: false + httpGet: + path: / + port: http +readinessProbe: + enabled: false + httpGet: + path: / + port: http + +autoscaling: + enabled: false + minReplicas: 1 + maxReplicas: 100 + targetCPUUtilizationPercentage: 80 + # targetMemoryUtilizationPercentage: 80 + +# Additional volumes on the output Deployment definition. +volumes: [] +# - name: foo +# secret: +# secretName: mysecret +# optional: false + +# Additional volumeMounts on the output Deployment definition. +volumeMounts: [] +# - name: foo +# mountPath: "/etc/foo" +# readOnly: true + +nodeSelector: {} tolerations: [] -affinity: [] + +affinity: {} + topologySpreadConstraints: [] From df8b1592f3d1f9e442d4b909b56ff8c6a2d5786d Mon Sep 17 00:00:00 2001 From: Madison Grubb Date: Wed, 13 Mar 2024 17:48:29 -0400 Subject: [PATCH 4/8] use udp, make probes optional --- charts/netobserv/templates/deployment.yaml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/charts/netobserv/templates/deployment.yaml b/charts/netobserv/templates/deployment.yaml index 80eb894..b7ea341 100644 --- a/charts/netobserv/templates/deployment.yaml +++ b/charts/netobserv/templates/deployment.yaml @@ -41,13 +41,17 @@ spec: {{- toYaml . | nindent 12 }} {{- end }} ports: - - name: http + - name: udp containerPort: {{ .Values.service.port }} - protocol: TCP + protocol: UDP + {{- if .Values.livenessProbe.enabled }} livenessProbe: {{- toYaml .Values.livenessProbe | nindent 12 }} + {{- end }} + {{- if .Values.readinessProbe.enabled }} readinessProbe: {{- toYaml .Values.readinessProbe | nindent 12 }} + {{- end }} resources: {{- toYaml .Values.resources | nindent 12 }} {{- with .Values.volumeMounts }} From 05da9a452241f7aee82781cc216937e1e2f7c9e2 Mon Sep 17 00:00:00 2001 From: Madison Grubb Date: Wed, 13 Mar 2024 17:49:32 -0400 Subject: [PATCH 5/8] remove unnecessary quotes in chart def --- charts/netobserv/Chart.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/charts/netobserv/Chart.yaml b/charts/netobserv/Chart.yaml index 11f9362..909e8f4 100644 --- a/charts/netobserv/Chart.yaml +++ b/charts/netobserv/Chart.yaml @@ -21,11 +21,11 @@ maintainers: dependencies: # https://github.com/elastic/cloud-on-k8s - name: eck-operator - repository: "https://helm.elastic.co" + repository: https://helm.elastic.co version: "2.11.*" condition: elasticsearch.enabled # https://opensearch.org/docs/latest/install-and-configure/install-opensearch/helm/ - name: opensearch - repository: "https://opensearch-project.github.io/helm-charts/" + repository: https://opensearch-project.github.io/helm-charts/ version: "2.12.*" condition: opensearch.enabled \ No newline at end of file From 603fafee8ce8c17167fd90477ff21c2a13b8caed Mon Sep 17 00:00:00 2001 From: Madison Grubb Date: Wed, 13 Mar 2024 17:50:47 -0400 Subject: [PATCH 6/8] add newline to chart def --- charts/netobserv/Chart.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/netobserv/Chart.yaml b/charts/netobserv/Chart.yaml index 909e8f4..ee409c9 100644 --- a/charts/netobserv/Chart.yaml +++ b/charts/netobserv/Chart.yaml @@ -28,4 +28,4 @@ dependencies: - name: opensearch repository: https://opensearch-project.github.io/helm-charts/ version: "2.12.*" - condition: opensearch.enabled \ No newline at end of file + condition: opensearch.enabled From 6c0b101c359eb983d4f4a14f32ad0deb57480179 Mon Sep 17 00:00:00 2001 From: Madison Grubb Date: Wed, 13 Mar 2024 17:52:50 -0400 Subject: [PATCH 7/8] include url for maintainer check --- charts/netobserv/Chart.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/charts/netobserv/Chart.yaml b/charts/netobserv/Chart.yaml index ee409c9..9f85ec8 100644 --- a/charts/netobserv/Chart.yaml +++ b/charts/netobserv/Chart.yaml @@ -17,6 +17,7 @@ sources: maintainers: - name: ElastiFlow Engineering Team email: engineering@elastiflow.com + url: www.elastiflow.com dependencies: # https://github.com/elastic/cloud-on-k8s From b8f7cdc2e32d31f31792c4df1dc99368c852bbdb Mon Sep 17 00:00:00 2001 From: Madison Grubb Date: Wed, 13 Mar 2024 17:54:16 -0400 Subject: [PATCH 8/8] don't validate maintainer for now --- .github/workflows/helm_checks.yml | 2 +- charts/netobserv/Chart.yaml | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/helm_checks.yml b/.github/workflows/helm_checks.yml index 1b1a4d7..5ceb784 100644 --- a/.github/workflows/helm_checks.yml +++ b/.github/workflows/helm_checks.yml @@ -38,7 +38,7 @@ jobs: helm repo add eck-operator https://helm.elastic.co helm repo add opensearch https://opensearch-project.github.io/helm-charts/ helm dep build charts/netobserv - ct lint --target-branch ${{ github.event.repository.default_branch }} + ct lint --target-branch ${{ github.event.repository.default_branch }} --validate-maintainers=false - name: Create kind cluster if: steps.list-changed.outputs.changed == 'true' diff --git a/charts/netobserv/Chart.yaml b/charts/netobserv/Chart.yaml index 9f85ec8..ee409c9 100644 --- a/charts/netobserv/Chart.yaml +++ b/charts/netobserv/Chart.yaml @@ -17,7 +17,6 @@ sources: maintainers: - name: ElastiFlow Engineering Team email: engineering@elastiflow.com - url: www.elastiflow.com dependencies: # https://github.com/elastic/cloud-on-k8s