apiVersion: v1 kind: Service metadata: name: {{ .Release.Name }}-app labels: app.kubernetes.io/name: {{ .Chart.Name }} app.kubernetes.io/instance: {{ .Release.Name }} app.kubernetes.io/component: app spec: type: {{ .Values.service.type }} ports: - port: {{ .Values.service.port }} targetPort: {{ .Values.app.port }} protocol: TCP name: http selector: app.kubernetes.io/name: {{ .Chart.Name }} app.kubernetes.io/instance: {{ .Release.Name }} app.kubernetes.io/component: app --- {{- if .Values.database.enabled }} apiVersion: v1 kind: Service metadata: name: {{ .Release.Name }}-database labels: app.kubernetes.io/name: {{ .Chart.Name }} app.kubernetes.io/instance: {{ .Release.Name }} app.kubernetes.io/component: database spec: type: ClusterIP ports: - port: 3306 targetPort: 3306 protocol: TCP name: mysql selector: app.kubernetes.io/name: {{ .Chart.Name }} app.kubernetes.io/instance: {{ .Release.Name }} app.kubernetes.io/component: database {{- end }} --- {{- if .Values.redis.enabled }} apiVersion: v1 kind: Service metadata: name: {{ .Release.Name }}-redis labels: app.kubernetes.io/name: {{ .Chart.Name }} app.kubernetes.io/instance: {{ .Release.Name }} app.kubernetes.io/component: redis spec: type: ClusterIP ports: - port: 6379 targetPort: 6379 protocol: TCP name: redis selector: app.kubernetes.io/name: {{ .Chart.Name }} app.kubernetes.io/instance: {{ .Release.Name }} app.kubernetes.io/component: redis {{- end }}