Merge pull request 'namespaces' (#3) from namespaces into master
All checks were successful
continuous-integration/drone/push Build is passing

Reviewed-on: #3
This commit is contained in:
kleph 2020-02-22 03:20:50 +01:00
commit 2ba3a12b92
7 changed files with 47 additions and 4 deletions

View file

@ -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

View file

@ -10,6 +10,7 @@ app = Flask(__name__)
@app.route('/')
@app.route('/<int(min=0, max=23):hours>')
@app.route('/<int(min=0, max=23):hours>/<int(min=0, max=59):minutes>')
def index(hours=None, minutes=None):
""" main and only app """

View file

@ -3,6 +3,7 @@ apiVersion: apps/v1
kind: Deployment
metadata:
name: beer-deployment
namespace: beer
spec:
selector:
matchLabels:

View file

@ -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:

7
kube/beer-namespace.yaml Normal file
View file

@ -0,0 +1,7 @@
---
apiVersion: v1
kind: Namespace
metadata:
name: beer
labels:
name: beer

View file

@ -3,6 +3,7 @@ apiVersion: v1
kind: Service
metadata:
name: beer
namespace: beer
spec:
selector:
app: beer

View file

@ -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