Skip to content

Commit

Permalink
fix: clusterlabels and included imagePullSecrets and apiTokenSecret (#…
Browse files Browse the repository at this point in the history
…529)

* fix: clusterlabels and included imagePullSecrets and apiTokenSecret

Signed-off-by: VedRatan <[email protected]>

* fix: revert nirmataURL

Signed-off-by: VedRatan <[email protected]>

---------

Signed-off-by: VedRatan <[email protected]>
  • Loading branch information
VedRatan authored Mar 1, 2025
1 parent 4857fb5 commit 6932163
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 24 deletions.
4 changes: 2 additions & 2 deletions charts/nirmata-kube-controller/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ type: application
# 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: 0.1.7-rc3
version: 0.1.7-rc4

# 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
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "v3.10.7"
appVersion: "v3.10.9"

maintainers:
- name: Nirmata
Expand Down
3 changes: 3 additions & 0 deletions charts/nirmata-kube-controller/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{{- define "controller.imagePullSecret" }}
{{- printf "{\"auths\":{\"%s\":{\"auth\":\"%s\"}}}" .imageRegistry (printf "%s:%s" .registryUserName .registryPassword | b64enc) | b64enc }}
{{- end }}
10 changes: 10 additions & 0 deletions charts/nirmata-kube-controller/templates/apiTokenSecret.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

{{ if .Values.apiToken }}
apiVersion: v1
kind: Secret
metadata:
name: nirmata-api-token
namespace: nirmata
data:
apiKey: {{ .Values.apiToken | b64enc }}
{{ end }}
11 changes: 11 additions & 0 deletions charts/nirmata-kube-controller/templates/imagePullSecret.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{{ if and .Values.global.imageRegistry .Values.global.registryUserName .Values.global.registryPassword }}
---
apiVersion: v1
kind: Secret
metadata:
name: nirmata-controller-registry-secret
namespace: {{ .Values.namespace }}
type: kubernetes.io/dockerconfigjson
data:
.dockerconfigjson: {{ template "controller.imagePullSecret" .Values.global }}
{{ end }}
Original file line number Diff line number Diff line change
Expand Up @@ -390,18 +390,12 @@ spec:
- 10m
- -cluster-name
- {{ .Values.cluster.name }}
{{- if .Values.apiToken }}
- -api-token
- {{ .Values.apiToken }}
{{- end }}
{{ range $key, $value := .Values.cluster.labels }}
- "-cluster-labels"
- "{{ $key }}:{{ $value }}"
{{ end }}
{{- if .Values.apiTokenSecret }}
- -api-token-secret
- {{ .Values.apiTokenSecret }}
{{- end }}
- nirmata-api-token
command:
- /nirmata-kube-controller
env:
Expand Down
20 changes: 5 additions & 15 deletions charts/nirmata-kube-controller/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@
# # Declare variables to be passed into your templates.

nirmataURL: "wss://nirmata.io/tunnels"
namespace: "nirmata"
global:
imageRegistry: ghcr.io
imageRepository: nirmata
registryUserName:
registryPassword:

kubeController:
imageRegistry:
Expand All @@ -22,23 +25,10 @@ cluster:
type: default-policy-manager-type
labels:
# key: value
# key2: value2

# Use either apiToken or apiTokenSecret to specify the api token in NPM
apiToken: ""

# to use the apiTokenSecret, please create a secret with key 'apiKey'
# here's the example
# apiVersion: v1
# kind: Secret
# metadata:
# name: nirmata-api-token
# namespace: nirmata
# data:
# apiKey: "{base64 encoded api token}"

# apiTokenSecret: "nirmata-api-token"

# to use apiToken, please specify the token directly, no base64 encode needed
# apiToken: ""
features:
policyExceptions:
enabled: false
Expand Down

0 comments on commit 6932163

Please sign in to comment.