diff options
author | Sylvain Desbureaux <sylvain.desbureaux@orange.com> | 2020-04-07 12:02:22 +0200 |
---|---|---|
committer | Sylvain Desbureaux <sylvain.desbureaux@orange.com> | 2020-04-08 13:53:39 +0200 |
commit | a5bb31b95347229e400099565bedd3f6a3785c9a (patch) | |
tree | 287f237d9428719650f968ef225cb9af89a2cf3b /kubernetes/contrib/components/netbox/charts/netbox-app/templates | |
parent | ae739cd0ea9487d37b897e8ac0fd09577e16f5b0 (diff) |
[Contrib] Authorize choice of subcomponents
Instead of forcing installation of all contrib components, make the
installation of these components enabled with a toggle, so each person
can choose to install a subset, all or none.
Issue-ID: OOM-2352
Signed-off-by: Sylvain Desbureaux <sylvain.desbureaux@orange.com>
Change-Id: Ie112fe1f1864587b9ac69f18967a3c28d16bdbbe
Diffstat (limited to 'kubernetes/contrib/components/netbox/charts/netbox-app/templates')
8 files changed, 455 insertions, 0 deletions
diff --git a/kubernetes/contrib/components/netbox/charts/netbox-app/templates/NOTES.txt b/kubernetes/contrib/components/netbox/charts/netbox-app/templates/NOTES.txt new file mode 100755 index 0000000000..e70c418864 --- /dev/null +++ b/kubernetes/contrib/components/netbox/charts/netbox-app/templates/NOTES.txt @@ -0,0 +1,33 @@ +# Copyright © 2018 Amdocs, Bell Canada +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +1. Get the application URL by running these commands: +{{- if .Values.ingress.enabled }} +{{- range .Values.ingress.hosts }} + http://{{ . }} +{{- end }} +{{- else if contains "NodePort" .Values.service.type }} + export NODE_PORT=$(kubectl get --namespace {{ include "common.namespace" . }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "common.fullname" . }}) + export NODE_IP=$(kubectl get nodes --namespace {{ include "common.namespace" . }} -o jsonpath="{.items[0].status.addresses[0].address}") + echo http://$NODE_IP:$NODE_PORT +{{- else if contains "LoadBalancer" .Values.service.type }} + NOTE: It may take a few minutes for the LoadBalancer IP to be available. + You can watch the status of by running 'kubectl get svc -w {{ include "common.fullname" . }}' + export SERVICE_IP=$(kubectl get svc --namespace {{ include "common.namespace" . }} {{ include "common.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}') + echo http://$SERVICE_IP:{{ .Values.service.externalPort }} +{{- else if contains "ClusterIP" .Values.service.type }} + export POD_NAME=$(kubectl get pods --namespace {{ include "common.namespace" . }} -l "app={{ include "common.fullname" . }},release={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") + echo "Visit http://127.0.0.1:8080 to use your application" + kubectl port-forward $POD_NAME 8080:{{ .Values.service.internalPort }} +{{- end }} diff --git a/kubernetes/contrib/components/netbox/charts/netbox-app/templates/configmap.yaml b/kubernetes/contrib/components/netbox/charts/netbox-app/templates/configmap.yaml new file mode 100755 index 0000000000..f785478e1b --- /dev/null +++ b/kubernetes/contrib/components/netbox/charts/netbox-app/templates/configmap.yaml @@ -0,0 +1,47 @@ +{{/* +# Copyright © 2018 Amdocs, Bell Canada +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +*/}} + +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ include "common.fullname" . }}-provisioning-configmap + namespace: {{ include "common.namespace" . }} +data: +{{ tpl (.Files.Glob "resources/config/provisioning/*").AsConfig . | indent 2 }} +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ include "common.fullname" . }}-configuration-configmap + namespace: {{ include "common.namespace" . }} +data: +{{ tpl (.Files.Glob "resources/config/configuration/*").AsConfig . | indent 2 }} +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ include "common.fullname" . }}-initializers-configmap + namespace: {{ include "common.namespace" . }} +data: +{{ tpl (.Files.Glob "resources/config/initializers/*").AsConfig . | indent 2 }} +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ include "common.fullname" . }}-startupscripts-configmap + namespace: {{ include "common.namespace" . }} +data: +{{ tpl (.Files.Glob "resources/config/startup_scripts/*").AsConfig . | indent 2 }} diff --git a/kubernetes/contrib/components/netbox/charts/netbox-app/templates/deployment.yaml b/kubernetes/contrib/components/netbox/charts/netbox-app/templates/deployment.yaml new file mode 100755 index 0000000000..16c592f48a --- /dev/null +++ b/kubernetes/contrib/components/netbox/charts/netbox-app/templates/deployment.yaml @@ -0,0 +1,155 @@ +{{/* +# Copyright © 2018 Amdocs, Bell Canada +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +*/}} + +apiVersion: extensions/v1beta1 +kind: Deployment +metadata: + name: {{ include "common.fullname" . }} + namespace: {{ include "common.namespace" . }} + labels: + app: {{ include "common.name" . }} + chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + release: {{ include "common.release" . }} + heritage: {{ .Release.Service }} +spec: + replicas: {{ .Values.replicaCount }} + template: + metadata: + labels: + app: {{ include "common.name" . }} + release: {{ include "common.release" . }} + spec: + containers: + - name: {{ include "common.name" . }} + image: {{ .Values.repository }}/{{ .Values.image }} + imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} + ports: + - containerPort: {{ .Values.service.internalPort }} + # disable liveness probe when breakpoints set in debugger + # so K8s doesn't restart unresponsive container + {{ if .Values.liveness.enabled }} + livenessProbe: + tcpSocket: + port: {{ .Values.service.internalPort }} + initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }} + periodSeconds: {{ .Values.liveness.periodSeconds }} + {{ end }} + readinessProbe: + tcpSocket: + port: {{ .Values.service.internalPort }} + initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }} + periodSeconds: {{ .Values.readiness.periodSeconds }} + env: + - name: DB_PASSWORD + valueFrom: + secretKeyRef: + name: {{ template "common.fullname" . }}-pass + key: DB_PASSWORD + - name: EMAIL_PASSWORD + valueFrom: + secretKeyRef: + name: {{ template "common.fullname" . }}-pass + key: EMAIL_PASSWORD + - name: NAPALM_PASSWORD + valueFrom: + secretKeyRef: + name: {{ template "common.fullname" . }}-pass + key: NAPALM_PASSWORD + - name: SECRET_KEY + valueFrom: + secretKeyRef: + name: {{ template "common.fullname" . }}-pass + key: SECRET_KEY + - name: SUPERUSER_PASSWORD + valueFrom: + secretKeyRef: + name: {{ template "common.fullname" . }}-pass + key: SUPERUSER_PASSWORD + - name: SUPERUSER_API_TOKEN + valueFrom: + secretKeyRef: + name: {{ template "common.fullname" . }}-pass + key: SUPERUSER_API_TOKEN + - name: ALLOWED_HOSTS + value: {{ .Values.config.allowedHosts | quote }} + - name: DB_NAME + value: {{ .Values.config.dbName }} + - name: DB_USER + value: {{ .Values.config.dbUser }} + - name: DB_HOST + value: {{ .Values.config.dbHost }} + - name: EMAIL_SERVER + value: {{ .Values.config.emailServer }} + - name: EMAIL_PORT + value: {{ .Values.config.emailPort | quote }} + - name: EMAIL_USERNAME + value: {{ .Values.config.emailUsername }} + - name: EMAIL_TIMEOUT + value: {{ .Values.config.emailTimeout | quote }} + - name: EMAIL_FROM + value: {{ .Values.config.emailFrom }} + - name: MEDIA_ROOT + value: {{ .Values.config.mediaRoot }} + - name: NAPALM_USERNAME + value: {{ .Values.config.napalmUsername }} + - name: NAPALM_TIMEOUT + value: {{ .Values.config.napalmTimeout | quote }} + - name: MAX_PAGE_SIZE + value: {{ .Values.config.maxPageSize | quote }} + - name: SUPERUSER_NAME + value: {{ .Values.config.superuserName }} + - name: SUPERUSER_EMAIL + value: {{ .Values.config.superuserEmail }} + volumeMounts: + - mountPath: /etc/localtime + name: localtime + readOnly: true + - mountPath: /opt/netbox/startup_scripts + name: {{ include "common.fullname" . }}-startupscripts-config + - mountPath: /opt/netbox/initializers + name: {{ include "common.fullname" . }}-initializers-config + - mountPath: /etc/netbox/config + name: {{ include "common.fullname" . }}-configuration-config + - name: {{ include "common.fullname" . }} + mountPath: /opt/netbox/netbox/static + resources: +{{ include "common.resources" . | indent 12 }} + {{- if .Values.nodeSelector }} + nodeSelector: +{{ toYaml .Values.nodeSelector | indent 10 }} + {{- end -}} + {{- if .Values.affinity }} + affinity: +{{ toYaml .Values.affinity | indent 10 }} + {{- end }} + volumes: + - name: localtime + hostPath: + path: /etc/localtime + - name: {{ include "common.fullname" . }} + persistentVolumeClaim: + claimName: {{ include "common.release" . }}-{{ .Values.persistence.staticPvName }} + - name: {{ include "common.fullname" . }}-startupscripts-config + configMap: + name: {{ include "common.fullname" . }}-startupscripts-configmap + - name: {{ include "common.fullname" . }}-initializers-config + configMap: + name: {{ include "common.fullname" . }}-initializers-configmap + - name: {{ include "common.fullname" . }}-configuration-config + configMap: + name: {{ include "common.fullname" . }}-configuration-configmap + imagePullSecrets: + - name: "{{ include "common.namespace" . }}-docker-registry-key" diff --git a/kubernetes/contrib/components/netbox/charts/netbox-app/templates/job.yaml b/kubernetes/contrib/components/netbox/charts/netbox-app/templates/job.yaml new file mode 100644 index 0000000000..f4002773fd --- /dev/null +++ b/kubernetes/contrib/components/netbox/charts/netbox-app/templates/job.yaml @@ -0,0 +1,65 @@ +# Copyright © 2018 Bell Canada +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +apiVersion: batch/v1 +kind: Job +metadata: + name: {{ include "common.fullname" . }}-provisioning + namespace: {{ include "common.namespace" . }} + labels: + app: {{ include "common.name" . }}-job + chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + release: {{ include "common.release" . }} + heritage: {{ .Release.Service }} +spec: + backoffLimit: 5 + template: + metadata: + labels: + app: {{ include "common.name" . }}-provisioning-job + release: {{ include "common.release" . }} + spec: + restartPolicy: Never + initContainers: + - name: {{ include "common.name" . }}-init-readiness + image: "{{ .Values.global.readinessRepository }}/{{ .Values.global.readinessImage }}" + imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} + command: + - /root/ready.py + args: + - --container-name + - netbox-app + env: + - name: NAMESPACE + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: metadata.namespace + containers: + - name: {{ include "common.name" . }}-provisioning-job + image: "{{ .Values.global.readinessRepository }}/{{ .Values.global.readinessImage }}" + volumeMounts: + - name: {{ include "common.fullname" . }}-provisioning + mountPath: /tmp + command: + - /bin/bash + - ./tmp/provision.sh + volumes: + - name: {{ include "common.fullname" . }}-provisioning + configMap: + name: {{ include "common.fullname" . }}-provisioning-configmap + defaultMode: 0755 + imagePullSecrets: + - name: "{{ include "common.namespace" . }}-docker-registry-key" + restartPolicy: Never diff --git a/kubernetes/contrib/components/netbox/charts/netbox-app/templates/pv.yaml b/kubernetes/contrib/components/netbox/charts/netbox-app/templates/pv.yaml new file mode 100755 index 0000000000..a61217fb94 --- /dev/null +++ b/kubernetes/contrib/components/netbox/charts/netbox-app/templates/pv.yaml @@ -0,0 +1,40 @@ +{{/* +# Copyright © 2018 Amdocs, Bell Canada +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +*/}} + +{{- if and .Values.persistence.enabled (not .Values.persistence.existingClaim) -}} +{{- if not .Values.persistence.storageClass -}} +kind: PersistentVolume +apiVersion: v1 +metadata: + name: {{ include "common.fullname" . }}-data + namespace: {{ include "common.namespace" . }} + labels: + app: {{ include "common.name" . }} + chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}" + release: "{{ include "common.release" . }}" + heritage: "{{ .Release.Service }}" + name: {{ include "common.fullname" . }} +spec: + capacity: + storage: {{ .Values.persistence.size}} + accessModes: + - {{ .Values.persistence.accessMode }} + persistentVolumeReclaimPolicy: {{ .Values.persistence.volumeReclaimPolicy }} + storageClassName: "{{ include "common.fullname" . }}-data" + hostPath: + path: {{ .Values.global.persistence.mountPath | default .Values.persistence.mountPath }}/{{ include "common.release" . }}/{{ .Values.persistence.mountSubPath }}/app +{{- end -}} +{{- end -}} diff --git a/kubernetes/contrib/components/netbox/charts/netbox-app/templates/pvc.yaml b/kubernetes/contrib/components/netbox/charts/netbox-app/templates/pvc.yaml new file mode 100755 index 0000000000..7e25a0f1ef --- /dev/null +++ b/kubernetes/contrib/components/netbox/charts/netbox-app/templates/pvc.yaml @@ -0,0 +1,39 @@ +{{/* +# Copyright © 2018 Amdocs, Bell Canada +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +*/}} + +{{- if and .Values.persistence.enabled (not .Values.persistence.existingClaim) -}} +kind: PersistentVolumeClaim +apiVersion: v1 +metadata: + name: {{ include "common.release" . }}-{{ .Values.persistence.staticPvName }} + namespace: {{ include "common.namespace" . }} + labels: + app: {{ include "common.name" . }} + chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" + release: "{{ include "common.release" . }}" + heritage: "{{ .Release.Service }}" + {{- if .Values.persistence.annotations }} + annotations: +{{ .Values.persistence.annotations | indent 4 }} + {{- end }} +spec: + accessModes: + - {{ .Values.persistence.accessMode }} + resources: + requests: + storage: {{ .Values.persistence.size }} + storageClassName: {{ include "common.storageClass" . }} +{{- end -}} diff --git a/kubernetes/contrib/components/netbox/charts/netbox-app/templates/secrets.yaml b/kubernetes/contrib/components/netbox/charts/netbox-app/templates/secrets.yaml new file mode 100755 index 0000000000..c06bc5a333 --- /dev/null +++ b/kubernetes/contrib/components/netbox/charts/netbox-app/templates/secrets.yaml @@ -0,0 +1,34 @@ +{{/* +# Copyright © 2018 Bell Canada, Amdocs +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +*/}} + +apiVersion: v1 +kind: Secret +metadata: + name: {{ include "common.fullname" . }}-pass + namespace: {{ include "common.namespace" . }} + labels: + app: {{ include "common.name" . }} + chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + release: {{ include "common.release" . }} + heritage: {{ .Release.Service }} +type: Opaque +data: + DB_PASSWORD: {{ .Values.config.dbPassword | b64enc | quote }} + EMAIL_PASSWORD: {{ .Values.config.emailPassword | b64enc | quote }} + NAPALM_PASSWORD: {{ .Values.config.napalmPassword | b64enc | quote }} + SECRET_KEY: {{ .Values.config.secretKey | b64enc | quote }} + SUPERUSER_PASSWORD: {{ .Values.config.superuserPassword | b64enc | quote }} + SUPERUSER_API_TOKEN: {{ .Values.config.superuserAPIToken | b64enc | quote }}
\ No newline at end of file diff --git a/kubernetes/contrib/components/netbox/charts/netbox-app/templates/service.yaml b/kubernetes/contrib/components/netbox/charts/netbox-app/templates/service.yaml new file mode 100755 index 0000000000..74d1116f50 --- /dev/null +++ b/kubernetes/contrib/components/netbox/charts/netbox-app/templates/service.yaml @@ -0,0 +1,42 @@ +{{/* +# Copyright © 2018 Amdocs, Bell Canada +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +*/}} + +apiVersion: v1 +kind: Service +metadata: + name: {{ include "common.servicename" . }} + namespace: {{ include "common.namespace" . }} + labels: + app: {{ include "common.name" . }} + chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + release: {{ include "common.release" . }} + heritage: {{ .Release.Service }} + annotations: +spec: + type: {{ .Values.service.type }} + ports: + {{if eq .Values.service.type "NodePort" -}} + - port: {{ .Values.service.internalPort }} + name: {{ include "common.name" . }} + nodePort: {{ .Values.global.nodePortPrefix | default .Values.nodePortPrefix }}{{ .Values.service.nodePort }} + {{- else -}} + - port: {{ .Values.service.externalPort }} + name: {{ include "common.name" . }} + targetPort: {{ .Values.service.internalPort }} + {{- end}} + selector: + app: {{ include "common.name" . }} + release: {{ include "common.release" . }} |