Working demo with basic template
parent
03e63d43fc
commit
3048694ed1
@ -1,13 +1,14 @@
|
|||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
kind: Service
|
kind: Service
|
||||||
|
# https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#metadata
|
||||||
metadata:
|
metadata:
|
||||||
labels:
|
labels:
|
||||||
name: backend
|
name: {{ $.Release.Name }}-{{ $.Chart.Name}}-backend-service
|
||||||
name: backend
|
name: {{ $.Release.Name }}-{{ $.Chart.Name}}-backend-service
|
||||||
spec:
|
spec:
|
||||||
ports:
|
ports:
|
||||||
- protocol: 'TCP'
|
- protocol: 'TCP'
|
||||||
port: 80
|
port: 80
|
||||||
targetPort: 5000
|
targetPort: 5000
|
||||||
selector:
|
selector:
|
||||||
app: backend
|
app: {{ $.Release.Name }}-{{ $.Chart.Name}}-backend
|
||||||
|
@ -1,23 +1,32 @@
|
|||||||
apiVersion: apps/v1
|
apiVersion: apps/v1
|
||||||
kind: Deployment
|
kind: Deployment
|
||||||
|
# https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#metadata
|
||||||
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:
|
spec:
|
||||||
replicas: 1
|
{{- with .Values.services.backend }}
|
||||||
|
replicas: {{ .replicas }}
|
||||||
selector:
|
selector:
|
||||||
matchLabels:
|
matchLabels:
|
||||||
app: backend
|
app: {{ $.Release.Name }}-{{ $.Chart.Name}}-backend
|
||||||
template:
|
template:
|
||||||
metadata:
|
metadata:
|
||||||
labels:
|
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:
|
spec:
|
||||||
containers:
|
containers:
|
||||||
- image: registry.runcible.io/demo-helm:1.1.0
|
- name: {{ $.Release.Name }}-{{ $.Chart.Name}}-backend
|
||||||
|
image: {{ .image_name }}:{{ .image_version }}
|
||||||
imagePullPolicy: Always
|
imagePullPolicy: Always
|
||||||
name: backend
|
|
||||||
ports:
|
ports:
|
||||||
- name: backend
|
- containerPort: 5000
|
||||||
containerPort: 5000
|
|
||||||
imagePullSecrets:
|
imagePullSecrets:
|
||||||
- name: regcred
|
- name: {{ $.Values.image_pull_secret }}
|
||||||
|
{{- end }}
|
@ -1,14 +1,17 @@
|
|||||||
apiVersion: extensions/v1beta1
|
apiVersion: networking.k8s.io/v1
|
||||||
# apiVersion: networking.k8s.io/v1 # Supposed to be the new API but of course the spec structure has changed.
|
|
||||||
kind: Ingress
|
kind: Ingress
|
||||||
|
# https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#metadata
|
||||||
metadata:
|
metadata:
|
||||||
name: demo-helm-ingress
|
name: {{ .Release.Name }}-{{ .Chart.Name}}-backend-ingress
|
||||||
spec:
|
spec:
|
||||||
rules:
|
rules:
|
||||||
- host: backend.runcible.io
|
- host: backend.runcible.io
|
||||||
http:
|
http:
|
||||||
paths:
|
paths:
|
||||||
- path: /
|
- path: /
|
||||||
|
pathType: Prefix
|
||||||
backend:
|
backend:
|
||||||
serviceName: backend
|
service:
|
||||||
servicePort: 80
|
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…
Reference in New Issue