Skip to content

elasticsearch exporter and image observer code and yaml #2

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

Open
wants to merge 1 commit 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
4 changes: 4 additions & 0 deletions elastisearch-exporter/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
FROM openshift/origin:latest
COPY elasticsearch_exporter /bin/elasticsearch_exporter
ENTRYPOINT /bin/elasticsearch_exporter

8 changes: 8 additions & 0 deletions elastisearch-exporter/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
This used the justwatch elasticsearch exporter.

The existing dockerfile did not contain the latest arguments that the master branch had.

Also when trying to run the master branch we ran into panics so a custom build with `exporter.go`
lines 471 and 472 comment out.


131 changes: 131 additions & 0 deletions elastisearch-exporter/dc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
apiVersion: v1
kind: DeploymentConfig
metadata:
name: logging-es-aa0v5dqh
namespace: logging
labels:
app: logging-es-template
component: es
logging-infra: elasticsearch
provider: openshift
annotations:
openshift.io/generated-by: OpenShiftNewApp
spec:
strategy:
type: Recreate
recreateParams:
timeoutSeconds: 600
resources: {}
triggers:
- type: ConfigChange
replicas: 1
test: false
selector:
component: es
deployment: logging-es-aa0v5dqh
provider: openshift
template:
metadata:
creationTimestamp: null
labels:
app: logging-es-template
component: es
deployment: logging-es-aa0v5dqh
provider: openshift
annotations:
openshift.io/generated-by: OpenShiftNewApp
spec:
volumes:
- name: elasticsearch
secret:
secretName: logging-elasticsearch
defaultMode: 420
- name: elasticsearch-config
configMap:
name: logging-elasticsearch
defaultMode: 420
- name: elasticsearch-storage
persistentVolumeClaim:
claimName: logging-es-aa0v5dqh
containers:
- name: elasticsearch-prom-exporter
image: 'docker.io/pweil/elasticsearch_exporter:latest'
command:
- /bin/elasticsearch_exporter
args:
- '-es.uri=https://localhost:9200'
- '-es.ca=/etc/elasticsearch/secret/admin-ca'
- '-es.client-cert=/etc/elasticsearch/secret/admin-cert'
- '-es.client-private-key=/etc/elasticsearch/secret/admin-key'
ports:
- name: scraper
containerPort: 9108
protocol: TCP
resources:
limits:
memory: 256Mi
requests:
memory: 256Mi
volumeMounts:
- name: elasticsearch
readOnly: true
mountPath: /etc/elasticsearch/secret
terminationMessagePath: /dev/termination-log
imagePullPolicy: Always
- name: elasticsearch
image: '172.30.194.97:5000/logging/logging-elasticsearch:latest'
ports:
- name: restapi
containerPort: 9200
protocol: TCP
- name: cluster
containerPort: 9300
protocol: TCP
env:
- name: NAMESPACE
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: metadata.namespace
- name: KUBERNETES_TRUST_CERT
value: 'true'
- name: SERVICE_DNS
value: logging-es-cluster
- name: CLUSTER_NAME
value: logging-es
- name: INSTANCE_RAM
value: 7680M
- name: NODE_QUORUM
value: '2'
- name: RECOVER_AFTER_NODES
value: '1'
- name: RECOVER_EXPECTED_NODES
value: '2'
- name: RECOVER_AFTER_TIME
value: 5m
resources:
limits:
memory: 7680Mi
requests:
memory: 512Mi
volumeMounts:
- name: elasticsearch
readOnly: true
mountPath: /etc/elasticsearch/secret
- name: elasticsearch-config
readOnly: true
mountPath: /usr/share/java/elasticsearch/config
- name: elasticsearch-storage
mountPath: /elasticsearch/persistent
terminationMessagePath: /dev/termination-log
imagePullPolicy: Always
restartPolicy: Always
terminationGracePeriodSeconds: 600
dnsPolicy: ClusterFirst
nodeSelector:
type: infra
serviceAccountName: aggregated-logging-elasticsearch
serviceAccount: aggregated-logging-elasticsearch
securityContext:
supplementalGroups:
- 65534
Binary file added elastisearch-exporter/elasticsearch_exporter
Binary file not shown.
6 changes: 6 additions & 0 deletions image-observer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FROM openshift/origin
ADD observer.sh /bin/observer.sh
ADD test.sh /bin/test.sh
ENTRYPOINT /bin/observer.sh


40 changes: 40 additions & 0 deletions image-observer/image-observer.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
apiVersion: v1
kind: DeploymentConfig
metadata:
name: image-observer
spec:
replicas: 1
selector:
run: image-observer
strategy:
activeDeadlineSeconds: 21600
resources: {}
rollingParams:
intervalSeconds: 1
maxSurge: 25%
maxUnavailable: 25%
timeoutSeconds: 600
updatePeriodSeconds: 1
type: Rolling
template:
metadata:
creationTimestamp: null
labels:
run: image-observer
spec:
containers:
- image: pweil/image-observer
imagePullPolicy: Always
name: image-observer
resources: {}
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
dnsPolicy: ClusterFirst
restartPolicy: Always
schedulerName: default-scheduler
securityContext: {}
serviceAccountName: prometheus
terminationGracePeriodSeconds: 30
test: false
triggers:
- type: ConfigChange
4 changes: 4 additions & 0 deletions image-observer/observer.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env bash
# make sure the service account has access to priv and host mount, only needs run once
#oadm policy add-scc-to-user privileged -z default
oc observe --all-namespaces=true --type-env-var="OBJ_ACTION" pods -- /bin/test.sh
13 changes: 13 additions & 0 deletions image-observer/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash


# TODO need to also handle updates but only when it is a new image
if [[ $OBJ_ACTION == "Deleted" ]]; then
echo "ignoring..."
exit 0
fi

images=$(oc get pod --namespace=${1} --template="pod:{{.metadata.namespace}}/{{.metadata.name}}, {{range $key $val .spec.containers}}image:{{$val.image}} {{end}}" ${2})
echo $images