namespaces #3
7 changed files with 47 additions and 4 deletions
|
@ -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
|
||||
|
|
1
beer.py
1
beer.py
|
@ -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 """
|
||||
|
|
|
@ -3,6 +3,7 @@ apiVersion: apps/v1
|
|||
kind: Deployment
|
||||
metadata:
|
||||
name: beer-deployment
|
||||
namespace: beer
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
|
|
|
@ -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
7
kube/beer-namespace.yaml
Normal file
|
@ -0,0 +1,7 @@
|
|||
---
|
||||
apiVersion: v1
|
||||
kind: Namespace
|
||||
metadata:
|
||||
name: beer
|
||||
labels:
|
||||
name: beer
|
|
@ -3,6 +3,7 @@ apiVersion: v1
|
|||
kind: Service
|
||||
metadata:
|
||||
name: beer
|
||||
namespace: beer
|
||||
spec:
|
||||
selector:
|
||||
app: beer
|
||||
|
|
31
kube/beer-serviceaccount.yaml
Normal file
31
kube/beer-serviceaccount.yaml
Normal 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
|
Loading…
Reference in a new issue