Last active
March 22, 2018 15:53
-
-
Save schlomo/1ee15695cc04a6324db4f4919c7754ec to your computer and use it in GitHub Desktop.
Files for demo of Kubernetes: Shifting the mindset from servers to containers talk
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: extensions/v1beta1 | |
kind: Deployment | |
metadata: | |
annotations: | |
labels: | |
app: webdav | |
name: webdav | |
spec: | |
replicas: 1 | |
revisionHistoryLimit: 0 | |
selector: | |
matchLabels: | |
app: webdav | |
template: | |
metadata: | |
labels: | |
app: webdav | |
spec: | |
initContainers: | |
- name: init | |
image: schlomo/ssh-url-with-ssh-key | |
volumeMounts: | |
- mountPath: /media | |
name: media | |
command: | |
- /bin/bash | |
- -exc | |
- | | |
test -d /media/.git && exit 0 | |
ssh-keyscan github.com >/etc/ssh/ssh_known_hosts 2>/dev/null | |
git clone --depth 1 git~LS0tLS1CRUdJTiBFQyBQUklWQVRFIEtFWS0tLS0tCk1IY0NBUUVFSUZqWlhTQjBNVDlwNzNoQzJSUXFKU3F6TkZENmkrQ2dabTVvNzE0MGRYZHZvQW9HQ0NxR1NNNDkKQXdFSG9VUURRZ0FFMG93bkY4SDVXRHcrVXJoQVZpSnZucGFvMEpzRzlCZW5QK1lCL0hBSWd4dm5ubFUyRytEawpmcDhoUWZoa2Z2YXowMk9YbU1JWWJYVENCVkhTSmoxbUlnPT0KLS0tLS1FTkQgRUMgUFJJVkFURSBLRVktLS0tLQo=@github.com:schlomo/demo-data.git /media | |
chmod 700 /media/.git | |
chown -R 33:33 /media | |
chown -R 0:0 /media/.git | |
cd /media | |
git config user.email "demo$RANDOM$RANDOM@nowhere$RANDOM$RANDOM.com" | |
git config user.name "Demo $RANDOM" | |
containers: | |
- name: main | |
image: sashgorokhov/webdav | |
ports: | |
- containerPort: 80 | |
protocol: TCP | |
volumeMounts: | |
- mountPath: /media | |
name: media | |
- name: backup | |
image: schlomo/ssh-url-with-ssh-key | |
volumeMounts: | |
- mountPath: /media | |
name: media | |
command: | |
- /bin/bash | |
- -exc | |
- | | |
cd /media | |
ssh-keyscan github.com >/etc/ssh/ssh_known_hosts 2>/dev/null | |
while true ; do | |
sleep 15 | |
git add -A && git commit -a -m "$(date)" && git push | |
done | |
volumes: | |
- name: media | |
emptyDir: {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: v1 | |
kind: Service | |
metadata: | |
labels: | |
app: webdav | |
name: webdav | |
spec: | |
ports: | |
- name: http | |
port: 80 | |
protocol: TCP | |
targetPort: 80 | |
selector: | |
app: webdav | |
type: NodePort |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment