Skip to content

Commit

Permalink
testing
Browse files Browse the repository at this point in the history
  • Loading branch information
derekoneil committed Jan 18, 2018
1 parent 93648b7 commit d038596
Show file tree
Hide file tree
Showing 4 changed files with 181 additions and 4 deletions.
56 changes: 56 additions & 0 deletions kubernetes.yml.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: twitter-feed
labels:
commit: ${WERCKER_GIT_COMMIT}
spec:
replicas: 2
selector:
matchLabels:
app: twitter-feed
template:
metadata:
labels:
app: twitter-feed
commit: ${WERCKER_GIT_COMMIT}
color: blue
spec:
containers:
- name: twitter-feed
image: ${DOCKER_REPO}:${WERCKER_GIT_BRANCH}-${WERCKER_GIT_COMMIT}
imagePullPolicy: Always
ports:
- name: twitter-feed
containerPort: 8080
protocol: TCP
volumeMounts:
- name: podinfo
mountPath: /tmp
readOnly: false
volumes:
- name: podinfo
downwardAPI:
items:
- path: "labels"
fieldRef:
fieldPath: metadata.labels
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
color: green
type: ClusterIP
---
8 changes: 4 additions & 4 deletions kubernetes.yml.template.final
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ spec:
imagePullPolicy: Always
ports:
- name: twitter-feed
containerPort: ${PORT}
containerPort: 8080
protocol: TCP
volumeMounts:
- name: podinfo
Expand All @@ -33,10 +33,10 @@ spec:
downwardAPI:
items:
- path: "labels"
fieldRef:
fieldRef:
fieldPath: metadata.labels
imagePullSecrets:
- name: wercker
- name: wercker
---
apiVersion: v1
kind: Service
Expand All @@ -48,7 +48,7 @@ metadata:
spec:
ports:
- port: 30000
targetPort: ${PORT}
targetPort: 8080
selector:
app: twitter-feed
color: blue
Expand Down
56 changes: 56 additions & 0 deletions twitter-feed.kubernetes.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: twitter-feed-v2
labels:
commit: 9a8fa77277c4a8c3c96d96d4b804e83c26ac6cc0
spec:
replicas: 2
selector:
matchLabels:
app: twitter-feed
template:
metadata:
labels:
app: twitter-feed
commit: 9a8fa77277c4a8c3c96d96d4b804e83c26ac6cc0
color: green
spec:
containers:
- name: twitter-feed
image: wcr.io/derekoneil/twitter-feed:master-9a8fa77277c4a8c3c96d96d4b804e83c26ac6cc0
imagePullPolicy: Always
ports:
- name: twitter-feed
containerPort: 8080
protocol: TCP
volumeMounts:
- name: podinfo
mountPath: /tmp
readOnly: false
volumes:
- name: podinfo
downwardAPI:
items:
- path: "labels"
fieldRef:
fieldPath: metadata.labels
imagePullSecrets:
- name: wercker
---
apiVersion: v1
kind: Service
metadata:
name: twitter-feed
labels:
app: twitter-feed
commit: 9a8fa77277c4a8c3c96d96d4b804e83c26ac6cc0
spec:
ports:
- port: 30000
targetPort: 8080
selector:
app: twitter-feed
color: green
type: ClusterIP
---
65 changes: 65 additions & 0 deletions wercker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
#Use OpenJDK base docker image from dockerhub and open the application port on the docker container
box:
id: openjdk
ports:
- 8080

#Build our application using Maven, just as we always have
build:
steps:
- install-packages:
packages: maven
- script:
name: maven build
code: mvn clean assembly:assembly

#Push the docker image with our built and tested application to the Oracle Container Registry
push-release:
steps:
- internal/docker-push:
tag: $WERCKER_GIT_BRANCH-$WERCKER_GIT_COMMIT
working-dir: /pipeline/source
ports: 8080
cmd: sh target/bin/start
#Inject our Wercker application token into Kubernetes to authenticate container pulls
#delete any existing Wercker secret before creating, to accommodate secret changes
inject-secret:
box:
id: alpine
cmd: /bin/sh
steps:

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

- kubectl:
name: create secret
server: $KUBERNETES_MASTER
token: $KUBERNETES_TOKEN
insecure-skip-tls-verify: true
command: create secret docker-registry wercker --docker-server=$DOCKER_REGISTRY --docker-username=$DOCKER_USERNAME --docker-password=$KUBERNETES_TOKEN --docker-email=$DOCKER_EMAIL; echo create registry secret

#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

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

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

0 comments on commit d038596

Please sign in to comment.