[stable/opencart] #1785 namespace defined templates with chart name (#2169)

This commit is contained in:
Kevin Schumacher
2017-10-05 01:12:11 +05:30
committed by Dhilip
parent 7f9c6d76b1
commit 739e04cf8d
8 changed files with 42 additions and 41 deletions
+3 -2
View File
@@ -1,7 +1,8 @@
name: opencart
version: 0.5.4
version: 0.6.0
appVersion: 3.0.2
description: A free and open source e-commerce platform for online merchants. It provides a professional and reliable foundation for a successful online store.
description: A free and open source e-commerce platform for online merchants. It provides
a professional and reliable foundation for a successful online store.
keywords:
- opencart
- e-commerce
+10 -10
View File
@@ -1,4 +1,4 @@
{{- if empty (include "host" .) -}}
{{- if empty (include "opencart.host" .) -}}
###############################################################################
### ERROR: You did not provide an external host in your 'helm install' call ###
###############################################################################
@@ -10,18 +10,18 @@ host. To configure OpenCart with the URL of your service:
{{- if contains "NodePort" .Values.serviceType }}
export APP_PORT=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "fullname" . }} -o jsonpath="{.spec.ports[0].nodePort}")
export APP_PORT=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "opencart.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.serviceType }}
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 "fullname" . }}'
Watch the status with: 'kubectl get svc --namespace {{ .Release.Namespace }} -w {{ template "opencart.fullname" . }}'
export APP_HOST=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "fullname" . }} --template "{{ "{{ range (index .status.loadBalancer.ingress 0) }}{{ . }}{{ end }}" }}")
export APP_PASSWORD=$(kubectl get secret --namespace {{ .Release.Namespace }} {{ template "fullname" . }} -o jsonpath="{.data.opencart-password}" | base64 --decode)
export APP_HOST=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "opencart.fullname" . }} --template "{{ "{{ range (index .status.loadBalancer.ingress 0) }}{{ . }}{{ end }}" }}")
export APP_PASSWORD=$(kubectl get secret --namespace {{ .Release.Namespace }} {{ template "opencart.fullname" . }} -o jsonpath="{.data.opencart-password}" | base64 --decode)
{{- if .Values.mariadb.mariadbRootPassword }}
export APP_DATABASE_PASSWORD=$(kubectl get secret --namespace {{ .Release.Namespace }} {{ template "mariadb.fullname" . }} -o jsonpath="{.data.mariadb-root-password}" | base64 --decode)
export APP_DATABASE_PASSWORD=$(kubectl get secret --namespace {{ .Release.Namespace }} {{ template "opencart.mariadb.fullname" . }} -o jsonpath="{.data.mariadb-root-password}" | base64 --decode)
{{- end }}
{{- end }}
@@ -35,16 +35,16 @@ host. To configure OpenCart with the URL of your service:
{{- if eq .Values.serviceType "ClusterIP" }}
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app={{ template "fullname" . }}" -o jsonpath="{.items[0].metadata.name}")
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app={{ template "opencart.fullname" . }}" -o jsonpath="{.items[0].metadata.name}")
echo http://127.0.0.1:8080/
kubectl port-forward $POD_NAME 8080:80
{{- else }}
echo URL : http://{{ include "host" . }}/
echo Adminstration URL : http://{{ include "host" . }}/admin
echo URL : http://{{ include "opencart.host" . }}/
echo Adminstration URL : http://{{ include "opencart.host" . }}/admin
{{- end }}
2. Get your OpenCart login credentials by running:
echo Admin Username: {{ .Values.opencartUsername }}
echo Admin Password: $(kubectl get secret --namespace {{ .Release.Namespace }} {{ template "fullname" . }} -o jsonpath="{.data.opencart-password}" | base64 --decode)
echo Admin Password: $(kubectl get secret --namespace {{ .Release.Namespace }} {{ template "opencart.fullname" . }} -o jsonpath="{.data.opencart-password}" | base64 --decode)
{{- end }}
+6 -6
View File
@@ -2,7 +2,7 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "name" -}}
{{- define "opencart.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- end -}}
@@ -10,7 +10,7 @@ Expand the name of the chart.
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
*/}}
{{- define "fullname" -}}
{{- define "opencart.fullname" -}}
{{- $name := default .Chart.Name .Values.nameOverride -}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- end -}}
@@ -19,7 +19,7 @@ We truncate at 63 chars because some Kubernetes name fields are limited to this
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
*/}}
{{- define "mariadb.fullname" -}}
{{- define "opencart.mariadb.fullname" -}}
{{- printf "%s-%s" .Release.Name "mariadb" | trunc 63 | trimSuffix "-" -}}
{{- end -}}
@@ -27,7 +27,7 @@ We truncate at 63 chars because some Kubernetes name fields are limited to this
Get the user defined LoadBalancerIP for this release.
Note, returns 127.0.0.1 if using ClusterIP.
*/}}
{{- define "serviceIP" -}}
{{- define "opencart.serviceIP" -}}
{{- if eq .Values.serviceType "ClusterIP" -}}
127.0.0.1
{{- else -}}
@@ -39,7 +39,7 @@ Note, returns 127.0.0.1 if using ClusterIP.
Gets the host to be used for this application.
If not using ClusterIP, or if a host or LoadBalancerIP is not defined, the value will be empty.
*/}}
{{- define "host" -}}
{{- define "opencart.host" -}}
{{- $host := index .Values (printf "%sHost" .Chart.Name) | default "" -}}
{{- default (include "serviceIP" .) $host -}}
{{- default (include "opencart.serviceIP" .) $host -}}
{{- end -}}
+2 -2
View File
@@ -2,9 +2,9 @@
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: {{ template "fullname" . }}-apache
name: {{ template "opencart.fullname" . }}-apache
labels:
app: {{ template "fullname" . }}
app: {{ template "opencart.fullname" . }}
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
+14 -14
View File
@@ -1,10 +1,10 @@
{{- if include "host" . -}}
{{- if include "opencart.host" . -}}
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: {{ template "fullname" . }}
name: {{ template "opencart.fullname" . }}
labels:
app: {{ template "fullname" . }}
app: {{ template "opencart.fullname" . }}
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
@@ -12,30 +12,30 @@ spec:
template:
metadata:
labels:
app: {{ template "fullname" . }}
app: {{ template "opencart.fullname" . }}
spec:
containers:
- name: {{ template "fullname" . }}
- name: {{ template "opencart.fullname" . }}
image: "{{ .Values.image }}"
imagePullPolicy: {{ default "" .Values.imagePullPolicy | quote }}
env:
- name: MARIADB_HOST
value: {{ template "mariadb.fullname" . }}
value: {{ template "opencart.mariadb.fullname" . }}
- name: MARIADB_PORT_NUMBER
value: "3306"
- name: MARIADB_PASSWORD
valueFrom:
secretKeyRef:
name: {{ template "mariadb.fullname" . }}
name: {{ template "opencart.mariadb.fullname" . }}
key: mariadb-root-password
- name: OPENCART_HOST
value: {{ include "host" . | quote }}
value: {{ include "opencart.host" . | quote }}
- name: OPENCART_USERNAME
value: {{ default "" .Values.opencartUsername | quote }}
- name: OPENCART_PASSWORD
valueFrom:
secretKeyRef:
name: {{ template "fullname" . }}
name: {{ template "opencart.fullname" . }}
key: opencart-password
- name: OPENCART_EMAIL
value: {{ default "" .Values.opencartEmail | quote }}
@@ -48,7 +48,7 @@ spec:
- name: SMTP_PASSWORD
valueFrom:
secretKeyRef:
name: {{ template "fullname" . }}
name: {{ template "opencart.fullname" . }}
key: smtp-password
- name: SMTP_PROTOCOL
value: {{ default "" .Values.smtpProtocol | quote }}
@@ -63,7 +63,7 @@ spec:
port: http
httpHeaders:
- name: Host
value: {{ include "host" . | quote }}
value: {{ include "opencart.host" . | quote }}
initialDelaySeconds: 120
timeoutSeconds: 5
failureThreshold: 6
@@ -73,7 +73,7 @@ spec:
port: http
httpHeaders:
- name: Host
value: {{ include "host" . | quote }}
value: {{ include "opencart.host" . | quote }}
initialDelaySeconds: 30
timeoutSeconds: 3
periodSeconds: 5
@@ -88,14 +88,14 @@ spec:
- name: opencart-data
{{- if .Values.persistence.enabled }}
persistentVolumeClaim:
claimName: {{ template "fullname" . }}-opencart
claimName: {{ template "opencart.fullname" . }}-opencart
{{- else }}
emptyDir: {}
{{- end }}
- name: apache-data
{{- if .Values.persistence.enabled }}
persistentVolumeClaim:
claimName: {{ template "fullname" . }}-apache
claimName: {{ template "opencart.fullname" . }}-apache
{{- else }}
emptyDir: {}
{{- end }}
+2 -2
View File
@@ -2,9 +2,9 @@
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: {{ template "fullname" . }}-opencart
name: {{ template "opencart.fullname" . }}-opencart
labels:
app: {{ template "fullname" . }}
app: {{ template "opencart.fullname" . }}
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
+2 -2
View File
@@ -1,9 +1,9 @@
apiVersion: v1
kind: Secret
metadata:
name: {{ template "fullname" . }}
name: {{ template "opencart.fullname" . }}
labels:
app: {{ template "fullname" . }}
app: {{ template "opencart.fullname" . }}
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
+3 -3
View File
@@ -1,9 +1,9 @@
apiVersion: v1
kind: Service
metadata:
name: {{ template "fullname" . }}
name: {{ template "opencart.fullname" . }}
labels:
app: {{ template "fullname" . }}
app: {{ template "opencart.fullname" . }}
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
@@ -20,4 +20,4 @@ spec:
port: 443
targetPort: https
selector:
app: {{ template "fullname" . }}
app: {{ template "opencart.fullname" . }}