Skip to content

Commit

Permalink
First commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonathan Johnson committed Jun 30, 2017
0 parents commit 3f628ec
Show file tree
Hide file tree
Showing 61 changed files with 8,165 additions and 0 deletions.
39 changes: 39 additions & 0 deletions clear-registry.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/bin/bash
#
# usage ./clean.docker.registry.sh registryUrl login filterString
#

# read the password
# echo -n Password:
# read -s password

user="$2:${password}"
if [ -z $user ] ; then
userOption=""
else
userOption="-u ${user}"
fi

dockerRegistry="$1"
imagesFilter="$3"

# get the list of images names that match the filter
images=$(curl -s ${userOption} ${dockerRegistry}/v2/_catalog | jq -r '.repositories[] | select(. | contains("'${imagesFilter}'")) ')
echo ${images}
for image in $images ; do
# get the list of tags for each image
tags=$(curl -s ${userOption} ${dockerRegistry}/v2/${image}/tags/list | jq -r .tags[])

for tag in $tags ; do
echo "${image}:${tag}"
# get the digest of the image:tag
digest=$(curl -H "Accept: application/vnd.docker.distribution.manifest.v2+json" -v -s -u ${user} "${dockerRegistry}/v2/${image}/manifests/${tag}" 2>&1 | grep -e "Docker-Content-Digest:*" | awk '{ sub(/\r/,"",$3) ; print $3 }')
if [ -z $digest ] ; then
echo "${image}:${tag} not found"
else
echo "Deleting ${image}:${tag}:${digest}"
curl -i -X DELETE -w "[%{http_code}]\n" -s ${userOption} ${dockerRegistry}'/v2/'${image}'/manifests/'${digest}
echo "..."
fi
done
done
62 changes: 62 additions & 0 deletions cluster/h2-world-a/h2-world-a.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
labels:
app: h2-world-a
name: h2-world-a
namespace: pact
spec:
replicas: 1
selector:
matchLabels:
app: h2-world-a
strategy:
rollingUpdate:
maxSurge: 1
maxUnavailable: 1
type: RollingUpdate
template:
metadata:
creationTimestamp: null
labels:
app: h2-world-a
name: h2-world-a
spec:
containers:
- image: localhost:32057/h2-world-a
imagePullPolicy: Always
name: h2-world-a
resources: {}
securityContext:
privileged: false
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
dnsPolicy: ClusterFirst
restartPolicy: Always
schedulerName: default-scheduler
terminationGracePeriodSeconds: 30
---
apiVersion: v1
kind: Service
metadata:
labels:
app: h2-world-a
name: h2-world-a
namespace: pact
spec:
clusterIP: 10.0.0.169
ports:
- name: tcp-8082-8082-9whs1
nodePort: 31903
port: 8082
protocol: TCP
targetPort: 8082
- name: tcp-1521-1521-vdx68
nodePort: 32196
port: 1521
protocol: TCP
targetPort: 1521
selector:
app: h2-world-a
sessionAffinity: None
type: LoadBalancer
56 changes: 56 additions & 0 deletions cluster/ms-world/ms-world.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
labels:
app: ms-world
name: ms-world
namespace: pact
spec:
replicas: 1
selector:
matchLabels:
app: ms-world
strategy:
rollingUpdate:
maxSurge: 1
maxUnavailable: 1
type: RollingUpdate
template:
metadata:
creationTimestamp: null
labels:
app: ms-world
name: ms-world
spec:
containers:
- image: localhost:32057/ms-world
imagePullPolicy: Always
name: ms-world
resources: {}
securityContext:
privileged: false
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
dnsPolicy: ClusterFirst
restartPolicy: Always
schedulerName: default-scheduler
terminationGracePeriodSeconds: 30
---
apiVersion: v1
kind: Service
metadata:
labels:
app: ms-world
name: ms-world
namespace: pact
spec:
ports:
- name: tcp-9001-9001-dl3tp
nodePort: 32012
port: 9001
protocol: TCP
targetPort: 9001
selector:
app: ms-world
sessionAffinity: None
type: LoadBalancer
32 changes: 32 additions & 0 deletions cluster/pact-broker/pact-broker-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
creationTimestamp: null
labels:
io.kompose.service: pact-broker
name: pact-broker
spec:
replicas: 1
strategy: {}
template:
metadata:
creationTimestamp: null
labels:
io.kompose.service: pact-broker
spec:
containers:
- env:
- name: PACT_BROKER_DATABASE_USERNAME
value: postgres
- name: PACT_BROKER_DATABASE_PASSWORD
value: postgres
- name: PACT_BROKER_DATABASE_HOST
value: postgres
- name: PACT_BROKER_DATABASE_NAME
value: postgres
image: dius/pact_broker
name: pact-broker
ports:
- containerPort: 80
resources: {}
restartPolicy: Always
16 changes: 16 additions & 0 deletions cluster/pact-broker/pact-broker-service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
apiVersion: v1
kind: Service
metadata:
creationTimestamp: null
labels:
io.kompose.service: pact-broker
name: pact-broker
spec:
ports:
- name: "80"
port: 80
targetPort: 80
nodePort: 32033
selector:
io.kompose.service: pact-broker
type: LoadBalancer
13 changes: 13 additions & 0 deletions cluster/pact-broker/postgres-claim0-persistentvolumeclaim.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
creationTimestamp: null
labels:
io.kompose.service: postgres-claim0
name: postgres-claim0
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 100Mi
34 changes: 34 additions & 0 deletions cluster/pact-broker/postgres-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
creationTimestamp: null
labels:
io.kompose.service: postgres
name: postgres
spec:
replicas: 1
strategy:
type: Recreate
template:
metadata:
creationTimestamp: null
labels:
io.kompose.service: postgres
spec:
containers:
- env:
- name: POSTGRES_PASSWORD
value: postgres
- name: POSTGRES_USER
value: postgres
image: postgres:9.6-alpine
name: postgres
resources: {}
volumeMounts:
- mountPath: /var/lib/postgresql/data
name: postgres-claim0
restartPolicy: Always
volumes:
- name: postgres-claim0
persistentVolumeClaim:
claimName: postgres-claim0
15 changes: 15 additions & 0 deletions cluster/pact-broker/postgres-service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: v1
kind: Service
metadata:
creationTimestamp: null
labels:
io.kompose.service: postgres
name: postgres
spec:
clusterIP: None
ports:
- name: headless
port: 55555
targetPort: 0
selector:
io.kompose.service: postgres
59 changes: 59 additions & 0 deletions cluster/registry-ui/registry-ui.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
apiVersion: v1
kind: Pod
metadata:
labels:
app: registry-ui
pod-template-hash: "203719849"
name: registry-ui-203719849-23l33
namespace: kube-system
spec:
containers:
- env:
- name: REGISTRY_URL
value: http://registry.kube-system.svc.cluster.local/v2
- name: REGISTRY_NAME
value: localhost:32057
image: hyper/docker-registry-web
imagePullPolicy: Always
name: registry-ui
securityContext:
privileged: false
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
volumeMounts:
- mountPath: /var/run/secrets/kubernetes.io/serviceaccount
name: default-token-nh6ln
readOnly: true
dnsPolicy: ClusterFirst
nodeName: minikube
restartPolicy: Always
schedulerName: default-scheduler
serviceAccount: default
serviceAccountName: default
terminationGracePeriodSeconds: 30
volumes:
- name: default-token-nh6ln
secret:
defaultMode: 420
secretName: default-token-nh6ln
---
apiVersion: v1
kind: Service
metadata:
labels:
app: registry-ui
name: registry-ui
namespace: kube-system
spec:
clusterIP: 10.0.0.159
ports:
- name: tcp-8080-8080-rkng8
nodePort: 32207
port: 8080
protocol: TCP
targetPort: 8080
selector:
app: registry-ui
sessionAffinity: None
type: LoadBalancer

11 changes: 11 additions & 0 deletions cluster/undeploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/sh
#
# Removal of deploymentsto the pact namespace.

: ${NAMESPACE:=pact}

# lowercase required
NAMESPACE=${NAMESPACE,,}

echo -n "Terminating namespace $NAMESPACE.."
kubectl delete namespace $NAMESPACE
25 changes: 25 additions & 0 deletions h2-world-a/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
.gradle
/build/
!gradle/wrapper/gradle-wrapper.jar

### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans

### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr

### NetBeans ###
nbproject/private/
build/
nbbuild/
dist/
nbdist/
.nb-gradle/
Loading

0 comments on commit 3f628ec

Please sign in to comment.