-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwebpage.operator.yaml
84 lines (84 loc) · 2.25 KB
/
webpage.operator.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
apiVersion: io.javaoperatorsdk.operator.glue/v1beta1
kind: GlueOperator
metadata:
name: webpage-operator
spec:
parent:
apiVersion: glueoperator.sample/v1
kind: WebPage
status:
observedGeneration: "{{parent.metadata.generation}}"
childResources:
- name: htmlconfigmap
resource:
apiVersion: v1
kind: ConfigMap
metadata:
name: "{parent.metadata.name}"
data:
index.html: "{parent.spec.html}"
- name: deployment
resource:
apiVersion: apps/v1
kind: Deployment
metadata:
name: "{parent.metadata.name}"
spec:
selector:
matchLabels:
app: "{parent.metadata.name}"
replicas: 1
template:
metadata:
labels:
app: "{parent.metadata.name}"
spec:
containers:
- name: nginx
image: nginx:1.17.0
ports:
- containerPort: 80
volumeMounts:
- name: html-volume
mountPath: /usr/share/nginx/html
volumes:
- name: html-volume
configMap:
name: "{parent.metadata.name}"
- name: service
resource:
apiVersion: v1
kind: Service
metadata:
name: "{parent.metadata.name}"
spec:
selector:
app: "{parent.metadata.name}"
ports:
- protocol: TCP
port: 80
targetPort: 80
type: NodePort
- name: ingress
condition:
type: JSCondition
script: |
parent.spec.exposed == true;
resource:
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: "{parent.metadata.name}"
annotations:
nginx.ingress.kubernetes.io/rewrite-target: /$1
spec:
rules:
- http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: "{parent.metadata.name}"
port:
number: 80