namespaces #3

Merged
kleph merged 5 commits from namespaces into master 2020-02-22 03:20:52 +01:00
7 changed files with 47 additions and 4 deletions

View file

@ -38,6 +38,7 @@ steps:
image: plugins/docker image: plugins/docker
settings: settings:
repo: kleph/beer repo: kleph/beer
tags: latest
username: username:
from_secret: dockerhub_username from_secret: dockerhub_username
password: password:
@ -61,10 +62,10 @@ steps:
kubernetes_token: kubernetes_token:
from_secret: kubectl_token from_secret: kubectl_token
commands: commands:
- kubectl get pods - kubectl get pods --namespace=beer
- kubectl get deployments - kubectl get deployments --namespace=beer
- kubectl get svc - kubectl get svc --namespace=beer
- kubectl apply -f kube/beer-deployment.yaml - kubectl apply -f kube/beer-deployment.yaml --namespace=beer
depends_on: depends_on:
- build - build

View file

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

View file

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

View file

@ -3,6 +3,7 @@ apiVersion: networking.k8s.io/v1beta1
kind: Ingress kind: Ingress
metadata: metadata:
name: beer-ingress name: beer-ingress
namespace: beer
annotations: annotations:
nginx.ingress.kubernetes.io/rewrite-target: / nginx.ingress.kubernetes.io/rewrite-target: /
spec: 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 kind: Service
metadata: metadata:
name: beer name: beer
namespace: beer
spec: spec:
selector: selector:
app: beer 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