diff --git a/.drone.yml b/.drone.yml index 26a4eaf..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: @@ -61,10 +62,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/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 """ 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..119770a --- /dev/null +++ b/kube/beer-namespace.yaml @@ -0,0 +1,7 @@ +--- +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 diff --git a/kube/beer-serviceaccount.yaml b/kube/beer-serviceaccount.yaml new file mode 100644 index 0000000..3b1f745 --- /dev/null +++ b/kube/beer-serviceaccount.yaml @@ -0,0 +1,31 @@ +--- +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 +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