Last active
March 4, 2020 16:27
-
-
Save miguel-amaral/1eeeb7958e6ba51abc815e44589e83bb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
apiVersion: v1 | |
kind: Service | |
metadata: | |
name: "%%app_name%%-service" | |
namespace: "%%env%%-%%namespace%%" | |
labels: | |
app: "%%app_name%%" | |
spec: | |
selector: | |
app: "%%app_name%%" | |
ports: | |
- name: http | |
protocol: TCP | |
port: %%application_port%% | |
targetPort: %%application_port%% | |
type: ClusterIP | |
--- | |
apiVersion: vaultproject.io/v1 | |
kind: SecretClaim | |
metadata: | |
name: "%%app_name%%-%%config_version%%-envvars" | |
namespace: "%%env%%-%%namespace%%" | |
spec: | |
type: Opaque | |
path: "secret/app/appconfig/%%env%%/%%namespace%%/%%app_name%%/%%config_version%%" | |
renew: 3600 | |
--- | |
apiVersion: apps/v1 | |
kind: Deployment | |
metadata: | |
name: "%%app_name%%" | |
namespace: "%%env%%-%%namespace%%" | |
labels: | |
app: "%%app_name%%" | |
annotations: | |
kubernetes.io/change-cause: "%%change_cause%%" | |
spec: | |
selector: | |
matchLabels: | |
app: "%%app_name%%" | |
strategy: | |
type: RollingUpdate | |
rollingUpdate: | |
maxSurge: 25% | |
maxUnavailable: 0 | |
template: | |
metadata: | |
name: "%%app_name%%" | |
namespace: "%%env%%-%%namespace%%" | |
labels: | |
app: "%%app_name%%" | |
spec: | |
affinity: | |
podAntiAffinity: | |
preferredDuringSchedulingIgnoredDuringExecution: | |
- weight: 100 | |
podAffinityTerm: | |
topologyKey: kubernetes.io/hostname | |
labelSelector: | |
matchExpressions: | |
- key: app | |
operator: In | |
values: | |
- %%app_name%% | |
terminationGracePeriodSeconds: 60 | |
containers: | |
- name: "%%app_name%%" | |
image: "%%docker_image%%" | |
lifecycle: | |
preStop: | |
exec: | |
command: [ | |
"sh", "-c", | |
# Introduce a delay to the shutdown sequence to wait for the | |
# pod eviction event to propagate. Then, gracefully shutdown | |
# pod. | |
"sleep 30", | |
] | |
imagePullPolicy: IfNotPresent | |
ports: | |
- name: service | |
containerPort: %%application_port%% | |
- name: probe | |
containerPort: %%probe_port%% | |
env: | |
- name: DYNO | |
valueFrom: | |
fieldRef: | |
fieldPath: metadata.name | |
- name: POD_NAME | |
valueFrom: | |
fieldRef: | |
fieldPath: metadata.name | |
- name: POD_NAMESPACE | |
valueFrom: | |
fieldRef: | |
fieldPath: metadata.namespace | |
- name: POD_IP | |
valueFrom: | |
fieldRef: | |
fieldPath: status.podIP | |
envFrom: | |
- secretRef: | |
name: "%%app_name%%-%%config_version%%-envvars" | |
command: %%command%% | |
args: %%args%% | |
livenessProbe: | |
httpGet: | |
path: %%liveness_uri%% | |
port: probe | |
initialDelaySeconds: 60 | |
periodSeconds: 5 | |
timeoutSeconds: 3 | |
successThreshold: 1 | |
failureThreshold: 3 | |
readinessProbe: | |
httpGet: | |
path: %%readiness_uri%% | |
port: probe | |
initialDelaySeconds: 50 | |
periodSeconds: 5 | |
timeoutSeconds: 3 | |
successThreshold: 1 | |
failureThreshold: 3 | |
resources: | |
requests: | |
cpu: "250m" | |
memory: "256Mi" | |
limits: | |
cpu: "250m" | |
memory: "256Mi" | |
--- | |
apiVersion: policy/v1beta1 | |
kind: PodDisruptionBudget | |
metadata: | |
name: "%%app_name%%" | |
namespace: "%%env%%-%%namespace%%" | |
spec: | |
minAvailable: 1 | |
selector: | |
matchLabels: | |
app: "%%app_name%%" | |
--- | |
apiVersion: autoscaling/v1 | |
kind: HorizontalPodAutoscaler | |
metadata: | |
name: "%%app_name%%" | |
namespace: "%%env%%-%%namespace%%" | |
spec: | |
scaleTargetRef: | |
apiVersion: apps/v1 | |
kind: Deployment | |
name: "%%app_name%%" | |
minReplicas: %%min_replicas%% | |
maxReplicas: %%max_replicas%% | |
targetCPUUtilizationPercentage: 70 | |
--- | |
apiVersion: extensions/v1beta1 | |
kind: Ingress | |
metadata: | |
annotations: | |
kubernetes.io/ingress.class: "nginx" | |
name: "%%app_name%%" | |
namespace: "%%env%%-%%namespace%%" | |
spec: | |
rules: | |
- host: "%%app_url%%.%%cluster_hostname%%" | |
http: | |
paths: | |
- backend: | |
serviceName: "%%app_name%%-service" | |
servicePort: %%application_port%% | |
path: / | |
- host: "%%app_url%%%%app_url_suffix%%" | |
http: | |
paths: | |
- backend: | |
serviceName: "%%app_name%%-service" | |
servicePort: %%application_port%% | |
path: / | |
tls: | |
- hosts: | |
- "%%app_url%%.%%cluster_hostname%%" | |
secretName: "wildcard-%%env%%-cert-tls" | |
- hosts: | |
- "%%app_url%%%%app_url_suffix%%" | |
secretName: "wildcard-%%env%%" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment