mirror of
https://github.com/bvanroll/cicdTest.git
synced 2025-08-29 20:12:43 +00:00
tis af fam, dees was wel de minst plezante om te doen
This commit is contained in:
13
check-dns.yaml
Normal file
13
check-dns.yaml
Normal file
@@ -0,0 +1,13 @@
|
||||
apiVersion: batch/v1
|
||||
kind: Job
|
||||
metadata:
|
||||
name: dns
|
||||
spec:
|
||||
template:
|
||||
spec:
|
||||
containers:
|
||||
- name: dns
|
||||
image: anubhavmishra/tiny-tools
|
||||
command: ["dig", "consul.service.consul"]
|
||||
restartPolicy: Never
|
||||
backoffLimit: 4
|
10
consul-dns-fix.yaml
Normal file
10
consul-dns-fix.yaml
Normal file
@@ -0,0 +1,10 @@
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
labels:
|
||||
addonmanager.kubernetes.io/mode: EnsureExists
|
||||
name: kube-dns
|
||||
namespace: kube-system
|
||||
data:
|
||||
stubDomains: |
|
||||
{"consul": ["10.103.17.72"]}
|
3
consul/server-b-default
Normal file
3
consul/server-b-default
Normal file
@@ -0,0 +1,3 @@
|
||||
Kind = "service-defaults"
|
||||
Name = "server-b"
|
||||
Protocol = "http"
|
3
consul/server-b-test-deault
Normal file
3
consul/server-b-test-deault
Normal file
@@ -0,0 +1,3 @@
|
||||
Kind = "service-defaults"
|
||||
Name = "server-b-test"
|
||||
Protocol = "http"
|
3
consul/server-check-default.hcl
Normal file
3
consul/server-check-default.hcl
Normal file
@@ -0,0 +1,3 @@
|
||||
Kind = "service-defaults"
|
||||
Name = "server-check"
|
||||
Protocol = "http"
|
@@ -2,5 +2,6 @@
|
||||
{
|
||||
"service": {
|
||||
"name": "server-check"
|
||||
"protocol": "http"
|
||||
}
|
||||
}
|
75
deploy.yaml
75
deploy.yaml
@@ -6,6 +6,21 @@
|
||||
# annotations:
|
||||
# "consul.hashicorp.com/connect-inject": "true" #dit is hoe consul injection handled
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
name: account-a
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
name: account-b
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
name: account-b-test
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
@@ -30,11 +45,11 @@ spec:
|
||||
"consul.hashicorp.com/connect-inject": "true"
|
||||
spec:
|
||||
containers:
|
||||
- name: front-end
|
||||
image: beppev/server-a-consul:master
|
||||
- name: server-a
|
||||
image: beppev/server-a:master-consul
|
||||
imagePullPolicy: "Always"
|
||||
ports:
|
||||
- containerPort: 5000
|
||||
- containerPort: 80
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
@@ -62,11 +77,11 @@ spec:
|
||||
"consul.hashicorp.com/connect-inject": "true"
|
||||
spec:
|
||||
containers:
|
||||
- name: front-end
|
||||
image: beppev/server-b-consul:master
|
||||
- name: server-b
|
||||
image: beppev/server-b:master-consul
|
||||
imagePullPolicy: "Always"
|
||||
ports:
|
||||
- containerPort: 6000
|
||||
- containerPort: 80
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
@@ -94,11 +109,11 @@ spec:
|
||||
"consul.hashicorp.com/connect-inject": "true" #dit is hoe consul injection handled
|
||||
spec:
|
||||
containers:
|
||||
- name: front-end
|
||||
image: beppev/server-b-consul:experimental
|
||||
- name: server-b-test
|
||||
image: beppev/server-b:experimental-consul
|
||||
imagePullPolicy: "Always"
|
||||
ports:
|
||||
- containerPort: 6000
|
||||
- containerPort: 80
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
@@ -124,30 +139,30 @@ spec:
|
||||
"consul.hashicorp.com/connect-inject": "true" #dit is hoe consul injection handled
|
||||
spec:
|
||||
containers:
|
||||
- name: front-end
|
||||
- name: server-d
|
||||
image: beppev/server-d-consul:master
|
||||
ports:
|
||||
- containerPort: 6000
|
||||
- containerPort: 80
|
||||
# ---
|
||||
# apiVersion: v1
|
||||
# kind: Service
|
||||
# metadata:
|
||||
# name: expose-service
|
||||
# # namespace: consul-project-1
|
||||
# annotations:
|
||||
# "consul.hashicorp.com/connect-inject": "true" #dit is hoe consul injection handled
|
||||
# labels:
|
||||
# app: "project-1"
|
||||
# spec:
|
||||
# selector:
|
||||
# expose: "true"
|
||||
# ports:
|
||||
# - name: http
|
||||
# protocol: TCP
|
||||
# port: 5000
|
||||
# targetPort: 5000
|
||||
# nodePort: 30036
|
||||
# type: NodePort
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: expose-service
|
||||
# namespace: consul-project-1
|
||||
annotations:
|
||||
"consul.hashicorp.com/connect-inject": "true" #dit is hoe consul injection handled
|
||||
labels:
|
||||
app: "project-1"
|
||||
spec:
|
||||
selector:
|
||||
expose: "true"
|
||||
ports:
|
||||
- name: http
|
||||
protocol: TCP
|
||||
port: 80
|
||||
targetPort: 80
|
||||
nodePort: 30036
|
||||
type: NodePort
|
||||
# ---
|
||||
# apiVersion: v1
|
||||
# kind: Service
|
||||
|
@@ -18,8 +18,6 @@ client:
|
||||
|
||||
# Use only one Consul server for local development
|
||||
server:
|
||||
service:
|
||||
type: 'NodePort'
|
||||
replicas: 1
|
||||
bootstrapExpect: 1
|
||||
disruptionBudget:
|
||||
|
@@ -3,7 +3,7 @@ import requests
|
||||
|
||||
app = Flask(__name__)
|
||||
|
||||
URL = "http://server-check:6000"
|
||||
URL = "http://server-check.service.consul"
|
||||
|
||||
@app.errorhandler(404)
|
||||
def page_not_found(error):
|
||||
@@ -35,4 +35,4 @@ def findServer(name, port):
|
||||
return requests.get("http://"+name+":"+port)
|
||||
|
||||
if __name__ == '__main__':
|
||||
app.run(debug=True, host="0.0.0.0", port=5000)
|
||||
app.run(debug=True, host="0.0.0.0", port=80)
|
||||
|
@@ -4,7 +4,7 @@ copy . /app
|
||||
workdir /app
|
||||
|
||||
run pip install -r requirements.txt
|
||||
expose 5000
|
||||
expose 80
|
||||
entrypoint [ "python" ]
|
||||
|
||||
cmd [ "app.py" ]
|
@@ -6,12 +6,19 @@ app = Flask(__name__)
|
||||
@app.route('/')
|
||||
def doRequest():
|
||||
data = {
|
||||
"serverName": "serverB",
|
||||
"serverName": "server-b",
|
||||
"version": "master",
|
||||
"success": "true"
|
||||
}
|
||||
return jsonify(data)
|
||||
|
||||
|
||||
|
||||
@app.route('/', defaults={'path': ''})
|
||||
@app.route('/<path:path>')
|
||||
def doRequest(path):
|
||||
return path + "\nserver-b"
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
app.run(debug=True, host="0.0.0.0", port=6000)
|
||||
app.run(debug=True, host="0.0.0.0", port=80)
|
||||
|
@@ -4,7 +4,7 @@ copy . /app
|
||||
workdir /app
|
||||
|
||||
run pip install -r requirements.txt
|
||||
expose 6000
|
||||
expose 80
|
||||
entrypoint [ "python" ]
|
||||
|
||||
cmd [ "app.py" ]
|
@@ -6,11 +6,19 @@ app = Flask(__name__)
|
||||
@app.route('/')
|
||||
def doRequest():
|
||||
data = {
|
||||
"serverName": "serverC",
|
||||
"serverName": "server-c",
|
||||
"version": "master",
|
||||
"success": "true"
|
||||
}
|
||||
return jsonify(data)
|
||||
|
||||
|
||||
|
||||
@app.route('/', defaults={'path': ''})
|
||||
@app.route('/<path:path>')
|
||||
def doRequest(path):
|
||||
return path + "\nserver-c"
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
app.run(debug=True, host="0.0.0.0", port=6000)
|
||||
app.run(debug=True, host="0.0.0.0", port=80)
|
||||
|
@@ -4,7 +4,7 @@ copy . /app
|
||||
workdir /app
|
||||
|
||||
run pip install -r requirements.txt
|
||||
expose 6000
|
||||
expose 80
|
||||
entrypoint [ "python" ]
|
||||
|
||||
cmd [ "app.py" ]
|
@@ -21,4 +21,4 @@ def get():
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
app.run(debug=True, host="0.0.0.0", port=6000)
|
||||
app.run(debug=True, host="0.0.0.0", port=80)
|
||||
|
@@ -4,7 +4,7 @@ copy . /app
|
||||
workdir /app
|
||||
|
||||
run pip install -r requirements.txt
|
||||
expose 7000
|
||||
expose 80
|
||||
entrypoint [ "python" ]
|
||||
|
||||
cmd [ "app.py" ]
|
Reference in New Issue
Block a user