Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WordPress example major update. #22195

Merged
merged 1 commit into from
Mar 25, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 9 additions & 0 deletions cmd/mungedocs/kubectl_dash_f.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,15 @@ func gotDashF(lineNum int, fields []string, fieldNum int) error {
// Absolute paths tend to be /tmp/* and created in the same example.
return nil
}
if strings.HasPrefix(target, "$") {
// Allow the start of the target to be an environment
// variable that points to the root of the kubernetes
// repo.
split := strings.SplitN(target, "/", 2)
if len(split) == 2 {
target = split[1]
}
}

// If we got here we expect the file to exist.
_, err := os.Stat(path.Join(repoRoot, target))
Expand Down
8 changes: 4 additions & 4 deletions examples/examples_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -311,10 +311,10 @@ func TestExampleObjectSchemas(t *testing.T) {
"mongo-service": &api.Service{},
},
"../examples/mysql-wordpress-pd": {
"mysql-service": &api.Service{},
"mysql": &api.Pod{},
"wordpress-service": &api.Service{},
"wordpress": &api.Pod{},
"gce-volumes": &api.PersistentVolume{},
"local-volumes": &api.PersistentVolume{},
"mysql-deployment": &api.Service{},
"wordpress-deployment": &api.Service{},
},
"../examples/nfs": {
"nfs-busybox-rc": &api.ReplicationController{},
Expand Down
2 changes: 2 additions & 0 deletions examples/mysql-wordpress-pd/OWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
assignees:
- jeffmendoza
499 changes: 242 additions & 257 deletions examples/mysql-wordpress-pd/README.md

Large diffs are not rendered by default.

Binary file added examples/mysql-wordpress-pd/WordPress.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 25 additions & 0 deletions examples/mysql-wordpress-pd/gce-volumes.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
apiVersion: v1
kind: PersistentVolume
metadata:
name: wordpress-pv-1
spec:
capacity:
storage: 20Gi
accessModes:
- ReadWriteOnce
gcePersistentDisk:
pdName: wordpress-1
fsType: ext4
---
apiVersion: v1
kind: PersistentVolume
metadata:
name: wordpress-pv-2
spec:
capacity:
storage: 20Gi
accessModes:
- ReadWriteOnce
gcePersistentDisk:
pdName: wordpress-2
fsType: ext4
27 changes: 27 additions & 0 deletions examples/mysql-wordpress-pd/local-volumes.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
apiVersion: v1
kind: PersistentVolume
metadata:
name: local-pv-1
labels:
type: local
spec:
capacity:
storage: 20Gi
accessModes:
- ReadWriteOnce
hostPath:
path: /tmp/pv-1
---
apiVersion: v1
kind: PersistentVolume
metadata:
name: local-pv-2
labels:
type: local
spec:
capacity:
storage: 20Gi
accessModes:
- ReadWriteOnce
hostPath:
path: /tmp/pv-2
63 changes: 63 additions & 0 deletions examples/mysql-wordpress-pd/mysql-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
apiVersion: v1
kind: Service
metadata:
name: wordpress-mysql
labels:
app: wordpress
spec:
ports:
- port: 3306
selector:
app: wordpress
tier: mysql
clusterIP: None
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: mysql-pv-claim
labels:
app: wordpress
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 20Gi
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: wordpress-mysql
labels:
app: wordpress
spec:
strategy:
type: Recreate
template:
metadata:
labels:
app: wordpress
tier: mysql
spec:
containers:
- image: mysql:5.6
name: mysql
env:
# $ kubectl create secret generic mysql-pass --from-file=password.txt
# make sure password.txt does not have a trailing newline
- name: MYSQL_ROOT_PASSWORD
valueFrom:
secretKeyRef:
name: mysql-pass
key: password.txt
ports:
- containerPort: 3306
name: mysql
volumeMounts:
- name: mysql-persistent-storage
mountPath: /var/lib/mysql
volumes:
- name: mysql-persistent-storage
persistentVolumeClaim:
claimName: mysql-pv-claim
13 changes: 0 additions & 13 deletions examples/mysql-wordpress-pd/mysql-service.yaml

This file was deleted.

31 changes: 0 additions & 31 deletions examples/mysql-wordpress-pd/mysql.yaml

This file was deleted.

63 changes: 63 additions & 0 deletions examples/mysql-wordpress-pd/wordpress-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
apiVersion: v1
kind: Service
metadata:
name: wordpress
labels:
app: wordpress
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general, I'd put the same labels on the Service and PVC as on the corresponding Deployment.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have app: wordpress on all the items. On the pods I have tier: frontend, but not the deployment, claim, and service. Should I have tier: frontend on all those?

spec:
ports:
- port: 80
selector:
app: wordpress
tier: frontend
type: LoadBalancer
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: wp-pv-claim
labels:
app: wordpress
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 20Gi
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: wordpress
labels:
app: wordpress
spec:
strategy:
type: Recreate
template:
metadata:
labels:
app: wordpress
tier: frontend
spec:
containers:
- image: wordpress:4.4-apache
name: wordpress
env:
- name: WORDPRESS_DB_HOST
value: wordpress-mysql
- name: WORDPRESS_DB_PASSWORD
valueFrom:
secretKeyRef:
name: mysql-pass
key: password.txt
ports:
- containerPort: 80
name: wordpress
volumeMounts:
- name: wordpress-persistent-storage
mountPath: /var/www/html
volumes:
- name: wordpress-persistent-storage
persistentVolumeClaim:
claimName: wp-pv-claim
14 changes: 0 additions & 14 deletions examples/mysql-wordpress-pd/wordpress-service.yaml

This file was deleted.

28 changes: 0 additions & 28 deletions examples/mysql-wordpress-pd/wordpress.yaml

This file was deleted.