From 453ae8723031caa5224bd20fc818382d7e502642 Mon Sep 17 00:00:00 2001 From: kleph Date: Thu, 20 Feb 2020 12:41:24 +0100 Subject: [PATCH 1/5] Add route for one parameter --- beer.py | 1 + 1 file changed, 1 insertion(+) diff --git a/beer.py b/beer.py index 0bc8970..51911b5 100755 --- a/beer.py +++ b/beer.py @@ -10,6 +10,7 @@ app = Flask(__name__) @app.route('/') +@app.route('/') @app.route('//') def index(hours=None, minutes=None): """ main and only app """ From 03a194ed787ba47604be67da562414eee9b19335 Mon Sep 17 00:00:00 2001 From: kleph Date: Sat, 22 Feb 2020 00:59:39 +0100 Subject: [PATCH 2/5] [RUN] Add namespace 'beer' --- kube/beer-deployment.yaml | 1 + kube/beer-ingress.yaml | 1 + kube/beer-namespace.yaml | 8 ++++++++ kube/beer-service.yaml | 1 + 4 files changed, 11 insertions(+) create mode 100644 kube/beer-namespace.yaml diff --git a/kube/beer-deployment.yaml b/kube/beer-deployment.yaml index bc17b38..bf08ebb 100644 --- a/kube/beer-deployment.yaml +++ b/kube/beer-deployment.yaml @@ -3,6 +3,7 @@ apiVersion: apps/v1 kind: Deployment metadata: name: beer-deployment + namespace: beer spec: selector: matchLabels: diff --git a/kube/beer-ingress.yaml b/kube/beer-ingress.yaml index d003247..54420c9 100644 --- a/kube/beer-ingress.yaml +++ b/kube/beer-ingress.yaml @@ -3,6 +3,7 @@ apiVersion: networking.k8s.io/v1beta1 kind: Ingress metadata: name: beer-ingress + namespace: beer annotations: nginx.ingress.kubernetes.io/rewrite-target: / spec: diff --git a/kube/beer-namespace.yaml b/kube/beer-namespace.yaml new file mode 100644 index 0000000..bfc4951 --- /dev/null +++ b/kube/beer-namespace.yaml @@ -0,0 +1,8 @@ +--- +apiVersion: v1 +kind: Namespace +metadata: + name: beer + labels: + name: beer + diff --git a/kube/beer-service.yaml b/kube/beer-service.yaml index 7e7b673..72c2a18 100644 --- a/kube/beer-service.yaml +++ b/kube/beer-service.yaml @@ -3,6 +3,7 @@ apiVersion: v1 kind: Service metadata: name: beer + namespace: beer spec: selector: app: beer From 3260c6ea1a97ba4d472da8ba2baf7e120d970ce4 Mon Sep 17 00:00:00 2001 From: kleph Date: Sat, 22 Feb 2020 02:50:07 +0100 Subject: [PATCH 3/5] [CI] Add deploy service account and RBAC --- kube/beer-serviceaccount.yaml | 41 +++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 kube/beer-serviceaccount.yaml diff --git a/kube/beer-serviceaccount.yaml b/kube/beer-serviceaccount.yaml new file mode 100644 index 0000000..e028118 --- /dev/null +++ b/kube/beer-serviceaccount.yaml @@ -0,0 +1,41 @@ +--- +apiVersion: v1 +kind: ServiceAccount +metadata: + name: beer-deploy + namespace: beer + +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: Role +metadata: + name: beer-deploy-role + namespace: beer # Should be namespace you are granting access to +rules: +- apiGroups: ["*"] + resources: ["*"] + verbs: ["*"] +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: RoleBinding +metadata: + name: beer-rolebinding + namespace: beer +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: Role + name: beer-deploy-role +subjects: +- namespace: beer + kind: ServiceAccount + name: beer-deploy + +#--- +#ApiVersion: v1 +#Kind: Secret +#Metadata: +# name: beer-deploy-secret +# annotations: +# kubernetes.io/service-account.name: beer-deploy +#Type: kubernetes.io/service-account-token + From 46ccd8827802f7ad50bbb84c97c20897852d0d78 Mon Sep 17 00:00:00 2001 From: kleph Date: Sat, 22 Feb 2020 02:52:32 +0100 Subject: [PATCH 4/5] [CI] Please linter --- .drone.yml | 8 ++++---- kube/beer-namespace.yaml | 1 - kube/beer-serviceaccount.yaml | 12 +----------- 3 files changed, 5 insertions(+), 16 deletions(-) diff --git a/.drone.yml b/.drone.yml index 26a4eaf..858d9e4 100644 --- a/.drone.yml +++ b/.drone.yml @@ -61,10 +61,10 @@ steps: kubernetes_token: from_secret: kubectl_token commands: - - kubectl get pods - - kubectl get deployments - - kubectl get svc - - kubectl apply -f kube/beer-deployment.yaml + - kubectl get pods --namespace=beer + - kubectl get deployments --namespace=beer + - kubectl get svc --namespace=beer + - kubectl apply -f kube/beer-deployment.yaml --namespace=beer depends_on: - build diff --git a/kube/beer-namespace.yaml b/kube/beer-namespace.yaml index bfc4951..119770a 100644 --- a/kube/beer-namespace.yaml +++ b/kube/beer-namespace.yaml @@ -5,4 +5,3 @@ metadata: name: beer labels: name: beer - diff --git a/kube/beer-serviceaccount.yaml b/kube/beer-serviceaccount.yaml index e028118..3b1f745 100644 --- a/kube/beer-serviceaccount.yaml +++ b/kube/beer-serviceaccount.yaml @@ -10,7 +10,7 @@ apiVersion: rbac.authorization.k8s.io/v1 kind: Role metadata: name: beer-deploy-role - namespace: beer # Should be namespace you are granting access to + namespace: beer rules: - apiGroups: ["*"] resources: ["*"] @@ -29,13 +29,3 @@ subjects: - namespace: beer kind: ServiceAccount name: beer-deploy - -#--- -#ApiVersion: v1 -#Kind: Secret -#Metadata: -# name: beer-deploy-secret -# annotations: -# kubernetes.io/service-account.name: beer-deploy -#Type: kubernetes.io/service-account-token - From b9cc6f19378aed25883eaae1c65ae6b69ef28be4 Mon Sep 17 00:00:00 2001 From: kleph Date: Sat, 22 Feb 2020 03:17:33 +0100 Subject: [PATCH 5/5] [CI] tag docker image --- .drone.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.drone.yml b/.drone.yml index 858d9e4..b20fb1c 100644 --- a/.drone.yml +++ b/.drone.yml @@ -38,6 +38,7 @@ steps: image: plugins/docker settings: repo: kleph/beer + tags: latest username: from_secret: dockerhub_username password: