From 76faab4bfa9e726fa17c01aa9fcbe6351c808b39 Mon Sep 17 00:00:00 2001
From: Alberto Colla <alberto.colla@garr.it>
Date: Fri, 2 Aug 2019 15:01:24 +0000
Subject: [PATCH] 2019-08-02 AC: Bundle kubernetes-staging

---
 bundle_staging.yaml | 212 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 212 insertions(+)
 create mode 100644 bundle_staging.yaml

diff --git a/bundle_staging.yaml b/bundle_staging.yaml
new file mode 100644
index 0000000..6d33d12
--- /dev/null
+++ b/bundle_staging.yaml
@@ -0,0 +1,212 @@
+##
+# The master nodes should be tagged as "kubernetes-master", they should have a public IP.
+# The worker nodes to be used should be tagged as 'kubernetes-worker'.
+# The worker nodes with GPUs should be tagged as 'gpu'.
+##
+
+series: bionic
+description: A 6-machine Kubernetes cluster, appropriate for production. Includes a three-machine etcd  cluster, two Kubernetes masters, three Kubernetes worker nodes and a Kubernetes worker with GPUs.
+
+# --------------------------------------------------------------------------------
+parameters:
+
+  # Network
+  default-net: &default_net     space-os-mgmt
+  data-net: &data_net           space-os-data
+  default-gw-ip: &default_gw_ip 90.147.154.1
+
+# --------------------------------------------------------------------------------
+
+
+# ----------------------------------------------------------------------
+machines:
+  "0":
+    series: bionic
+    constraints: tags=k8s-master-staging #root-disk=8G
+  "1":
+    series: bionic
+    constraints: tags=k8s-worker-staging #root-disk=8G
+  "2":
+    series: bionic
+    constraints: tags=k8s-worker-staging #root-disk=8G
+  "3":
+    series: bionic
+    constraints: tags=k8s-worker-staging #root-disk=8G
+
+# ----------------------------------------------------------------------
+services:
+
+
+  defaultgw:
+    charm:  cs:~csd-garr/defaultgw
+    options:
+       gateway: *default_gw_ip
+
+  easyrsa:
+    charm: cs:~containers/easyrsa
+    constraints: root-disk=8G
+    bindings:
+      "": space-os-mgmt
+    num_units: 1
+    resources:
+      easyrsa: 5
+    to:
+      # an lxd on one of the kubernetes-master units
+      - "lxd:kubernetes-master"
+    annotations:
+      gui-x: '450'
+      gui-y: '550'
+
+  etcd:
+    charm: cs:~containers/etcd
+    bindings:
+      "": *default_net
+    num_units: 3
+    options:
+      channel: 3.2/stable
+    resources:
+      core: 0
+      etcd: 3
+      snapshot: 0
+    to:
+      - "lxd:1"
+      - "lxd:2"
+      - "lxd:3"
+    annotations:
+      gui-x: '800'
+      gui-y: '550'
+
+  flannel:
+    charm: cs:~containers/flannel
+    resources:
+      flannel-amd64: 302
+      flannel-arm64: 298
+      flannel-s390x: 285
+    # no bindings
+    options:
+      cidr: 10.111.0.0/16
+      iface: bond0.1202
+    annotations:
+      gui-x: '450'
+      gui-y: '750'
+
+      #  flannel-gpu:
+      #    charm: cs:~containers/flannel
+      #    # no bindings
+      #    options:
+      #      cidr: 10.111.0.0/16
+      #      iface: eno1.1202
+      #    annotations:
+      #      gui-x: '450'
+      #      gui-y: '750'
+
+  kubeapi-load-balancer:
+    charm: cs:~containers/kubeapi-load-balancer
+    bindings:
+      "": space-os-mgmt
+      # necessary for getting a floating IP
+      apiserver: space-pub
+    expose: true
+    num_units: 1
+    resources: {}
+    to:
+      - "lxd:kubernetes-master"
+    annotations:
+      gui-x: '450'
+      gui-y: '250'
+
+  kubernetes-keystone:
+    charm: cs:~csd-garr/kubernetes-keystone
+    options:
+      keystone-url: https://keystone.cloud.garr.it:5000/v3
+      k8s-keystone-auth-url: https://git.garr.it/cloud/charms/kubernetes-keystone/raw/master/bin/linux-amd64/k8s-keystone-auth
+
+  kubernetes-master:
+    charm: cs:~containers/kubernetes-master
+    constraints: tags=kubernetes-master
+    bindings:
+      "": space-os-mgmt
+      #kube-api-endpoint: space-pub
+    num_units: 1
+    options:
+      channel: 1.15/stable
+      authorization-mode: "Node,RBAC,Webhook"
+      # RBAC to allow access to dashboard to User "system:anonymous"
+      # Because of this bug https://github.com/kubernetes/kubernetes/issues/39722
+      # the value must be false, rather than what the documentation says.
+      api-extra-args: "anonymous-auth=false"
+      enable-dashboard-addons: True
+    resources:
+      cdk-addons: 0
+      core: 0
+      kube-apiserver: 0
+      kube-controller-manager: 0
+      kube-proxy: 0
+      kube-scheduler: 0
+      kubectl: 0
+    annotations:
+      gui-x: '800'
+      gui-y: '850'
+    to:
+      - "0"
+
+  kubernetes-worker:
+    charm: cs:~containers/kubernetes-worker
+    constraints: tags=kubernetes-worker cores=4 mem=4G root-disk=16G
+    bindings:
+      "": space-os-mgmt
+    expose: true
+    num_units: 3
+    options:
+      channel: 1.14/stable
+      # Enable Cloud Controller Manager
+      # https://kubernetes.io/docs/tasks/administer-cluster/running-cloud-controller/
+      # kubelet-extra-args: --cloud-provider=external
+    annotations:
+      gui-x: '100'
+      gui-y: '850'
+    to:
+      - "1"
+      - "2"
+      - "3"
+
+      #  kubernetes-worker-gpu: 
+      #    charm: cs:~containers/kubernetes-worker
+      #    bindings:
+      #      "": space-os-mgmt
+      #    num_units: 1
+      #    constraints: tags=gpu
+      #    expose: true
+      #    options:
+      #      channel: 1.13/stable
+      #      # cuda_repo: 10.0.130-1
+      #      # kubelet-extra-args: --cloud-provider=external
+      #    annotations: 
+      #      gui-x: "520"
+      #      gui-y: "226"
+      
+# ----------------------------------------------------------------------
+relations:
+  - ["kubernetes-master:kube-api-endpoint", "kubeapi-load-balancer:apiserver"]
+  - ["kubernetes-master:loadbalancer", "kubeapi-load-balancer:loadbalancer"]
+  - ["kubernetes-master:certificates", "easyrsa:client"]
+  - ["kubernetes-master:juju-info", "kubernetes-keystone:juju-info"]
+  - ["kubernetes-master:etcd", "etcd:db"]
+  # K8s load balancer
+  - ["kubeapi-load-balancer:certificates", "easyrsa:client"]
+  - ["etcd:certificates", "easyrsa:client"]
+  - ["kubeapi-load-balancer", "defaultgw"]
+  # K8s worker
+  - ["kubernetes-master:kube-control", "kubernetes-worker:kube-control"]
+  - ["kubernetes-worker:certificates", "easyrsa:client"]
+  - ["kubernetes-worker:kube-api-endpoint", "kubeapi-load-balancer:website"]
+  # K8s worker GPU
+  #  - ["kubernetes-master:kube-control", "kubernetes-worker-gpu:kube-control"]
+  #  - ["kubernetes-worker-gpu:certificates", "easyrsa:client"]
+  #  - ["kubernetes-worker-gpu:kube-api-endpoint", "kubeapi-load-balancer:website"]
+  # Flannel
+  - ["flannel:etcd", "etcd:db"]
+  - ["flannel:cni", "kubernetes-master:cni"]
+  - ["flannel:cni", "kubernetes-worker:cni"]
+    #  - ["flannel-gpu:etcd", "etcd:db"]
+    #  - ["flannel-gpu:cni", "kubernetes-worker-gpu:cni"]
-- 
GitLab