Working demo with basic template

master
Drew Bednar 3 years ago
parent 03e63d43fc
commit 3048694ed1

@ -1,13 +1,14 @@
apiVersion: v1
kind: Service
# https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#metadata
metadata:
labels:
name: backend
name: backend
name: {{ $.Release.Name }}-{{ $.Chart.Name}}-backend-service
name: {{ $.Release.Name }}-{{ $.Chart.Name}}-backend-service
spec:
ports:
- protocol: 'TCP'
port: 80
targetPort: 5000
selector:
app: backend
app: {{ $.Release.Name }}-{{ $.Chart.Name}}-backend

@ -1,23 +1,32 @@
apiVersion: apps/v1
kind: Deployment
# https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#metadata
metadata:
name: backend
# This allows us to ensure we have a unique config name. Which means we could have two of the same service
# in the same namespace.
name: {{ .Release.Name }}-{{ .Chart.Name}}-deployment
labels:
app: {{ .Release.Name }}-{{ .Chart.Name}}-backend
spec:
replicas: 1
{{- with .Values.services.backend }}
replicas: {{ .replicas }}
selector:
matchLabels:
app: backend
app: {{ $.Release.Name }}-{{ $.Chart.Name}}-backend
template:
metadata:
labels:
app: backend
app: {{ $.Release.Name }}-{{ $.Chart.Name}}-backend
# Here I am just demonstrating that you can pull values from Chart.yaml or Releases.
# Note the capital first letter in accessing the values
app_version: {{ $.Chart.AppVersion }}
spec:
containers:
- image: registry.runcible.io/demo-helm:1.1.0
- name: {{ $.Release.Name }}-{{ $.Chart.Name}}-backend
image: {{ .image_name }}:{{ .image_version }}
imagePullPolicy: Always
name: backend
ports:
- name: backend
containerPort: 5000
- containerPort: 5000
imagePullSecrets:
- name: regcred
- name: {{ $.Values.image_pull_secret }}
{{- end }}

@ -1,14 +1,17 @@
apiVersion: extensions/v1beta1
# apiVersion: networking.k8s.io/v1 # Supposed to be the new API but of course the spec structure has changed.
apiVersion: networking.k8s.io/v1
kind: Ingress
# https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#metadata
metadata:
name: demo-helm-ingress
name: {{ .Release.Name }}-{{ .Chart.Name}}-backend-ingress
spec:
rules:
- host: backend.runcible.io
http:
paths:
- path: /
pathType: Prefix
backend:
serviceName: backend
servicePort: 80
service:
name: {{ $.Release.Name }}-{{ $.Chart.Name}}-backend-service
port:
number: 80

@ -0,0 +1,38 @@
{
"definitions": {},
"$schema": "http://json.schema.org/draft-07/schema#",
"type": "object",
"required": ["image_pull_secret", "services"],
"properties": {
"image_pull_secret": {
"type": "string"
},
"services": {
"type": "object",
"required": [
"backend"
],
"properties": {
"backend": {
"type": "object",
"required": [
"image_name",
"image_version",
"replicas"
],
"properties": {
"image_name": {
"type": "string"
},
"image_version": {
"type": "string"
},
"replicas": {
"type": "integer"
}
}
}
}
}
}
}

@ -0,0 +1,7 @@
---
image_pull_secret: regcred
services:
backend:
image_name: "registry.runcible.io/demo-helm"
image_version: "1.1.0"
replicas: 1
Loading…
Cancel
Save