Skip to content

Commit

Permalink
Update wordpress example with formatted resources (#1895)
Browse files Browse the repository at this point in the history
* Update wordpress example with formatted resources

* Remove comment
  • Loading branch information
phanimarupaka committed May 4, 2021
1 parent 285b171 commit 87a96ec
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 40 deletions.
17 changes: 8 additions & 9 deletions package-examples/wordpress/deployment/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

apiVersion: apps/v1 # for versions before 1.9.0 use apps/v1beta2
apiVersion: apps/v1
kind: Deployment
metadata:
name: wordpress
Expand All @@ -23,17 +22,18 @@ spec:
matchLabels:
app: wordpress
tier: frontend
strategy:
type: Recreate
template:
metadata:
labels:
app: wordpress
tier: frontend
spec:
containers:
- image: wordpress:4.8-apache # {"$kpt-set":"image-tag"}
name: wordpress
- name: wordpress
image: wordpress:4.8-apache # kpt-set: ${wp-image}:${wp-tag}
ports:
- name: wordpress
containerPort: 80
env:
- name: WORDPRESS_DB_HOST
value: wordpress-mysql
Expand All @@ -42,13 +42,12 @@ spec:
secretKeyRef:
name: mysql-pass
key: password
ports:
- containerPort: 80
name: wordpress
volumeMounts:
- name: wordpress-persistent-storage
mountPath: /var/www/html
volumes:
- name: wordpress-persistent-storage
persistentVolumeClaim:
claimName: wp-pv-claim
strategy:
type: Recreate
5 changes: 2 additions & 3 deletions package-examples/wordpress/deployment/volume.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,15 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: wp-pv-claim
labels:
app: wordpress
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 20Gi
accessModes:
- ReadWriteOnce
47 changes: 23 additions & 24 deletions package-examples/wordpress/mysql/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,18 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

apiVersion: v1
kind: Service
metadata:
name: wordpress-mysql
labels:
app: wordpress
spec:
ports:
- port: 3306
selector:
app: wordpress
tier: mysql
ports:
- port: 3306
clusterIP: None
---
apiVersion: v1
Expand All @@ -33,11 +32,11 @@ metadata:
labels:
app: wordpress
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 20Gi
accessModes:
- ReadWriteOnce
---
apiVersion: apps/v1 # for versions before 1.9.0 use apps/v1beta2
kind: Deployment
Expand All @@ -50,30 +49,30 @@ spec:
matchLabels:
app: wordpress
tier: mysql
strategy:
type: Recreate
template:
metadata:
labels:
app: wordpress
tier: mysql
spec:
containers:
- image: mysql:5.6 # kpt-set: ${ms-image}:${ms-tag}
name: mysql
env:
- name: MYSQL_ROOT_PASSWORD
valueFrom:
secretKeyRef:
name: mysql-pass
key: password
ports:
- containerPort: 3306
name: mysql
volumeMounts:
- name: mysql-persistent-storage
mountPath: /var/lib/mysql
- name: mysql
image: mysql:5.6 # kpt-set: ${ms-image}:${ms-tag}
ports:
- name: mysql
containerPort: 3306
env:
- name: MYSQL_ROOT_PASSWORD
valueFrom:
secretKeyRef:
name: mysql-pass
key: password
volumeMounts:
- name: mysql-persistent-storage
mountPath: /var/lib/mysql
volumes:
- name: mysql-persistent-storage
persistentVolumeClaim:
claimName: mysql-pv-claim
- name: mysql-persistent-storage
persistentVolumeClaim:
claimName: mysql-pv-claim
strategy:
type: Recreate
7 changes: 3 additions & 4 deletions package-examples/wordpress/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,16 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

apiVersion: v1
kind: Service
metadata:
name: wordpress
labels:
app: wordpress
spec:
ports:
- port: 80
type: LoadBalancer
selector:
app: wordpress
tier: frontend
type: LoadBalancer
ports:
- port: 80

0 comments on commit 87a96ec

Please sign in to comment.