From 918fbb0963b0d07ba54f637d314e9b8e6bb4a1c4 Mon Sep 17 00:00:00 2001 From: Waqar Ahmed Date: Fri, 4 Dec 2020 04:12:04 +0500 Subject: [PATCH] Clean service configuration --- test/nextcloud/2.3.2/questions.yaml | 1 - test/nextcloud/2.3.2/templates/NOTES.txt | 93 +------------------ test/nextcloud/2.3.2/templates/db-secret.yaml | 7 +- .../nextcloud/2.3.2/templates/deployment.yaml | 29 +----- test/nextcloud/2.3.2/templates/hpa.yaml | 20 ---- test/nextcloud/2.3.2/templates/ingress.yaml | 31 ------- .../2.3.2/templates/metrics-deployment.yaml | 55 ----------- .../2.3.2/templates/metrics-service.yaml | 31 ------- .../2.3.2/templates/nextcloud-pvc.yaml | 31 ------- test/nextcloud/2.3.2/templates/service.yaml | 9 +- test/nextcloud/2.3.2/values.yaml | 3 - 11 files changed, 5 insertions(+), 305 deletions(-) delete mode 100644 test/nextcloud/2.3.2/templates/hpa.yaml delete mode 100644 test/nextcloud/2.3.2/templates/ingress.yaml delete mode 100644 test/nextcloud/2.3.2/templates/metrics-deployment.yaml delete mode 100644 test/nextcloud/2.3.2/templates/metrics-service.yaml delete mode 100644 test/nextcloud/2.3.2/templates/nextcloud-pvc.yaml diff --git a/test/nextcloud/2.3.2/questions.yaml b/test/nextcloud/2.3.2/questions.yaml index 09c79bc2d3c..38a89adef32 100644 --- a/test/nextcloud/2.3.2/questions.yaml +++ b/test/nextcloud/2.3.2/questions.yaml @@ -99,7 +99,6 @@ questions: schema: type: dict required: true - additional_attrs: true attrs: - variable: nodePort label: "Node Port to use for Nextcloud" diff --git a/test/nextcloud/2.3.2/templates/NOTES.txt b/test/nextcloud/2.3.2/templates/NOTES.txt index f1428c5e10a..e876825c056 100644 --- a/test/nextcloud/2.3.2/templates/NOTES.txt +++ b/test/nextcloud/2.3.2/templates/NOTES.txt @@ -1,94 +1,3 @@ -{{- if or .Values.mariadb.enabled .Values.externalDatabase.host -}} - -{{- if empty .Values.nextcloud.host -}} -################################################################################# -### WARNING: You did not provide an external host in your 'helm install' call ### -################################################################################# - -This deployment will be incomplete until you configure nextcloud with a resolvable -host. To configure nextcloud with the URL of your service: - 1. Get the nextcloud URL by running: - {{- if contains "NodePort" .Values.service.type }} - - export APP_PORT=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "nextcloud.fullname" . }} -o jsonpath="{.spec.ports[0].nodePort}") - export APP_HOST=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") - - {{- else if contains "LoadBalancer" .Values.service.type }} - - NOTE: It may take a few minutes for the LoadBalancer IP to be available. - Watch the status with: 'kubectl get svc --namespace {{ .Release.Namespace }} -w {{ template "nextcloud.fullname" . }}' - - export APP_HOST=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "nextcloud.fullname" . }} --template "{{ "{{ range (index .status.loadBalancer.ingress 0) }}{{ . }}{{ end }}" }}") - export APP_PASSWORD=$(kubectl get secret --namespace {{ .Release.Namespace }} {{ template "nextcloud.fullname" . }} -o jsonpath="{.data.nextcloud-password}" | base64 --decode) - {{- if .Values.mariadb.db.password }} - export APP_DATABASE_PASSWORD=$(kubectl get secret --namespace {{ .Release.Namespace }} {{ template "nextcloud.mariadb.fullname" . }} -o jsonpath="{.data.mariadb-password}" | base64 --decode) - {{- end }} - {{- end }} - -2. Complete your nextcloud deployment by running: - -{{- if .Values.mariadb.enabled }} - - helm upgrade {{ .Release.Name }} nextcloud/nextcloud \ - --set nextcloud.host=$APP_HOST,nextcloud.password=$APP_PASSWORD{{ if .Values.mariadb.db.password }},mariadb.db.password=$APP_DATABASE_PASSWORD{{ end }} -{{- else }} - - ## PLEASE UPDATE THE EXTERNAL DATABASE CONNECTION PARAMETERS IN THE FOLLOWING COMMAND AS NEEDED ## - - helm upgrade {{ .Release.Name }} nextcloud/nextcloud \ - --set nextcloud.password=$APP_PASSWORD,nextcloud.host=$APP_HOST,service.type={{ .Values.service.type }},mariadb.enabled=false{{- if not (empty .Values.externalDatabase.host) }},externalDatabase.host={{ .Values.externalDatabase.host }}{{- end }}{{- if not (empty .Values.externalDatabase.user) }},externalDatabase.user={{ .Values.externalDatabase.user }}{{- end }}{{- if not (empty .Values.externalDatabase.password) }},externalDatabase.password={{ .Values.externalDatabase.password }}{{- end }}{{- if not (empty .Values.externalDatabase.database) }},externalDatabase.database={{ .Values.externalDatabase.database }}{{- end }} -{{- end }} - -{{- else -}} -1. Get the nextcloud URL by running: - -{{- if eq .Values.service.type "ClusterIP" }} - - export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ template "nextcloud.fullname" . }}" -o jsonpath="{.items[0].metadata.name}") - echo http://127.0.0.1:8080/ - kubectl port-forward $POD_NAME 8080:80 -{{- else }} - - echo http://{{ .Values.nextcloud.host }}/ -{{- end }} - -2. Get your nextcloud login credentials by running: - - echo User: {{ .Values.nextcloud.username }} - echo Password: $(kubectl get secret --namespace {{ .Release.Namespace }} {{ template "nextcloud.fullname" . }} -o jsonpath="{.data.nextcloud-password}" | base64 --decode) -{{- end }} - -{{- else -}} - -####################################################################################################### -## WARNING: You did not provide an external database host in your 'helm install' call ## -## Running Nextcloud with the integrated sqlite database is not recommended for production instances ## -####################################################################################################### - -For better performance etc. you have to configure nextcloud with a resolvable database -host. To configure nextcloud to use and external database host: - - -1. Complete your nextcloud deployment by running: - -{{- if contains "NodePort" .Values.service.type }} - export APP_HOST=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") -{{- else if contains "LoadBalancer" .Values.service.type }} - - NOTE: It may take a few minutes for the LoadBalancer IP to be available. - Watch the status with: 'kubectl get svc --namespace {{ .Release.Namespace }} -w {{ template "nextcloud.fullname" . }}' - - export APP_HOST=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "nextcloud.fullname" . }} --template "{{ "{{ range (index .status.loadBalancer.ingress 0) }}{{ . }}{{ end }}" }}") -{{- else }} - - export APP_HOST=127.0.0.1 -{{- end }} - export APP_PASSWORD=$(kubectl get secret --namespace {{ .Release.Namespace }} {{ template "nextcloud.fullname" . }} -o jsonpath="{.data.nextcloud-password}" | base64 --decode) - - ## PLEASE UPDATE THE EXTERNAL DATABASE CONNECTION PARAMETERS IN THE FOLLOWING COMMAND AS NEEDED ## - - helm upgrade {{ .Release.Name }} nextcloud/nextcloud \ - --set nextcloud.password=$APP_PASSWORD,nextcloud.host=$APP_HOST,service.type={{ .Values.service.type }},mariadb.enabled=false{{- if not (empty .Values.externalDatabase.user) }},externalDatabase.user={{ .Values.externalDatabase.user }}{{- end }}{{- if not (empty .Values.externalDatabase.password) }},externalDatabase.password={{ .Values.externalDatabase.password }}{{- end }}{{- if not (empty .Values.externalDatabase.database) }},externalDatabase.database={{ .Values.externalDatabase.database }}{{- end }},externalDatabase.host=YOUR_EXTERNAL_DATABASE_HOST -{{- end }} + echo http://{{ .Values.nextcloud.host }}:{{ .Values.service.type }}/ diff --git a/test/nextcloud/2.3.2/templates/db-secret.yaml b/test/nextcloud/2.3.2/templates/db-secret.yaml index 790b65b75be..22149b92b07 100644 --- a/test/nextcloud/2.3.2/templates/db-secret.yaml +++ b/test/nextcloud/2.3.2/templates/db-secret.yaml @@ -1,4 +1,4 @@ -{{- if or .Values.mariadb.enabled .Values.externalDatabase.enabled }} +{{- if .Values.externalDatabase.enabled }} {{- if not .Values.externalDatabase.existingSecret.enabled }} apiVersion: v1 kind: Secret @@ -11,12 +11,7 @@ metadata: app.kubernetes.io/managed-by: {{ .Release.Service }} type: Opaque data: - {{- if .Values.mariadb.enabled }} - db-password: {{ default "" .Values.mariadb.db.password | b64enc | quote }} - db-username: {{ default "" .Values.mariadb.db.user | b64enc | quote }} - {{- else }} db-password: {{ default "" .Values.externalDatabase.password | b64enc | quote }} db-username: {{ default "" .Values.externalDatabase.user | b64enc | quote }} - {{- end }} {{- end }} {{- end }} \ No newline at end of file diff --git a/test/nextcloud/2.3.2/templates/deployment.yaml b/test/nextcloud/2.3.2/templates/deployment.yaml index e520e753411..d9fc472d9ca 100644 --- a/test/nextcloud/2.3.2/templates/deployment.yaml +++ b/test/nextcloud/2.3.2/templates/deployment.yaml @@ -27,9 +27,6 @@ spec: app.kubernetes.io/name: {{ include "nextcloud.name" . }} app.kubernetes.io/instance: {{ .Release.Name }} app.kubernetes.io/component: app - {{- if .Values.redis.enabled }} - {{ template "nextcloud.redis.fullname" . }}-client: "true" - {{- end }} {{- if .Values.podAnnotations }} annotations: {{ toYaml .Values.podAnnotations | indent 8 }} @@ -64,21 +61,6 @@ spec: {{- if .Values.internalDatabase.enabled }} - name: SQLITE_DATABASE value: {{ .Values.internalDatabase.name | quote }} - {{- else if .Values.mariadb.enabled }} - - name: MYSQL_HOST - value: {{ template "nextcloud.mariadb.fullname" . }} - - name: MYSQL_DATABASE - value: {{ .Values.mariadb.db.name | quote }} - - name: MYSQL_USER - valueFrom: - secretKeyRef: - name: {{ .Values.externalDatabase.existingSecret.secretName | default (printf "%s-%s" .Release.Name "db") }} - key: {{ .Values.externalDatabase.existingSecret.usernameKey | default "db-username" }} - - name: MYSQL_PASSWORD - valueFrom: - secretKeyRef: - name: {{ .Values.externalDatabase.existingSecret.secretName | default (printf "%s-%s" .Release.Name "db") }} - key: {{ .Values.externalDatabase.existingSecret.passwordKey | default "db-password" }} {{- else }} {{- if eq .Values.externalDatabase.type "postgresql" }} - name: POSTGRES_HOST @@ -158,12 +140,6 @@ spec: name: {{ template "nextcloud.fullname" . }} key: smtp-password {{- end }} - {{- if .Values.redis.enabled }} - - name: REDIS_HOST - value: {{ template "nextcloud.redis.fullname" . }}-master - - name: REDIS_HOST_PORT - value: {{ .Values.redis.redisPort | quote }} - {{- end }} {{- if .Values.nextcloud.extraEnv }} {{ toYaml .Values.nextcloud.extraEnv | indent 8 }} {{- end }} @@ -325,10 +301,7 @@ spec: {{- end }} volumes: - name: nextcloud-data - {{- if .Values.persistence.enabled }} - persistentVolumeClaim: - claimName: {{ if .Values.persistence.existingClaim }}{{ .Values.persistence.existingClaim }}{{- else }}{{ template "nextcloud.fullname" . }}-nextcloud{{- end }} - {{- else if ne (include "configuredHostPath" .) "" }} + {{- if ne (include "configuredHostPath" .) "" }} hostPath: path: {{ template "configuredHostPath" . }} {{- else }} diff --git a/test/nextcloud/2.3.2/templates/hpa.yaml b/test/nextcloud/2.3.2/templates/hpa.yaml deleted file mode 100644 index 52a30043a5c..00000000000 --- a/test/nextcloud/2.3.2/templates/hpa.yaml +++ /dev/null @@ -1,20 +0,0 @@ -{{- if .Values.hpa.enabled -}} -apiVersion: autoscaling/v1 -kind: HorizontalPodAutoscaler -metadata: - name: {{ template "nextcloud.fullname" . }} - labels: - app.kubernetes.io/name: {{ include "nextcloud.name" . }} - helm.sh/chart: {{ include "nextcloud.chart" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/managed-by: {{ .Release.Service }} - app.kubernetes.io/component: app -spec: - scaleTargetRef: - kind: Deployment - apiVersion: apps/v1 - name: {{ template "nextcloud.fullname" . }} - minReplicas: {{ .Values.hpa.minPods }} - maxReplicas: {{ .Values.hpa.maxPods }} - targetCPUUtilizationPercentage: {{ .Values.hpa.cputhreshold }} -{{- end }} \ No newline at end of file diff --git a/test/nextcloud/2.3.2/templates/ingress.yaml b/test/nextcloud/2.3.2/templates/ingress.yaml deleted file mode 100644 index 980c79a29dc..00000000000 --- a/test/nextcloud/2.3.2/templates/ingress.yaml +++ /dev/null @@ -1,31 +0,0 @@ -{{- if .Values.ingress.enabled }} -apiVersion: networking.k8s.io/v1beta1 -kind: Ingress -metadata: - name: {{ template "nextcloud.fullname" . }} - labels: - app.kubernetes.io/name: {{ include "nextcloud.name" . }} - helm.sh/chart: {{ include "nextcloud.chart" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/managed-by: {{ .Release.Service }} - app.kubernetes.io/component: app -{{- if .Values.ingress.labels }} -{{ toYaml .Values.ingress.labels | indent 4 }} -{{- end }} -{{- if .Values.ingress.annotations }} - annotations: -{{ toYaml .Values.ingress.annotations | indent 4 }} -{{- end }} -spec: - rules: - - host: {{ .Values.nextcloud.host }} - http: - paths: - - backend: - serviceName: {{ template "nextcloud.fullname" . }} - servicePort: {{ .Values.service.port }} -{{- if .Values.ingress.tls }} - tls: -{{ toYaml .Values.ingress.tls | indent 4 }} -{{- end -}} -{{- end }} diff --git a/test/nextcloud/2.3.2/templates/metrics-deployment.yaml b/test/nextcloud/2.3.2/templates/metrics-deployment.yaml deleted file mode 100644 index 66eb8421030..00000000000 --- a/test/nextcloud/2.3.2/templates/metrics-deployment.yaml +++ /dev/null @@ -1,55 +0,0 @@ -{{- if .Values.metrics.enabled }} -apiVersion: apps/v1 -kind: Deployment -metadata: - name: {{ template "nextcloud.fullname" . }}-metrics - labels: - app.kubernetes.io/name: {{ include "nextcloud.name" . }} - helm.sh/chart: {{ include "nextcloud.chart" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/managed-by: {{ .Release.Service }} - app.kubernetes.io/component: metrics -spec: - replicas: {{ .Values.metrics.replicaCount }} - selector: - matchLabels: - app.kubernetes.io/name: {{ include "nextcloud.name" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/component: metrics - template: - metadata: - annotations: {{- toYaml .Values.metrics.podAnnotations | nindent 8 }} - labels: - app.kubernetes.io/name: {{ include "nextcloud.name" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/component: metrics - {{- if .Values.metrics.podLabels }} -{{ toYaml .Values.metrics.podLabels | indent 8 }} - {{- end }} - spec: - containers: - - name: metrics-exporter - image: "{{ .Values.metrics.image.repository }}:{{ .Values.metrics.image.tag }}" - imagePullPolicy: {{ .Values.metrics.image.pullPolicy }} - env: - - name: NEXTCLOUD_USERNAME - valueFrom: - secretKeyRef: - name: {{ template "nextcloud.fullname" . }} - key: nextcloud-username - - name: NEXTCLOUD_PASSWORD - valueFrom: - secretKeyRef: - name: {{ template "nextcloud.fullname" . }} - key: nextcloud-password - - name: NEXTCLOUD_SERVER - value: http{{ if .Values.metrics.https }}s{{ end }}://{{ .Values.nextcloud.host }} - - name: NEXTCLOUD_TIMEOUT - value: {{ .Values.metrics.timeout }} - ports: - - name: metrics - containerPort: 9205 - {{- if .Values.metrics.resources }} - resources: {{- toYaml .Values.metrics.resources | nindent 10 }} - {{- end }} -{{- end }} diff --git a/test/nextcloud/2.3.2/templates/metrics-service.yaml b/test/nextcloud/2.3.2/templates/metrics-service.yaml deleted file mode 100644 index b349751cf20..00000000000 --- a/test/nextcloud/2.3.2/templates/metrics-service.yaml +++ /dev/null @@ -1,31 +0,0 @@ -{{- if .Values.metrics.enabled }} -apiVersion: v1 -kind: Service -metadata: - name: {{ template "nextcloud.fullname" . }}-metrics - labels: - labels: - app.kubernetes.io/name: {{ include "nextcloud.name" . }} - helm.sh/chart: {{ include "nextcloud.chart" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/managed-by: {{ .Release.Service }} - {{- if .Values.metrics.service.labels -}} - {{ toYaml .Values.metrics.service.labels | nindent 4 }} - {{- end -}} - {{- if .Values.metrics.service.annotations }} - annotations: {{ toYaml .Values.metrics.service.annotations | nindent 4 }} - {{- end }} -spec: - type: {{ .Values.metrics.service.type }} - {{ if eq .Values.metrics.service.type "LoadBalancer" -}} {{ if .Values.metrics.service.loadBalancerIP }} - loadBalancerIP: {{ .Values.metrics.service.loadBalancerIP }} - {{ end -}} - {{- end -}} - ports: - - name: metrics - port: 9205 - targetPort: metrics - selector: - app.kubernetes.io/name: {{ include "nextcloud.name" . }} - app.kubernetes.io/instance: {{ .Release.Name }} -{{- end }} diff --git a/test/nextcloud/2.3.2/templates/nextcloud-pvc.yaml b/test/nextcloud/2.3.2/templates/nextcloud-pvc.yaml deleted file mode 100644 index 8c1789afdb3..00000000000 --- a/test/nextcloud/2.3.2/templates/nextcloud-pvc.yaml +++ /dev/null @@ -1,31 +0,0 @@ -{{- if .Values.persistence.enabled -}} -{{- if not .Values.persistence.existingClaim -}} -kind: PersistentVolumeClaim -apiVersion: v1 -metadata: - name: {{ template "nextcloud.fullname" . }}-nextcloud - labels: - app.kubernetes.io/name: {{ include "nextcloud.name" . }} - helm.sh/chart: {{ include "nextcloud.chart" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/managed-by: {{ .Release.Service }} - app.kubernetes.io/component: app -{{- if .Values.persistence.annotations }} - annotations: -{{ toYaml .Values.persistence.annotations | indent 4 }} -{{- end }} -spec: - accessModes: - - {{ .Values.persistence.accessMode | quote }} - resources: - requests: - storage: {{ .Values.persistence.size | quote }} -{{- if .Values.persistence.storageClass }} -{{- if (eq "-" .Values.persistence.storageClass) }} - storageClassName: "" -{{- else }} - storageClassName: "{{ .Values.persistence.storageClass }}" -{{- end }} -{{- end }} -{{- end -}} -{{- end -}} diff --git a/test/nextcloud/2.3.2/templates/service.yaml b/test/nextcloud/2.3.2/templates/service.yaml index 68f67e94825..7f307f5caf7 100644 --- a/test/nextcloud/2.3.2/templates/service.yaml +++ b/test/nextcloud/2.3.2/templates/service.yaml @@ -9,17 +9,12 @@ metadata: app.kubernetes.io/managed-by: {{ .Release.Service }} app.kubernetes.io/component: app spec: - type: {{ .Values.service.type }} - {{- if eq .Values.service.type "LoadBalancer" }} - loadBalancerIP: {{ default "" .Values.service.loadBalancerIP }} - {{- end }} + type: NodePort ports: - - port: {{ .Values.service.port }} + - port: 80 targetPort: http protocol: TCP name: http - {{- if eq .Values.service.type "NodePort" }} nodePort: {{ default "" .Values.service.nodePort}} - {{- end }} selector: app.kubernetes.io/name: {{ include "nextcloud.name" . }} diff --git a/test/nextcloud/2.3.2/values.yaml b/test/nextcloud/2.3.2/values.yaml index c1f02cfae10..ee2b903969f 100644 --- a/test/nextcloud/2.3.2/values.yaml +++ b/test/nextcloud/2.3.2/values.yaml @@ -216,9 +216,6 @@ cronjob: # affinity: {} service: - type: NodePort - port: 80 - loadBalancerIP: nil nodePort: 9000 ## Liveness and readiness probe values