Skip to content

Commit

Permalink
added Kubernetes config
Browse files Browse the repository at this point in the history
  • Loading branch information
Philippe Stemberger committed Sep 3, 2019
1 parent 2c01d87 commit 93b83c1
Show file tree
Hide file tree
Showing 6 changed files with 166 additions and 6 deletions.
4 changes: 3 additions & 1 deletion broker/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,6 @@

# Sensitive file
gitlab.env
github-com.env
github-com.env
broker-github-com-github-com-env-configmap.yaml
broker-gitlab-gitlab-env-configmap.yaml
42 changes: 37 additions & 5 deletions broker/README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,53 @@
# Snyk broker docker-compose example
# Snyk broker examples

This is an example of how various broker can be configured together for deployment.

## Installation
## Docker-compose

### Installation

Clone the repo and create your own environment file. An example is provided for `GitLab`.

Rename `gitlab.env.template` to `gitlab.env` (or whatever name you used in the `docker-compose.yml`

Run the following command

## Usage
### Usage

```python
docker-compose up --scale broker-gitlab=2 --scale broker-github-com=2
```bash
docker-compose pull && docker-compose up --scale broker-gitlab=2 --scale broker-github-com=2
```

You can check that the set-up was sucessful by visiting `http://localhost:4000/healthcheck`

## Kubernetes

### Installation

Clone the repo and create your own environment file. An example is provided for `GitLab`.

Rename `broker-gitlab-gitlab-env-configmap.yaml.template` to `broker-gitlab-gitlab-env-configmap.yaml`

Run the following command

### Usage

```bash
kubectl apply -f broker-github-com-deployment.yaml,broker-github-com-github-com-env-configmap.yaml
kubectl expose deployment broker-gitlab --type=LoadBalancer
```

You can check that the set-up was sucessful by visiting `http://localhost:7000/healthcheck`

Then it should work in theory. If it doesn't try doing the following

```bash
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/deploy/static/mandatory.yaml
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/deploy/static/provider/cloud-generic.yaml
```

and re-run the above

## Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Expand Down
48 changes: 48 additions & 0 deletions broker/broker-github-com-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
annotations:
kompose.cmd: kompose convert
kompose.version: 1.18.0 ()
creationTimestamp: null
labels:
io.kompose.service: broker-github-com
name: broker-github-com
spec:
replicas: 2
strategy: {}
template:
metadata:
creationTimestamp: null
labels:
io.kompose.service: broker-github-com
spec:
containers:
- env:
- name: BROKER_CLIENT_URL
valueFrom:
configMapKeyRef:
key: BROKER_CLIENT_URL
name: broker-github-com-github-com-env
- name: BROKER_TOKEN
valueFrom:
configMapKeyRef:
key: BROKER_TOKEN
name: broker-github-com-github-com-env
- name: GITHUB_TOKEN
valueFrom:
configMapKeyRef:
key: GITHUB_TOKEN
name: broker-github-com-github-com-env
- name: PORT
valueFrom:
configMapKeyRef:
key: PORT
name: broker-github-com-github-com-env
image: snyk/broker:github-com
name: broker-github-com
ports:
- containerPort: 7001
resources: {}
restartPolicy: Always
status: {}
12 changes: 12 additions & 0 deletions broker/broker-github-com-github-com-env-configmap.yaml.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: v1
data:
BROKER_CLIENT_URL: http://my.broker.client:4001
BROKER_TOKEN: secret-broker-token
GITHUB_TOKEN: secret-github-com-token
PORT: "7001"
kind: ConfigMap
metadata:
creationTimestamp: null
labels:
io.kompose.service: broker-github-com-github-com-env
name: broker-github-com-github-com-env
53 changes: 53 additions & 0 deletions broker/broker-gitlab-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
annotations:
kompose.cmd: kompose convert
kompose.version: 1.18.0 ()
creationTimestamp: null
labels:
io.kompose.service: broker-gitlab
name: broker-gitlab
spec:
replicas: 2
strategy: {}
template:
metadata:
creationTimestamp: null
labels:
io.kompose.service: broker-gitlab
spec:
containers:
- env:
- name: BROKER_CLIENT_URL
valueFrom:
configMapKeyRef:
key: BROKER_CLIENT_URL
name: broker-gitlab-gitlab-env
- name: BROKER_TOKEN
valueFrom:
configMapKeyRef:
key: BROKER_TOKEN
name: broker-gitlab-gitlab-env
- name: GITLAB
valueFrom:
configMapKeyRef:
key: GITLAB
name: broker-gitlab-gitlab-env
- name: GITLAB_TOKEN
valueFrom:
configMapKeyRef:
key: GITLAB_TOKEN
name: broker-gitlab-gitlab-env
- name: PORT
valueFrom:
configMapKeyRef:
key: PORT
name: broker-gitlab-gitlab-env
image: snyk/broker:gitlab
name: broker-gitlab
ports:
- containerPort: 7000
resources: {}
restartPolicy: Always
status: {}
13 changes: 13 additions & 0 deletions broker/broker-gitlab-gitlab-env-configmap.yaml.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: v1
data:
BROKER_CLIENT_URL: http://my.broker.client:4000
BROKER_TOKEN: secret-broker-token
GITLAB: gitlab.com
GITLAB_TOKEN: secret-gitlab-token
PORT: "7000"
kind: ConfigMap
metadata:
creationTimestamp: null
labels:
io.kompose.service: broker-gitlab-gitlab-env
name: broker-gitlab-gitlab-env

0 comments on commit 93b83c1

Please sign in to comment.