/
todo-list-components.yaml
185 lines (184 loc) · 5.57 KB
/
todo-list-components.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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
# Copyright (c) 2020, 2022, Oracle and/or its affiliates.
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
apiVersion: core.oam.dev/v1alpha2
kind: Component
metadata:
name: todo-domain
spec:
workload:
apiVersion: oam.verrazzano.io/v1alpha1
kind: VerrazzanoWebLogicWorkload
spec:
template:
apiVersion: weblogic.oracle/v9
metadata:
name: todo-domain
spec:
adminServer:
adminChannelPortForwardingEnabled: true
domainUID: tododomain
domainHome: /u01/domains/tododomain
image: container-registry.oracle.com/middleware/weblogic:12.2.1.4
imagePullSecrets:
- name: tododomain-repo-credentials
domainHomeSourceType: "FromModel"
includeServerOutInPodLog: true
replicas: 1
webLogicCredentialsSecret:
name: tododomain-weblogic-credentials
configuration:
introspectorJobActiveDeadlineSeconds: 900
model:
auxiliaryImages:
- image: container-registry.oracle.com/verrazzano/example-todo:20211129200415-ae4e89e
configMap: tododomain-jdbc-config
domainType: WLS
runtimeEncryptionSecret: tododomain-runtime-encrypt-secret
secrets:
- tododomain-jdbc-tododb
serverPod:
labels:
app: todo-domain
version: v1
env:
- name: JAVA_OPTIONS
value: "-Dweblogic.StdoutDebugEnabled=false"
- name: USER_MEM_ARGS
value: "-Djava.security.egd=file:/dev/./urandom -Xms64m -Xmx256m "
- name: WL_HOME
value: /u01/oracle/wlserver
- name: MW_HOME
value: /u01/oracle
---
apiVersion: core.oam.dev/v1alpha2
kind: Component
metadata:
name: todo-jdbc-configmap
spec:
workload:
apiVersion: v1
kind: ConfigMap
metadata:
name: tododomain-jdbc-config
data:
wdt_jdbc.yaml: |
resources:
JDBCSystemResource:
'ToDo-Datasource':
Target: 'AdminServer'
JdbcResource:
DatasourceType: GENERIC
JDBCDataSourceParams:
GlobalTransactionsProtocol: OnePhaseCommit
JNDIName: jdbc/ToDoDB
JDBCConnectionPoolParams:
ConnectionCreationRetryFrequencySeconds: 5
ConnectionReserveTimeoutSeconds: 10
InitialCapacity: 0
InactiveConnectionTimeoutSeconds: 60
MaxCapacity: 5
MinCapacity: 0
TestConnectionsOnReserve: true
TestFrequencySeconds: 10
JDBCDriverParams:
# for MySQL, the last element in the URL is the database name, and must match the name inside the DB server
URL: "jdbc:mysql://mysql:3306/tododb"
PasswordEncrypted: '@@SECRET:tododomain-jdbc-tododb:password@@'
DriverName: com.mysql.cj.jdbc.Driver
Properties:
user:
Value: '@@SECRET:tododomain-jdbc-tododb:username@@'
---
apiVersion: core.oam.dev/v1alpha2
kind: Component
metadata:
name: todo-mysql-configmap
spec:
workload:
apiVersion: v1
kind: ConfigMap
metadata:
name: mysql-initdb-config
data:
initdb.sql: |
create table `ToDos` (
`taskId` int not null auto_increment,
`task` varchar(200) not null,
`completed` boolean,
constraint todo_pk primary key (`taskId`)
);
---
apiVersion: core.oam.dev/v1alpha2
kind: Component
metadata:
name: todo-mysql-service
spec:
workload:
apiVersion: v1
kind: Service
metadata:
name: mysql
spec:
ports:
- port: 3306
selector:
app: todo-mysql
clusterIP: None
---
apiVersion: core.oam.dev/v1alpha2
kind: Component
metadata:
name: todo-mysql-deployment
spec:
workload:
apiVersion: apps/v1
kind: Deployment
metadata:
name: mysql
spec:
replicas: 1
selector:
matchLabels:
app: todo-mysql
template:
metadata:
labels:
app: todo-mysql
version: v1
spec:
containers:
- env:
- name: MYSQL_ROOT_PASSWORD
valueFrom:
secretKeyRef:
name: tododomain-jdbc-tododb
key: password
- name: MYSQL_USER
valueFrom:
secretKeyRef:
name: tododomain-jdbc-tododb
key: username
- name: MYSQL_PASSWORD
valueFrom:
secretKeyRef:
name: tododomain-jdbc-tododb
key: password
- name: MYSQL_DATABASE
value: tododb
image: ghcr.io/verrazzano/mysql:8.0.28
imagePullPolicy: IfNotPresent
name: mysql
ports:
- containerPort: 3306
name: mysql
protocol: TCP
volumeMounts:
- mountPath: /docker-entrypoint-initdb.d
name: mysql-initdb
imagePullSecrets:
- name: ocr
volumes:
- configMap:
defaultMode: 420
name: mysql-initdb-config
name: mysql-initdb