UNCLASSIFIED

Commit 9092336a authored by Sam's avatar Sam
Browse files

fix: add logic to handle null or empty license_key value

parent afd016fe
{{- if .Values.sso.enabled -}} {{- if and .Values.sso.enabled .Values.license_key -}}
apiVersion: v1 apiVersion: v1
kind: ConfigMap kind: ConfigMap
metadata: metadata:
......
{{- if .Values.license_key }}
apiVersion: v1 apiVersion: v1
kind: Secret kind: Secret
metadata: metadata:
...@@ -11,3 +12,4 @@ metadata: ...@@ -11,3 +12,4 @@ metadata:
{{- end }} {{- end }}
data: data:
{{ include "nexus.licenseKey" . | indent 2 }} {{ include "nexus.licenseKey" . | indent 2 }}
{{- end -}}
\ No newline at end of file
{{- if and .Values.sso.enabled .Values.secret.enabled }} {{- if and .Values.sso.enabled .Values.secret.enabled .Values.license_key }}
apiVersion: batch/v1 apiVersion: batch/v1
kind: Job kind: Job
metadata: metadata:
......
...@@ -11,7 +11,13 @@ metadata: ...@@ -11,7 +11,13 @@ metadata:
{{- end }} {{- end }}
data: data:
nexus.properties: | nexus.properties: |
{{- range $k, $v := .Values.nexus.properties.data }} {{- $data := dict -}}
{{- $licenseDict := dict -}}
{{- if .Values.license_key -}}
{{- $_ := set $licenseDict "nexus.licenseFile" .Values.license.mountPath -}}
{{- end -}}
{{- $data := mergeOverwrite $licenseDict .Values.nexus.properties.data -}}
{{- range $k, $v := $data }}
{{ $k }}={{ $v }} {{ $k }}={{ $v }}
{{- end }} {{- end }}
{{- end }} {{- end }}
\ No newline at end of file
...@@ -108,9 +108,11 @@ spec: ...@@ -108,9 +108,11 @@ spec:
name: {{ template "nexus.name" . }}-data name: {{ template "nexus.name" . }}-data
- mountPath: /nexus-data/etc - mountPath: /nexus-data/etc
name: {{ template "nexus.name" . }}-data name: {{ template "nexus.name" . }}-data
{{- if .Values.license_key }}
- mountPath: {{ .Values.license.mountPath }} - mountPath: {{ .Values.license.mountPath }}
name: {{ template "nexus.name" . }}-license name: {{ template "nexus.name" . }}-license
subPath: {{ .Values.license.subPath }} subPath: {{ .Values.license.subPath }}
{{- end }}
{{- if .Values.config.enabled }} {{- if .Values.config.enabled }}
- mountPath: {{ .Values.config.mountPath }} - mountPath: {{ .Values.config.mountPath }}
name: {{ template "nexus.name" . }}-conf name: {{ template "nexus.name" . }}-conf
...@@ -144,12 +146,14 @@ spec: ...@@ -144,12 +146,14 @@ spec:
{{- else }} {{- else }}
emptyDir: {} emptyDir: {}
{{- end }} {{- end }}
{{- if .Values.license_key }}
- name: nexus-repository-manager-license - name: nexus-repository-manager-license
secret: secret:
secretName: {{ template "nexus.name" . }}-license secretName: {{ template "nexus.name" . }}-license
items: items:
- key: sonatype-license.lic - key: sonatype-license.lic
path: sonatype-license.lic path: sonatype-license.lic
{{- end }}
{{- if .Values.config.enabled }} {{- if .Values.config.enabled }}
- name: {{ template "nexus.name" . }}-conf - name: {{ template "nexus.name" . }}-conf
configMap: configMap:
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
hostname: bigbang.dev hostname: bigbang.dev
istio: istio:
enabled: false enabled: false
license_key: "test" license_key: ""
license: license:
mountPath: /nexus-data/sonatype-license.lic mountPath: /nexus-data/sonatype-license.lic
subPath: sonatype-license.lic subPath: sonatype-license.lic
...@@ -77,11 +77,12 @@ nexus: ...@@ -77,11 +77,12 @@ nexus:
value: "true" value: "true"
properties: properties:
override: true override: true
data: data: {}
nexus.licenseFile: /nexus-data/sonatype-license.lic # data:
# nexus.scripts.allowCreation: true # nexus.licenseFile: /nexus-data/sonatype-license.override.lic
# See this article for ldap configuratioon options https://support.sonatype.com/hc/en-us/articles/216597138-Setting-Advanced-LDAP-Connection-Properties-in-Nexus-Repository-Manager # nexus.scripts.allowCreation: true
#nexus.ldap.env.java.naming.security.authentication: simple # See this article for ldap configuratioon options https://support.sonatype.com/hc/en-us/articles/216597138-Setting-Advanced-LDAP-Connection-Properties-in-Nexus-Repository-Manager
# nexus.ldap.env.java.naming.security.authentication: simple
# nodeSelector: # nodeSelector:
# cloud.google.com/gke-nodepool: default-pool # cloud.google.com/gke-nodepool: default-pool
resources: {} resources: {}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment