From c62ce13aba73e101f0ac0b8e3f1c4e49f5fca4cc Mon Sep 17 00:00:00 2001 From: tshafir Date: Mon, 10 Jun 2024 11:31:33 +0300 Subject: [PATCH 01/10] wip --- charts/ocean-network-client/templates/_helpers.tpl | 2 +- charts/ocean-network-client/templates/configmap.yaml | 2 +- charts/ocean-network-client/templates/daemon_set.yaml | 2 -- charts/ocean-network-client/values.yaml | 9 +++++---- 4 files changed, 7 insertions(+), 8 deletions(-) diff --git a/charts/ocean-network-client/templates/_helpers.tpl b/charts/ocean-network-client/templates/_helpers.tpl index 234e2df7..0f2e5b6f 100644 --- a/charts/ocean-network-client/templates/_helpers.tpl +++ b/charts/ocean-network-client/templates/_helpers.tpl @@ -30,7 +30,7 @@ Secret name. {{- if ne .Values.spotinst.account "" -}} {{- .Values.oceanInfoData -}} {{- else -}} -{{ default (include "ocean-network-client.name" .) .Values.secretName }} +{{ default (include "ocean-network-client.name" .) .Values.oceanController.secretName }} {{- end -}} {{- end -}} diff --git a/charts/ocean-network-client/templates/configmap.yaml b/charts/ocean-network-client/templates/configmap.yaml index e294ca91..a64ed4c6 100644 --- a/charts/ocean-network-client/templates/configmap.yaml +++ b/charts/ocean-network-client/templates/configmap.yaml @@ -5,5 +5,5 @@ metadata: name: {{ include "ocean-network-client.configMapName" . }} namespace: {{ include "ocean-network-client.namespace" . }} data: - spotinst.cluster-identifier: {{ .Values.spotinst.clusterIdentifier }} + spotinst.cluster-identifier: "{{ .Values.spotinst.clusterIdentifier }}" {{- end }} \ No newline at end of file diff --git a/charts/ocean-network-client/templates/daemon_set.yaml b/charts/ocean-network-client/templates/daemon_set.yaml index 72f934cb..3247cf54 100644 --- a/charts/ocean-network-client/templates/daemon_set.yaml +++ b/charts/ocean-network-client/templates/daemon_set.yaml @@ -67,13 +67,11 @@ spec: secretKeyRef: name: {{ include "ocean-network-client.secretName" . }} key: token - optional: true - name: SPOTINST_ACCOUNT valueFrom: secretKeyRef: name: {{ include "ocean-network-client.secretName" . }} key: account - optional: true - name: SPOTINST_TOKEN_LEGACY valueFrom: configMapKeyRef: diff --git a/charts/ocean-network-client/values.yaml b/charts/ocean-network-client/values.yaml index ecd132f4..0ff67df8 100644 --- a/charts/ocean-network-client/values.yaml +++ b/charts/ocean-network-client/values.yaml @@ -1,10 +1,11 @@ # -- (Optional) Namespace where components should be installed. namespace: kube-system -# -- (Optional) Secret name. -secretName: spotinst-kubernetes-cluster-controller -# -- (Optional) ConfigMap name. -configMapName: spotinst-kubernetes-cluster-controller-config +oceanController: + # -- (Optional) Secret name. + secretName: spotinst-kubernetes-cluster-controller + # -- (Optional) ConfigMap name. + configMapName: spotinst-kubernetes-cluster-controller-config # -- (Optional) ConfigMap name. oceanInfoData: spotinst-ocean-cluster From 523b890eb2907c3c11eb705341d80e76b142e231 Mon Sep 17 00:00:00 2001 From: tshafir Date: Mon, 10 Jun 2024 12:55:17 +0300 Subject: [PATCH 02/10] wip --- charts/ocean-network-client/Chart.yaml | 2 +- charts/ocean-network-client/README.md | 20 ++++++++--- charts/ocean-network-client/README.md.gotmpl | 13 +++++-- .../ocean-network-client/templates/NOTES.txt | 2 +- .../templates/_helpers.tpl | 36 ++++++++++++------- .../templates/configmap.yaml | 2 +- .../templates/secret.yaml | 2 +- charts/ocean-network-client/values.yaml | 25 ++++++++----- 8 files changed, 70 insertions(+), 32 deletions(-) diff --git a/charts/ocean-network-client/Chart.yaml b/charts/ocean-network-client/Chart.yaml index e04898ff..94349646 100644 --- a/charts/ocean-network-client/Chart.yaml +++ b/charts/ocean-network-client/Chart.yaml @@ -17,7 +17,7 @@ maintainers: # This is the chart version. This version number should be incremented each time you make changes # to the chart and its templates, including the app version. # Versions are expected to follow Semantic Versioning (https://semver.org/) -version: 1.0.23 +version: 1.1.0 # This is the version number of the application being deployed. This version number should be # incremented each time you make changes to the application. Versions are not expected to diff --git a/charts/ocean-network-client/README.md b/charts/ocean-network-client/README.md index 93ab9275..0631fb17 100644 --- a/charts/ocean-network-client/README.md +++ b/charts/ocean-network-client/README.md @@ -18,10 +18,19 @@ helm repo add spot https://charts.spot.io helm repo update ``` -3. Install `ocean-network-client`: +3a. Install `ocean-network-client` and generate secret and configMap: +```sh +helm install spot spot/ocean-network-client \ + --set spotinst.account=$SPOTINST_ACCOUNT \ + --set spotinst.clusterIdentifier=$SPOTINST_CLUSTER_IDENTIFIER \ + --set spotinst.token=$SPOTINST_TOKEN +``` +3b. Install `ocean-network-client` with your own secret or configMap: ```sh -helm install my-release spot/ocean-network-client +helm install spot spot/ocean-network-client \ + --set oceanController.secretName=$SECRET_NAME \ + --set oceanController.configMapName=$CONFIG_MAP_NAME ``` > NOTE: Please configure all required chart values using the `set` command line argument or a `values.yaml` file. @@ -30,15 +39,16 @@ helm install my-release spot/ocean-network-client | Key | Type | Default | Description | |-----|------|---------|-------------| -| configMapName | Optional | `"spotinst-kubernetes-cluster-controller-config"` | ConfigMap name. | +| fullnameOverride | string | `""` | | | image.pullPolicy | Optional | `"IfNotPresent"` | Image pull policy. | | image.pullSecrets | Optional | `[]` | Image pull secrets. | | image.repository | Optional | `"public.ecr.aws/spotinst/spot-network-client"` | Image repository. | | image.tag | Optional | `""` | Image tag. Defaults to `.Chart.AppVersion`. | +| nameOverride | string | `""` | | | namespace | Optional | `"kube-system"` | Namespace where components should be installed. | -| oceanInfoData | Optional | `"spotinst-ocean-cluster"` | ConfigMap name. | +| oceanController.configMapName | Optional | `"spotinst-kubernetes-cluster-controller-config"` | ConfigMap name. | +| oceanController.secretName | Optional | `"spotinst-kubernetes-cluster-controller"` | Secret name. | | resources | Optional | `{"requests":{"cpu":"30m","memory":"150Mi"}}` | Resource requests and limits. Ref: http://kubernetes.io/docs/user-guide/compute-resources/ | -| secretName | Optional | `"spotinst-kubernetes-cluster-controller"` | Secret name. | | spotinst.account | Optional | `""` | Spot Account. Ref: https://docs.spot.io/administration/organizations?id=account | | spotinst.clusterIdentifier | Optional | `""` | Unique identifier used by the Ocean Controller to connect between the Ocean backend and the Kubernetes cluster. Ref: https://docs.spot.io/ocean/tutorials/spot-kubernetes-controller/ | | spotinst.token | Optional | `""` | Spot Token. Ref: https://docs.spot.io/administration/api/create-api-token | diff --git a/charts/ocean-network-client/README.md.gotmpl b/charts/ocean-network-client/README.md.gotmpl index cf7d1ae6..844a6ebb 100644 --- a/charts/ocean-network-client/README.md.gotmpl +++ b/charts/ocean-network-client/README.md.gotmpl @@ -20,10 +20,19 @@ helm repo add spot https://charts.spot.io helm repo update ``` -3. Install `{{ template "chart.name" . }}`: +3a. Install `{{ template "chart.name" . }}` and generate secret and configMap: +```sh +helm install my-release spot/{{ template "chart.name" . }} \ + --set spotinst.account=$SPOTINST_ACCOUNT \ + --set spotinst.clusterIdentifier=$SPOTINST_CLUSTER_IDENTIFIER \ + --set spotinst.token=$SPOTINST_TOKEN +``` +3b. Install `{{ template "chart.name" . }}` with your own secret or configMap: ```sh -helm install my-release spot/{{ template "chart.name" . }} +helm install my-release spot/{{ template "chart.name" . }} \ + --set oceanController.secretName=$SECRET_NAME \ + --set oceanController.configMapName=$CONFIG_MAP_NAME ``` > NOTE: Please configure all required chart values using the `set` command line argument or a `values.yaml` file. diff --git a/charts/ocean-network-client/templates/NOTES.txt b/charts/ocean-network-client/templates/NOTES.txt index e0b1f169..ffee8c93 100644 --- a/charts/ocean-network-client/templates/NOTES.txt +++ b/charts/ocean-network-client/templates/NOTES.txt @@ -2,6 +2,6 @@ Thank you for installing {{ .Release.Name }}. Please make sure that each node in your cluster has the Network-Client DaemonSet running: - $ kubectl get daemonset {{ .Release.Name }} -n {{ .Values.namespace }} + $ kubectl get daemonset {{ .Release.Name }} -n {{ include "ocean-network-client.namespace" . }} The collection of the data has already begun, you can see the data in our UI console or via API in 2-3 hours. diff --git a/charts/ocean-network-client/templates/_helpers.tpl b/charts/ocean-network-client/templates/_helpers.tpl index 0f2e5b6f..15cbcdf1 100644 --- a/charts/ocean-network-client/templates/_helpers.tpl +++ b/charts/ocean-network-client/templates/_helpers.tpl @@ -2,43 +2,53 @@ Expand the name of the chart. */}} {{- define "ocean-network-client.name" -}} -{{- default .Chart.Name .Values.name | trunc 63 | trimSuffix "-" }} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} {{- end }} {{/* Namespace. */}} {{- define "ocean-network-client.namespace" -}} -{{ default (include "ocean-network-client.name" .) .Values.namespace }} +{{ .Release.Namespace }} +{{- end }} + +{{/* +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 "ocean-network-client.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 }} {{/* ConfigMap name. */}} {{- define "ocean-network-client.configMapName" -}} -{{- if ne .Values.spotinst.clusterIdentifier "" -}} -{{- .Values.oceanInfoData -}} -{{- else -}} -{{- default (include "ocean-network-client.name" .) .Values.configMapName -}} -{{- end -}} +{{- default (include "ocean-network-client.fullname" .) .Values.configMap.name -}} {{- end -}} {{/* Secret name. */}} {{- define "ocean-network-client.secretName" -}} -{{- if ne .Values.spotinst.account "" -}} -{{- .Values.oceanInfoData -}} -{{- else -}} -{{ default (include "ocean-network-client.name" .) .Values.oceanController.secretName }} -{{- end -}} +{{- default (include "ocean-network-client.fullname" .) .Values.secret.name -}} {{- end -}} {{/* DaemonSet labels. */}} {{- define "ocean-network-client.daemon-set.labels" -}} -app: ocean-network-client +app: {{ (include "ocean-network-client.fullname" .) }} {{- end }} {{/* diff --git a/charts/ocean-network-client/templates/configmap.yaml b/charts/ocean-network-client/templates/configmap.yaml index a64ed4c6..f20dd7e5 100644 --- a/charts/ocean-network-client/templates/configmap.yaml +++ b/charts/ocean-network-client/templates/configmap.yaml @@ -1,4 +1,4 @@ -{{ if ne .Values.spotinst.clusterIdentifier "" }} +{{ if .Values.configMap.create }} apiVersion: v1 kind: ConfigMap metadata: diff --git a/charts/ocean-network-client/templates/secret.yaml b/charts/ocean-network-client/templates/secret.yaml index 54a6e8b2..a2720cdc 100644 --- a/charts/ocean-network-client/templates/secret.yaml +++ b/charts/ocean-network-client/templates/secret.yaml @@ -1,4 +1,4 @@ -{{ if ne .Values.spotinst.account "" }} +{{ if .Values.secret.create }} apiVersion: v1 kind: Secret metadata: diff --git a/charts/ocean-network-client/values.yaml b/charts/ocean-network-client/values.yaml index 0ff67df8..41598245 100644 --- a/charts/ocean-network-client/values.yaml +++ b/charts/ocean-network-client/values.yaml @@ -1,14 +1,23 @@ -# -- (Optional) Namespace where components should be installed. -namespace: kube-system +nameOverride: "" +fullnameOverride: "" -oceanController: - # -- (Optional) Secret name. - secretName: spotinst-kubernetes-cluster-controller - # -- (Optional) ConfigMap name. - configMapName: spotinst-kubernetes-cluster-controller-config +secret: + # -- Controls whether a Secret should be created. (Optional) + create: true + # -- Secret name. (Optional) + name: "" +# Config Map. +configMap: + create: true + # -- ConfigMap name. (Optional) + name: "" + +# -- (Optional) Secret name. +#secretName: spotinst-kubernetes-cluster-controller # -- (Optional) ConfigMap name. -oceanInfoData: spotinst-ocean-cluster +#configMapName: spotinst-kubernetes-cluster-controller-config + # Spot Configuration. spotinst: From 9ff3789de0bed09cc29a45994c3d5d0e6c82bdce Mon Sep 17 00:00:00 2001 From: tshafir Date: Sun, 16 Jun 2024 09:53:17 +0300 Subject: [PATCH 03/10] handle 2 fields for secret and cm names --- .../templates/_helpers.tpl | 46 ++++++++++++++++++- .../templates/configmap.yaml | 2 +- .../templates/secret.yaml | 2 +- charts/ocean-network-client/values.yaml | 23 ++++------ 4 files changed, 55 insertions(+), 18 deletions(-) diff --git a/charts/ocean-network-client/templates/_helpers.tpl b/charts/ocean-network-client/templates/_helpers.tpl index 15cbcdf1..029f0800 100644 --- a/charts/ocean-network-client/templates/_helpers.tpl +++ b/charts/ocean-network-client/templates/_helpers.tpl @@ -34,14 +34,56 @@ If release name contains chart name it will be used as a full name. ConfigMap name. */}} {{- define "ocean-network-client.configMapName" -}} -{{- default (include "ocean-network-client.fullname" .) .Values.configMap.name -}} +{{- if include "ocean-network-client.createConfigMap" . -}} + +{{/* +Validate oceanController.configMapName was not provided in case we need to create configMap. +*/}} +{{- if .Values.oceanController.configMapName -}} +{{- fail "oceanController.configMapName cannot be provided in case spotinst.controllerClusterId was provided. Please use configMapName instead" }} +{{- end -}} + +{{- default (include "ocean-network-client.fullname" .) .Values.configMapName -}} +{{- else -}} +{{- default "spotinst-kubernetes-cluster-controller-config" (default .Values.oceanController.configMapName .Values.configMapName) -}} +{{- end -}} +{{- end -}} + +{{/* +create ConfigMap. +*/}} +{{- define "ocean-network-client.createConfigMap" -}} +{{- if .Values.spotinst.clusterIdentifier -}} +{{- true -}} +{{- end -}} {{- end -}} {{/* Secret name. */}} {{- define "ocean-network-client.secretName" -}} -{{- default (include "ocean-network-client.fullname" .) .Values.secret.name -}} +{{- if include "ocean-network-client.createSecret" . -}} + +{{/* +Validate oceanController.secretName was not provided in case we need to create secret. +*/}} +{{- if .Values.oceanController.secretName -}} +{{- fail "oceanController.secretName cannot be provided in case spotinst.token or spotinst.account are provided. Please use secretName instead" }} +{{- end -}} + +{{- default (include "ocean-network-client.fullname" .) .Values.secretName -}} +{{- else -}} +{{- default "spotinst-kubernetes-cluster-controller" (default .Values.oceanController.secretName .Values.secretName) -}} +{{- end -}} +{{- end -}} + +{{/* +create Secret. +*/}} +{{- define "ocean-network-client.createSecret" -}} +{{- if or .Values.spotinst.token .Values.spotinst.account -}} +{{- true -}} +{{- end -}} {{- end -}} {{/* diff --git a/charts/ocean-network-client/templates/configmap.yaml b/charts/ocean-network-client/templates/configmap.yaml index f20dd7e5..3722605b 100644 --- a/charts/ocean-network-client/templates/configmap.yaml +++ b/charts/ocean-network-client/templates/configmap.yaml @@ -1,4 +1,4 @@ -{{ if .Values.configMap.create }} +{{ if include "ocean-network-client.createConfigMap" . }} apiVersion: v1 kind: ConfigMap metadata: diff --git a/charts/ocean-network-client/templates/secret.yaml b/charts/ocean-network-client/templates/secret.yaml index a2720cdc..cf68edb2 100644 --- a/charts/ocean-network-client/templates/secret.yaml +++ b/charts/ocean-network-client/templates/secret.yaml @@ -1,4 +1,4 @@ -{{ if .Values.secret.create }} +{{ if include "ocean-network-client.createSecret" . }} apiVersion: v1 kind: Secret metadata: diff --git a/charts/ocean-network-client/values.yaml b/charts/ocean-network-client/values.yaml index 41598245..258a3bde 100644 --- a/charts/ocean-network-client/values.yaml +++ b/charts/ocean-network-client/values.yaml @@ -1,23 +1,18 @@ nameOverride: "" fullnameOverride: "" -secret: - # -- Controls whether a Secret should be created. (Optional) - create: true - # -- Secret name. (Optional) - name: "" - -# Config Map. -configMap: - create: true - # -- ConfigMap name. (Optional) - name: "" +# -- Reference secret and configMap for the Ocean Controller. +# Deprecated in favor of secret and configMap objects +oceanController: + # -- (Optional) Secret name. Deprecated use secretName instead. + secretName: "" + # -- (Optional) ConfigMap name. Deprecated use configMapName instead + configMapName: "" # -- (Optional) Secret name. -#secretName: spotinst-kubernetes-cluster-controller +secretName: "" # -- (Optional) ConfigMap name. -#configMapName: spotinst-kubernetes-cluster-controller-config - +configMapName: "" # Spot Configuration. spotinst: From ea81dffc49fbb19cd91a6b4a29bde3288c34f034 Mon Sep 17 00:00:00 2001 From: tshafir Date: Sun, 16 Jun 2024 11:16:16 +0300 Subject: [PATCH 04/10] added comment --- charts/ocean-network-client/values.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/charts/ocean-network-client/values.yaml b/charts/ocean-network-client/values.yaml index 258a3bde..ff72b0fe 100644 --- a/charts/ocean-network-client/values.yaml +++ b/charts/ocean-network-client/values.yaml @@ -15,6 +15,7 @@ secretName: "" configMapName: "" # Spot Configuration. +# Will create secret and configMap objects. spotinst: # -- (Optional) Spot Token. # Ref: https://docs.spot.io/administration/api/create-api-token From 4fa6d8db1fe663b4d3fb123e1a42d642b6e8d2c6 Mon Sep 17 00:00:00 2001 From: tshafir Date: Sun, 16 Jun 2024 11:32:00 +0300 Subject: [PATCH 05/10] added optional namespace override --- charts/ocean-network-client/templates/_helpers.tpl | 2 +- charts/ocean-network-client/values.yaml | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/charts/ocean-network-client/templates/_helpers.tpl b/charts/ocean-network-client/templates/_helpers.tpl index 029f0800..a0a132d5 100644 --- a/charts/ocean-network-client/templates/_helpers.tpl +++ b/charts/ocean-network-client/templates/_helpers.tpl @@ -9,7 +9,7 @@ Expand the name of the chart. Namespace. */}} {{- define "ocean-network-client.namespace" -}} -{{ .Release.Namespace }} +{{ default .Release.Namespace .Values.namespace }} {{- end }} {{/* diff --git a/charts/ocean-network-client/values.yaml b/charts/ocean-network-client/values.yaml index ff72b0fe..120da61a 100644 --- a/charts/ocean-network-client/values.yaml +++ b/charts/ocean-network-client/values.yaml @@ -1,5 +1,7 @@ nameOverride: "" fullnameOverride: "" +# -- (Optional) namespace override. +namespace: "" # -- Reference secret and configMap for the Ocean Controller. # Deprecated in favor of secret and configMap objects From 44a67bc6cf1639ce0e17985a558e47f4f4a6886a Mon Sep 17 00:00:00 2001 From: tshafir Date: Sun, 16 Jun 2024 12:12:59 +0300 Subject: [PATCH 06/10] have default value for namespace override --- charts/ocean-network-client/values.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/ocean-network-client/values.yaml b/charts/ocean-network-client/values.yaml index 120da61a..e3488461 100644 --- a/charts/ocean-network-client/values.yaml +++ b/charts/ocean-network-client/values.yaml @@ -1,7 +1,7 @@ nameOverride: "" fullnameOverride: "" # -- (Optional) namespace override. -namespace: "" +namespace: kube-system # -- Reference secret and configMap for the Ocean Controller. # Deprecated in favor of secret and configMap objects From 22a562a7a6f7a93b224e42d6f2048e71834228a2 Mon Sep 17 00:00:00 2001 From: tshafir Date: Sun, 16 Jun 2024 12:30:34 +0300 Subject: [PATCH 07/10] added validations for oceanController.configMapName and configMapName not provided with different values --- .../templates/_helpers.tpl | 24 +++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/charts/ocean-network-client/templates/_helpers.tpl b/charts/ocean-network-client/templates/_helpers.tpl index a0a132d5..7cdfe7f3 100644 --- a/charts/ocean-network-client/templates/_helpers.tpl +++ b/charts/ocean-network-client/templates/_helpers.tpl @@ -40,11 +40,21 @@ ConfigMap name. Validate oceanController.configMapName was not provided in case we need to create configMap. */}} {{- if .Values.oceanController.configMapName -}} -{{- fail "oceanController.configMapName cannot be provided in case spotinst.controllerClusterId was provided. Please use configMapName instead" }} +{{- fail "`oceanController.configMapName` cannot be provided in case `spotinst.controllerClusterId` was provided. Please use `configMapName` instead" }} {{- end -}} {{- default (include "ocean-network-client.fullname" .) .Values.configMapName -}} {{- else -}} + +{{/* +Validate both oceanController.configMapName and configMapName were not provided together with different values +*/}} +{{- if and .Values.oceanController.configMapName .Values.configMapName -}} +{{- if ne .Values.oceanController.configMapName .Values.configMapName -}} +{{- fail "Both `oceanController.configMapName` and `configMapName` were provided with different values. Please use `configMapName`" }} +{{- end -}} +{{- end -}} + {{- default "spotinst-kubernetes-cluster-controller-config" (default .Values.oceanController.configMapName .Values.configMapName) -}} {{- end -}} {{- end -}} @@ -68,11 +78,21 @@ Secret name. Validate oceanController.secretName was not provided in case we need to create secret. */}} {{- if .Values.oceanController.secretName -}} -{{- fail "oceanController.secretName cannot be provided in case spotinst.token or spotinst.account are provided. Please use secretName instead" }} +{{- fail "`oceanController.secretName` cannot be provided in case `spotinst.token` or `spotinst.account` are provided. Please use `secretName` instead" }} {{- end -}} {{- default (include "ocean-network-client.fullname" .) .Values.secretName -}} {{- else -}} + +{{/* +Validate both oceanController.secretName and secretName were not provided together with different values +*/}} +{{- if and .Values.oceanController.secretName .Values.secretName -}} +{{- if ne .Values.oceanController.secretName .Values.secretName -}} +{{- fail "Both `oceanController.secretName` and `secretName` were provided with different values. Please use `secretName`" }} +{{- end -}} +{{- end -}} + {{- default "spotinst-kubernetes-cluster-controller" (default .Values.oceanController.secretName .Values.secretName) -}} {{- end -}} {{- end -}} From fa28470caebf71745440339cf22f0991845ddc8b Mon Sep 17 00:00:00 2001 From: tshafir Date: Sun, 16 Jun 2024 12:37:41 +0300 Subject: [PATCH 08/10] added namespace to default installations --- charts/ocean-network-client/README.md.gotmpl | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/charts/ocean-network-client/README.md.gotmpl b/charts/ocean-network-client/README.md.gotmpl index 844a6ebb..afa98aab 100644 --- a/charts/ocean-network-client/README.md.gotmpl +++ b/charts/ocean-network-client/README.md.gotmpl @@ -25,14 +25,16 @@ helm repo update helm install my-release spot/{{ template "chart.name" . }} \ --set spotinst.account=$SPOTINST_ACCOUNT \ --set spotinst.clusterIdentifier=$SPOTINST_CLUSTER_IDENTIFIER \ - --set spotinst.token=$SPOTINST_TOKEN + --set spotinst.token=$SPOTINST_TOKEN \ + --namespace spot-system --set namespace=spot-system ``` 3b. Install `{{ template "chart.name" . }}` with your own secret or configMap: ```sh helm install my-release spot/{{ template "chart.name" . }} \ - --set oceanController.secretName=$SECRET_NAME \ - --set oceanController.configMapName=$CONFIG_MAP_NAME + --set secretName=$SECRET_NAME \ + --set configMapName=$CONFIG_MAP_NAME \ + --namespace spot-system --set namespace=spot-system ``` > NOTE: Please configure all required chart values using the `set` command line argument or a `values.yaml` file. From 27e44b0d69af38b96bacfa66ae7c0404bbce3861 Mon Sep 17 00:00:00 2001 From: tshafir Date: Sun, 16 Jun 2024 12:37:58 +0300 Subject: [PATCH 09/10] README.md --- charts/ocean-network-client/README.md | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/charts/ocean-network-client/README.md b/charts/ocean-network-client/README.md index 0631fb17..39483e8e 100644 --- a/charts/ocean-network-client/README.md +++ b/charts/ocean-network-client/README.md @@ -1,6 +1,6 @@ # ocean-network-client -![Version: 1.0.23](https://img.shields.io/badge/Version-1.0.23-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 1.0.8](https://img.shields.io/badge/AppVersion-1.0.8-informational?style=flat-square) +![Version: 1.1.0](https://img.shields.io/badge/Version-1.1.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 1.0.8](https://img.shields.io/badge/AppVersion-1.0.8-informational?style=flat-square) A Helm chart for Ocean Network Client. @@ -20,17 +20,19 @@ helm repo update 3a. Install `ocean-network-client` and generate secret and configMap: ```sh -helm install spot spot/ocean-network-client \ +helm install my-release spot/ocean-network-client \ --set spotinst.account=$SPOTINST_ACCOUNT \ --set spotinst.clusterIdentifier=$SPOTINST_CLUSTER_IDENTIFIER \ - --set spotinst.token=$SPOTINST_TOKEN + --set spotinst.token=$SPOTINST_TOKEN \ + --namespace spot-system --set namespace=spot-system ``` 3b. Install `ocean-network-client` with your own secret or configMap: ```sh -helm install spot spot/ocean-network-client \ - --set oceanController.secretName=$SECRET_NAME \ - --set oceanController.configMapName=$CONFIG_MAP_NAME +helm install my-release spot/ocean-network-client \ + --set secretName=$SECRET_NAME \ + --set configMapName=$CONFIG_MAP_NAME \ + --namespace spot-system --set namespace=spot-system ``` > NOTE: Please configure all required chart values using the `set` command line argument or a `values.yaml` file. @@ -39,16 +41,19 @@ helm install spot spot/ocean-network-client \ | Key | Type | Default | Description | |-----|------|---------|-------------| +| configMapName | Optional | `""` | ConfigMap name. | | fullnameOverride | string | `""` | | | image.pullPolicy | Optional | `"IfNotPresent"` | Image pull policy. | | image.pullSecrets | Optional | `[]` | Image pull secrets. | | image.repository | Optional | `"public.ecr.aws/spotinst/spot-network-client"` | Image repository. | | image.tag | Optional | `""` | Image tag. Defaults to `.Chart.AppVersion`. | | nameOverride | string | `""` | | -| namespace | Optional | `"kube-system"` | Namespace where components should be installed. | -| oceanController.configMapName | Optional | `"spotinst-kubernetes-cluster-controller-config"` | ConfigMap name. | -| oceanController.secretName | Optional | `"spotinst-kubernetes-cluster-controller"` | Secret name. | +| namespace | Optional | `"kube-system"` | namespace override. | +| oceanController | object | `{"configMapName":"","secretName":""}` | Reference secret and configMap for the Ocean Controller. Deprecated in favor of secret and configMap objects | +| oceanController.configMapName | Optional | `""` | ConfigMap name. Deprecated use configMapName instead | +| oceanController.secretName | Optional | `""` | Secret name. Deprecated use secretName instead. | | resources | Optional | `{"requests":{"cpu":"30m","memory":"150Mi"}}` | Resource requests and limits. Ref: http://kubernetes.io/docs/user-guide/compute-resources/ | +| secretName | Optional | `""` | Secret name. | | spotinst.account | Optional | `""` | Spot Account. Ref: https://docs.spot.io/administration/organizations?id=account | | spotinst.clusterIdentifier | Optional | `""` | Unique identifier used by the Ocean Controller to connect between the Ocean backend and the Kubernetes cluster. Ref: https://docs.spot.io/ocean/tutorials/spot-kubernetes-controller/ | | spotinst.token | Optional | `""` | Spot Token. Ref: https://docs.spot.io/administration/api/create-api-token | From 2ec0a101e1cf344fbb51ea2cab5c4de76fec1e9c Mon Sep 17 00:00:00 2001 From: baruchis123 Date: Sun, 16 Jun 2024 14:57:05 +0300 Subject: [PATCH 10/10] remove change to daemonset labels --- charts/ocean-network-client/templates/_helpers.tpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/ocean-network-client/templates/_helpers.tpl b/charts/ocean-network-client/templates/_helpers.tpl index 7cdfe7f3..a5d9be33 100644 --- a/charts/ocean-network-client/templates/_helpers.tpl +++ b/charts/ocean-network-client/templates/_helpers.tpl @@ -110,7 +110,7 @@ create Secret. DaemonSet labels. */}} {{- define "ocean-network-client.daemon-set.labels" -}} -app: {{ (include "ocean-network-client.fullname" .) }} +app: ocean-network-client {{- end }} {{/*