Skip to content

Commit 87a96ec

Browse files
Update wordpress example with formatted resources (#1895)
* Update wordpress example with formatted resources * Remove comment
1 parent 285b171 commit 87a96ec

File tree

4 files changed

+36
-40
lines changed

4 files changed

+36
-40
lines changed

package-examples/wordpress/deployment/deployment.yaml

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@
1111
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
14-
15-
apiVersion: apps/v1 # for versions before 1.9.0 use apps/v1beta2
14+
apiVersion: apps/v1
1615
kind: Deployment
1716
metadata:
1817
name: wordpress
@@ -23,17 +22,18 @@ spec:
2322
matchLabels:
2423
app: wordpress
2524
tier: frontend
26-
strategy:
27-
type: Recreate
2825
template:
2926
metadata:
3027
labels:
3128
app: wordpress
3229
tier: frontend
3330
spec:
3431
containers:
35-
- image: wordpress:4.8-apache # {"$kpt-set":"image-tag"}
36-
name: wordpress
32+
- name: wordpress
33+
image: wordpress:4.8-apache # kpt-set: ${wp-image}:${wp-tag}
34+
ports:
35+
- name: wordpress
36+
containerPort: 80
3737
env:
3838
- name: WORDPRESS_DB_HOST
3939
value: wordpress-mysql
@@ -42,13 +42,12 @@ spec:
4242
secretKeyRef:
4343
name: mysql-pass
4444
key: password
45-
ports:
46-
- containerPort: 80
47-
name: wordpress
4845
volumeMounts:
4946
- name: wordpress-persistent-storage
5047
mountPath: /var/www/html
5148
volumes:
5249
- name: wordpress-persistent-storage
5350
persistentVolumeClaim:
5451
claimName: wp-pv-claim
52+
strategy:
53+
type: Recreate

package-examples/wordpress/deployment/volume.yaml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,15 @@
1111
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
14-
1514
apiVersion: v1
1615
kind: PersistentVolumeClaim
1716
metadata:
1817
name: wp-pv-claim
1918
labels:
2019
app: wordpress
2120
spec:
22-
accessModes:
23-
- ReadWriteOnce
2421
resources:
2522
requests:
2623
storage: 20Gi
24+
accessModes:
25+
- ReadWriteOnce

package-examples/wordpress/mysql/deployment.yaml

Lines changed: 23 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,18 @@
1111
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
14-
1514
apiVersion: v1
1615
kind: Service
1716
metadata:
1817
name: wordpress-mysql
1918
labels:
2019
app: wordpress
2120
spec:
22-
ports:
23-
- port: 3306
2421
selector:
2522
app: wordpress
2623
tier: mysql
24+
ports:
25+
- port: 3306
2726
clusterIP: None
2827
---
2928
apiVersion: v1
@@ -33,11 +32,11 @@ metadata:
3332
labels:
3433
app: wordpress
3534
spec:
36-
accessModes:
37-
- ReadWriteOnce
3835
resources:
3936
requests:
4037
storage: 20Gi
38+
accessModes:
39+
- ReadWriteOnce
4140
---
4241
apiVersion: apps/v1 # for versions before 1.9.0 use apps/v1beta2
4342
kind: Deployment
@@ -50,30 +49,30 @@ spec:
5049
matchLabels:
5150
app: wordpress
5251
tier: mysql
53-
strategy:
54-
type: Recreate
5552
template:
5653
metadata:
5754
labels:
5855
app: wordpress
5956
tier: mysql
6057
spec:
6158
containers:
62-
- image: mysql:5.6 # kpt-set: ${ms-image}:${ms-tag}
63-
name: mysql
64-
env:
65-
- name: MYSQL_ROOT_PASSWORD
66-
valueFrom:
67-
secretKeyRef:
68-
name: mysql-pass
69-
key: password
70-
ports:
71-
- containerPort: 3306
72-
name: mysql
73-
volumeMounts:
74-
- name: mysql-persistent-storage
75-
mountPath: /var/lib/mysql
59+
- name: mysql
60+
image: mysql:5.6 # kpt-set: ${ms-image}:${ms-tag}
61+
ports:
62+
- name: mysql
63+
containerPort: 3306
64+
env:
65+
- name: MYSQL_ROOT_PASSWORD
66+
valueFrom:
67+
secretKeyRef:
68+
name: mysql-pass
69+
key: password
70+
volumeMounts:
71+
- name: mysql-persistent-storage
72+
mountPath: /var/lib/mysql
7673
volumes:
77-
- name: mysql-persistent-storage
78-
persistentVolumeClaim:
79-
claimName: mysql-pv-claim
74+
- name: mysql-persistent-storage
75+
persistentVolumeClaim:
76+
claimName: mysql-pv-claim
77+
strategy:
78+
type: Recreate

package-examples/wordpress/service.yaml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,16 @@
1111
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
14-
1514
apiVersion: v1
1615
kind: Service
1716
metadata:
1817
name: wordpress
1918
labels:
2019
app: wordpress
2120
spec:
22-
ports:
23-
- port: 80
21+
type: LoadBalancer
2422
selector:
2523
app: wordpress
2624
tier: frontend
27-
type: LoadBalancer
25+
ports:
26+
- port: 80

0 commit comments

Comments
 (0)