This repository has been archived by the owner on Nov 3, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Dockerfile and inputrunner manifest
- Loading branch information
1 parent
8453c0d
commit 173686a
Showing
3 changed files
with
210 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
FROM ubuntu:20.04 | ||
|
||
RUN mkdir -p /usr/share/inputrunner | ||
COPY inputrunner /usr/share/inputrunner/inputrunner | ||
|
||
RUN mkdir -p /usr/share/inputrunner/data /usr/share/inputrunner/logs && \ | ||
chown -R root:root /usr/share/inputrunner && \ | ||
find /usr/share/inputrunner -type d -exec chmod 0755 {} \; && \ | ||
find /usr/share/inputrunner -type f -exec chmod 0644 {} \; && \ | ||
chmod 0775 /usr/share/inputrunner/data /usr/share/inputrunner/logs | ||
|
||
|
||
RUN chmod 0755 /usr/share/inputrunner/inputrunner | ||
RUN for iter in {1..10}; do \ | ||
apt-get update -y && \ | ||
DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends --yes ca-certificates curl coreutils gawk libcap2-bin xz-utils && \ | ||
apt-get clean all && \ | ||
exit_code=0 && break || exit_code=$? && echo "apt-get error: retry $iter in 10s" && sleep 10; \ | ||
done; \ | ||
(exit $exit_code) | ||
|
||
|
||
RUN groupadd --gid 1000 inputrunner | ||
RUN useradd -M --uid 1000 --gid 1000 --groups 0 --home /usr/share/inputrunner inputrunner | ||
USER inputrunner | ||
|
||
WORKDIR /usr/share/inputrunner | ||
CMD [ "/bin/bash", "-c", "./inputrunner", "run" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,168 @@ | ||
--- | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: inputrunnerconfig | ||
namespace: kube-system | ||
labels: | ||
k8s-app: inputrunner | ||
data: | ||
inputrunner.yml: |- | ||
inputrunner.inputs: | ||
- type: assets_k8s | ||
period: 600s | ||
kube_config: "" | ||
asset_types: ["node", "pod"] | ||
output.elasticsearch: | ||
hosts: ['${ELASTICSEARCH_HOST:elasticsearch}:${ELASTICSEARCH_PORT:9200}'] | ||
username: ${ELASTICSEARCH_USERNAME} | ||
password: ${ELASTICSEARCH_PASSWORD} | ||
ssl.verification_mode: "none" | ||
logging.level: info | ||
logging.to_files: false | ||
logging.to_stderr: true | ||
logging.selectors: ["*"] | ||
--- | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: inputrunner | ||
namespace: kube-system | ||
labels: | ||
k8s-app: inputrunner | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
k8s-app: inputrunner | ||
template: | ||
metadata: | ||
labels: | ||
k8s-app: inputrunner | ||
spec: | ||
serviceAccountName: inputrunner | ||
hostNetwork: true | ||
dnsPolicy: ClusterFirstWithHostNet | ||
containers: | ||
- name: inputrunner | ||
image: inputrunner:latest | ||
imagePullPolicy: Never | ||
# command: ['sleep 3600'] | ||
env: | ||
# The basic authentication username used to connect to Elasticsearch | ||
# This user needs the privileges required to publish events to Elasticsearch. | ||
- name: ELASTICSEARCH_USERNAME | ||
value: "elastic" | ||
# The basic authentication password used to connect to Elasticsearch | ||
- name: ELASTICSEARCH_PASSWORD | ||
value: "changeme" | ||
# The Elasticsearch host to communicate with | ||
- name: ELASTICSEARCH_HOST | ||
value: "https://elasticsearch" | ||
# The Elasticsearch port to communicate with | ||
- name: ELASTICSEARCH_PORT | ||
value: "9200" | ||
volumeMounts: | ||
- name: config | ||
mountPath: /usr/share/inputrunner/inputrunner.yml | ||
readOnly: true | ||
subPath: inputrunner.yml | ||
volumes: | ||
- name: config | ||
configMap: | ||
defaultMode: 0640 | ||
name: inputrunnerconfig | ||
--- | ||
apiVersion: v1 | ||
kind: ServiceAccount | ||
metadata: | ||
name: inputrunner | ||
namespace: kube-system | ||
labels: | ||
k8s-app: inputrunner | ||
--- | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRole | ||
metadata: | ||
name: inputrunner | ||
labels: | ||
k8s-app: inputrunner | ||
rules: | ||
- apiGroups: [""] | ||
resources: | ||
- nodes | ||
- namespaces | ||
- events | ||
- pods | ||
- services | ||
- configmaps | ||
# Needed for cloudbeat | ||
- serviceaccounts | ||
- persistentvolumes | ||
- persistentvolumeclaims | ||
verbs: ["get", "list", "watch"] | ||
# Enable this rule only if planing to use kubernetes_secrets provider | ||
#- apiGroups: [""] | ||
# resources: | ||
# - secrets | ||
# verbs: ["get"] | ||
- apiGroups: ["extensions"] | ||
resources: | ||
- replicasets | ||
verbs: ["get", "list", "watch"] | ||
- apiGroups: ["apps"] | ||
resources: | ||
- statefulsets | ||
- deployments | ||
- replicasets | ||
- daemonsets | ||
verbs: ["get", "list", "watch"] | ||
- apiGroups: | ||
- "" | ||
resources: | ||
- nodes/stats | ||
verbs: | ||
- get | ||
- apiGroups: [ "batch" ] | ||
resources: | ||
- jobs | ||
- cronjobs | ||
verbs: [ "get", "list", "watch" ] | ||
# Needed for apiserver | ||
- nonResourceURLs: | ||
- "/metrics" | ||
verbs: | ||
- get | ||
# Needed for cloudbeat | ||
- apiGroups: ["rbac.authorization.k8s.io"] | ||
resources: | ||
- clusterrolebindings | ||
- clusterroles | ||
- rolebindings | ||
- roles | ||
verbs: ["get", "list", "watch"] | ||
# Needed for cloudbeat | ||
- apiGroups: ["policy"] | ||
resources: | ||
- podsecuritypolicies | ||
verbs: ["get", "list", "watch"] | ||
- apiGroups: [ "storage.k8s.io" ] | ||
resources: | ||
- storageclasses | ||
verbs: [ "get", "list", "watch" ] | ||
--- | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRoleBinding | ||
metadata: | ||
name: inputrunner | ||
subjects: | ||
- kind: ServiceAccount | ||
name: inputrunner | ||
namespace: kube-system | ||
roleRef: | ||
kind: ClusterRole | ||
name: inputrunner | ||
apiGroup: rbac.authorization.k8s.io | ||
--- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters