teamhephy / controller

Hephy Workflow Controller (API)
https://teamhephy.com
MIT License
14 stars 26 forks source link

feat(deployment.py): add support for annotations to deployments and carry forward #83

Closed Cryptophobia closed 5 years ago

Cryptophobia commented 5 years ago

closes https://github.com/teamhephy/workflow/issues/73

Requires manual edit on the deployment:

kubectl edit deployment rocksolidapp-web -n rocksolidapp

Then edit the part:

...
spec:
  (...skipping top parts...)
  template:
    metadata:
      annotations:
        iam.amazonaws.com/role: role-arn-pods
        nginx.ingress.kubernetes.io/app-root: /rootfs
        sidecar.istio.io/inject: "true"
      creationTimestamp: null
      labels:
        app: rocksolidapp
        heritage: deis
        type: web
        version: v39
      name: rocksolidapp-web
      namespace: rocksolidapp

and add the annotations on the deployment['spec']['template']['metadata']['annotations'] and the controller preserves these annotations for all releases after that. :anchor:

After a new release or scale event the Pods of an app will have this yaml:

apiVersion: v1
kind: Pod
metadata:
  annotations:
    iam.amazonaws.com/role: role-arn-pods
    nginx.ingress.kubernetes.io/app-root: /rootfs
    sidecar.istio.io/inject: "true"
  creationTimestamp: 2018-11-07T14:45:50Z
  generateName: rocksolidapp-web-5b68dc7d85-
  labels:
    app: rocksolidapp
    heritage: deis
(...skipping bottom parts...)

:+1: :rocket: :shipit:

Cryptophobia commented 5 years ago

I have tested this a lot. Works during scale and config:set events as well as new code pushes and any other new release events. You can use this image for testing:

cryptophobia/controller:test_annotations
Cryptophobia commented 5 years ago

Merging this in now! Thanks for reviewing guys :+1: