Skip to content

Commit

Permalink
Deployable
Browse files Browse the repository at this point in the history
  • Loading branch information
alok87 committed May 26, 2020
1 parent edef32a commit 13df420
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 14 deletions.
Empty file added .envs.sh.sample
Empty file.
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,6 @@ deploy:
@echo "Creating kubernetes deployment at: ./artifacts/deployment.yaml"
@cp artifacts/deployment-template.yaml artifacts/deployment.yaml
VERSION=$(VERSION) ./hack/generate.sh artifacts/deployment.yaml
@kubectl --context=$(KUBE_CONTEXT) delete deploy -ncentral beanstalkd_exporter
@kubectl --context=$(KUBE_CONTEXT) apply -f artifacts/deployment.yaml || @kubectl --context=$(KUBE_CONTEXT) create -f artifacts/deployment.yaml
@kubectl --context=$(KUBE_CONTEXT) get pods -n central | grep beanstalkd_exporter
@echo "Create the deployment: kubectl create -f artifacts/deployment.yaml"
@echo "Create the service to scrap the exporter data: kubectl create -f artifacts/service.yaml"
@echo "Create the servicemonitor to scrap the service to get the data to prometheus: kubectl create -f artifacts/service-monitor.yaml"
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,15 @@ the number of concurrent tube stats workers via the

## Usage

How to build it?
```
make build
```

How to generate the deployment yamls?
```
make deploy
```

Running beanstalkd_exporter is as easy as executing `beanstalkd_exporter` on the command line. One argument is required: `-mapping-config` (see below for what it needs).

Expand Down Expand Up @@ -110,4 +119,3 @@ tube_current_jobs_ready{tube="incoming-emails",user_id="8882"}
## License

beanstalkd_exporter is licensed under [The BSD 2-Clause License](http://opensource.org/licenses/BSD-2-Clause). Copyright (c) 2016, MessageBird

1 change: 1 addition & 0 deletions artifacts/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
deployment.yaml
14 changes: 6 additions & 8 deletions artifacts/deployment-template.yaml
Original file line number Diff line number Diff line change
@@ -1,32 +1,30 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: beanstalkd_exporter
namespace: central
name: beanstalkd-exporter
labels:
app: beanstalkd_exporter
app: beanstalkd-exporter
spec:
replicas: 1
selector:
matchLabels:
app: beanstalkd_exporter
app: beanstalkd-exporter
template:
metadata:
labels:
app: beanstalkd_exporter
app: beanstalkd-exporter
spec:
tolerations:
- effect: NoExecute
operator: Exists
- effect: NoSchedule
operator: Exists
containers:
- name: beanstalkd_exporter
image: practodev/beanstalkd_exporter:{{ beanstalkd_exporter_VERSION }}
- name: beanstalkd-exporter
image: practodev/beanstalkd_exporter:{{ BEANSTALK_EXPORTER_VERSION }}
imagePullPolicy: Always
command:
- /beanstalkd_exporter
- run
resources:
limits:
cpu: 100m
Expand Down
19 changes: 19 additions & 0 deletions artifacts/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Please edit the object below. Lines beginning with a '#' will be ignored,
# and an empty file will abort the edit. If an error occurs while saving this file will be
# reopened with the relevant failures.
#
apiVersion: v1
kind: Service
metadata:
labels:
k8s-app: beanstalkd-exporter
name: beanstalkd-exporter
spec:
ports:
- name: beanstalkd-exporter-metrics
port: 8080
protocol: TCP
targetPort: 8080
selector:
app: beanstalkd-exporter
type: ClusterIP
4 changes: 2 additions & 2 deletions hack/generate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ if [ -z "${VERSION}" ]; then
echo "VERSION not set, exiting"
exit 1
fi
export SQSMV_VERSION=${VERSION}
export BEANSTALK_EXPORTER_VERSION=${VERSION}

echo "sourcing environment variables: ./.envs.sh"
source ./.envs.sh

BIN='SQSMV'
BIN='BEANSTALK_EXPORTER'
while IFS='=' read -r name value ; do
if [[ $name == *"${BIN}_"* ]]; then
if [ "$machine" = "Mac" ]; then
Expand Down

0 comments on commit 13df420

Please sign in to comment.