From d8388fb4b8d2429dac8c2fce1dc29aba99277f6f Mon Sep 17 00:00:00 2001 From: Vivek Singh Date: Sun, 29 Aug 2021 12:42:56 +0530 Subject: [PATCH] Add support to read lincence from secret This commit add support to take licence from a kubernetes secret. A kubernetes secret can be created, which can be passed through helm chart. Previous flag is still present to provide backward comptability. Signed-off-by: Vivek Singh --- chart/inlets-operator/templates/deployment.yaml | 7 +++++++ chart/inlets-operator/values.yaml | 4 ++++ main.go | 5 ++++- 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/chart/inlets-operator/templates/deployment.yaml b/chart/inlets-operator/templates/deployment.yaml index 489247b7..d1dd4f48 100644 --- a/chart/inlets-operator/templates/deployment.yaml +++ b/chart/inlets-operator/templates/deployment.yaml @@ -58,6 +58,13 @@ spec: env: - name: client_image value: "{{.Values.clientImage}}" + {{- if and .Values.proLicenseSecret.name .Values.proLicenseSecret.key }} + - name: LICENSE + valueFrom: + secretKeyRef: + name: {{ .Values.proLicenseSecret.name }} + key: {{ .Values.proLicenseSecret.key }} + {{- end }} volumeMounts: - mountPath: /var/secrets/inlets/ name: inlets-access-key diff --git a/chart/inlets-operator/values.yaml b/chart/inlets-operator/values.yaml index 001bb79a..e1d40dcb 100644 --- a/chart/inlets-operator/values.yaml +++ b/chart/inlets-operator/values.yaml @@ -35,6 +35,10 @@ vpcId: "" subnetId: "" # Only provide LoadBalancers for Services annotated with "dev.inlets.manage=true" +proLicenseSecret: + name: "" + key: "" + annotatedOnly: false image: "ghcr.io/inlets/inlets-operator:0.14.1" diff --git a/main.go b/main.go index b10cc368..a872b934 100644 --- a/main.go +++ b/main.go @@ -73,9 +73,12 @@ func main() { } infra.InletsClientImage = os.Getenv("client_image") - log.Printf("Client image: %s\n", infra.GetInletsClientImage()) + if len(infra.ProConfig.License) == 0 { + infra.ProConfig.License = os.Getenv("LICENSE") + } + if _, err := infra.ProConfig.GetLicenseKey(); err != nil { fmt.Fprintf(os.Stderr, "%s\n", err.Error()) os.Exit(1)