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

Create kubernetes.yml.template #13

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions kubernetes.yml.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: twitter-feed-v1
labels:
commit: ${WERCKER_GIT_COMMIT}
spec:
replicas: 2
selector:
matchLabels:
app: twitter-feed
template:
metadata:
labels:
app: twitter-feed
commit: ${WERCKER_GIT_COMMIT}
spec:
containers:
- name: twitter-feed
image: ${DOCKER_REGISTRY}/${DOCKER_REPO}:${WERCKER_GIT_BRANCH}-${WERCKER_GIT_COMMIT}
imagePullPolicy: Always
ports:
- name: twitter-feed
containerPort: 8080
protocol: TCP
imagePullSecrets:
- name: wercker
---
apiVersion: v1
kind: Service
metadata:
name: twitter-feed
labels:
app: twitter-feed
commit: ${WERCKER_GIT_COMMIT}
spec:
ports:
- port: 30000
targetPort: 8080
selector:
app: twitter-feed
type: ClusterIP
---
35 changes: 35 additions & 0 deletions wercker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@

#Deploy our container from the Oracle Container Registry to the Oracle Container Engine (Kubernetes)
deploy-to-cluster:
box:
id: alpine
cmd: /bin/sh

steps:

- bash-template

- kubectl:
name: delete secret
server: $KUBERNETES_MASTER
token: $KUBERNETES_AUTH_TOKEN
insecure-skip-tls-verify: true
command: delete secret wercker; echo delete registry secret

- kubectl:
name: create secret
server: $KUBERNETES_MASTER
token: $KUBERNETES_AUTH_TOKEN
insecure-skip-tls-verify: true
command: create secret docker-registry wercker --docker-server=$DOCKER_REGISTRY [email protected] --docker-username=$DOCKER_USERNAME --docker-password='$OCI_AUTH_TOKEN'; echo create registry secret

- script:
name: "Visualise Kubernetes config"
code: cat kubernetes.yml

- kubectl:
name: deploy to kubernetes
server: $KUBERNETES_MASTER
token: $KUBERNETES_AUTH_TOKEN
insecure-skip-tls-verify: true
command: apply -f kubernetes.yml