Skip to content

Instantly share code, notes, and snippets.

@jakub-roman
Last active July 29, 2019 12:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jakub-roman/3d0476f89cea430d7a79ae6ad5563eb0 to your computer and use it in GitHub Desktop.
Save jakub-roman/3d0476f89cea430d7a79ae6ad5563eb0 to your computer and use it in GitHub Desktop.

with following config.yaml:

addons:
- helm/kube-system/iflix-namespaces-limits: ["all"]
  kustomize/kube-system/kubernetes-cluster-controller: ["ops"]
- helm/kube-system/kubernetes-github-authn: ["staging"]
  kustomize/kube-system/aws-secret-operator: ["green", "ops"]
  helm/kube-system/traefik: ["prod"]
  helm/kube-system/traefik-int: ["prod","staging","ops"]

clusters:
  ap-southeast-1-staging-green:
    labels: [ all, staging, green, staging-green ]
    env:
      KUBECONTEXT: k8s-staging-green
      ENV: staging
  ap-southeast-1-ops:
    labels: [ all, ops ]
    env:
      KUBECONTEXT: k8s-eks-ops
      ENV: admin

types:
  helm:
    script: helm/apply.sh
  kustomize:
    script: kustomize/apply.sh

The output of addons.py is following:

# ./hack/addons.py -c ap-southeast-1-ops -c ap-southeast-1-staging-green -o bash
ENV=admin KUBECONTEXT=k8s-eks-ops /opt/git/iflix/k8s/addons/helm/apply.sh ap-southeast-1-ops kube-system iflix-namespaces-limits
ENV=staging KUBECONTEXT=k8s-staging-green /opt/git/iflix/k8s/addons/helm/apply.sh ap-southeast-1-staging-green kube-system iflix-namespaces-limits
ENV=admin KUBECONTEXT=k8s-eks-ops /opt/git/iflix/k8s/addons/kustomize/apply.sh ap-southeast-1-ops kube-system kubernetes-cluster-controller
ENV=admin KUBECONTEXT=k8s-eks-ops /opt/git/iflix/k8s/addons/kustomize/apply.sh ap-southeast-1-ops kube-system aws-secret-operator
ENV=staging KUBECONTEXT=k8s-staging-green /opt/git/iflix/k8s/addons/kustomize/apply.sh ap-southeast-1-staging-green kube-system aws-secret-operator
ENV=admin KUBECONTEXT=k8s-eks-ops /opt/git/iflix/k8s/addons/helm/apply.sh ap-southeast-1-ops kube-system traefik-int
ENV=staging KUBECONTEXT=k8s-staging-green /opt/git/iflix/k8s/addons/helm/apply.sh ap-southeast-1-staging-green kube-system traefik-int
ENV=staging KUBECONTEXT=k8s-staging-green /opt/git/iflix/k8s/addons/helm/apply.sh ap-southeast-1-staging-green kube-system kubernetes-github-authn

or:

# ./hack/addons.py -c ap-southeast-1-ops -c ap-southeast-1-staging-green 
[
  [
    {
      "agents": {
        "stacks": "iflix-elastic-ci"
      },
      "env": {
        "KUBECONTEXT": "k8s-eks-ops",
        "ENV": "admin"
      },
      "command": [
        "addons/helm/apply.sh ap-southeast-1-ops kube-system iflix-namespaces-limits"
      ],
      "name": ":k8s: install kube-system/iflix-namespaces-limits to ap-southeast-1-ops using helm"
    },
    {
      "agents": {
        "stacks": "iflix-elastic-ci"
      },
      "env": {
        "KUBECONTEXT": "k8s-staging-green",
        "ENV": "staging"
      },
      "command": [
        "addons/helm/apply.sh ap-southeast-1-staging-green kube-system iflix-namespaces-limits"
      ],
      "name": ":k8s: install kube-system/iflix-namespaces-limits to ap-southeast-1-staging-green using helm"
    },
    {
      "agents": {
        "stacks": "iflix-elastic-ci"
      },
      "env": {
        "KUBECONTEXT": "k8s-eks-ops",
        "ENV": "admin"
      },
      "command": [
        "addons/kustomize/apply.sh ap-southeast-1-ops kube-system kubernetes-cluster-controller"
      ],
      "name": ":k8s: install kube-system/kubernetes-cluster-controller to ap-southeast-1-ops using kustomize"
    }
  ],
  [
    {
      "agents": {
        "stacks": "iflix-elastic-ci"
      },
      "env": {
        "KUBECONTEXT": "k8s-staging-green",
        "ENV": "staging"
      },
      "command": [
        "addons/helm/apply.sh ap-southeast-1-staging-green kube-system kubernetes-github-authn"
      ],
      "name": ":k8s: install kube-system/kubernetes-github-authn to ap-southeast-1-staging-green using helm"
    },
    {
      "agents": {
        "stacks": "iflix-elastic-ci"
      },
      "env": {
        "KUBECONTEXT": "k8s-eks-ops",
        "ENV": "admin"
      },
      "command": [
        "addons/helm/apply.sh ap-southeast-1-ops kube-system traefik-int"
      ],
      "name": ":k8s: install kube-system/traefik-int to ap-southeast-1-ops using helm"
    },
    {
      "agents": {
        "stacks": "iflix-elastic-ci"
      },
      "env": {
        "KUBECONTEXT": "k8s-staging-green",
        "ENV": "staging"
      },
      "command": [
        "addons/helm/apply.sh ap-southeast-1-staging-green kube-system traefik-int"
      ],
      "name": ":k8s: install kube-system/traefik-int to ap-southeast-1-staging-green using helm"
    },
    {
      "agents": {
        "stacks": "iflix-elastic-ci"
      },
      "env": {
        "KUBECONTEXT": "k8s-eks-ops",
        "ENV": "admin"
      },
      "command": [
        "addons/kustomize/apply.sh ap-southeast-1-ops kube-system aws-secret-operator"
      ],
      "name": ":k8s: install kube-system/aws-secret-operator to ap-southeast-1-ops using kustomize"
    },
    {
      "agents": {
        "stacks": "iflix-elastic-ci"
      },
      "env": {
        "KUBECONTEXT": "k8s-staging-green",
        "ENV": "staging"
      },
      "command": [
        "addons/kustomize/apply.sh ap-southeast-1-staging-green kube-system aws-secret-operator"
      ],
      "name": ":k8s: install kube-system/aws-secret-operator to ap-southeast-1-staging-green using kustomize"
    }
  ]
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment