Skip to content

Commit

Permalink
Merge pull request #236 from Lyt99/deploy/helm
Browse files Browse the repository at this point in the history
deploy(helm): helm chart for v1.0.0
  • Loading branch information
BSWANG authored Apr 8, 2024
2 parents 6c0f271 + d377e4b commit 0b1df4f
Show file tree
Hide file tree
Showing 14 changed files with 361 additions and 74 deletions.
7 changes: 3 additions & 4 deletions deploy/helm/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
apiVersion: v1
name: kubeskoop-exporter
name: kubeskoop
description: Promtheus exporter and kernel tracing for OS metrics in kubernetes, with pluggable metric collectors and kernel eBPF tracers.
type: application
annotations:
category: Analytics
licenses: Apache-2.0
version: 0.3.0
appVersion: 0.1.0
version: 1.0.0
appVersion: 1.0.0
icon: https://img.shields.io/github/v/tag/alibaba/kubeskoop
keywords:
- kubeskoop
- kubeskoop-exporter
- kubernetes
- prometheus
- eBPF
Expand Down
24 changes: 12 additions & 12 deletions deploy/helm/templates/configMap.yaml
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
apiVersion: v1
data:
config.yaml: |-
debugMode: {{ .Values.debugMode }}
port: {{ .Values.config.serverPort }}
metrics:
probes:{{- range .Values.config.metricsProbes }}
- {{ . }}{{- end }}
events:
probes: {{- range .Values.config.eventProbes }}
- {{ . }}{{- end }}
sinks: {{- range .Values.config.eventSinks }}
- {{ . }}{{- end }}
kind: ConfigMap
metadata:
name: kubeskoop-config
namespace: {{ .Release.Namespace }}
data:
config.yaml: |-
debugmode: {{ .Values.agent.debug }}
port: {{ .Values.agent.port }}
metrics:
probes:
{{- toYaml .Values.config.metricProbes | nindent 6 }}
event:
probes:
{{- toYaml .Values.config.eventProbes | nindent 6 }}
sinks:
{{- toYaml .Values.config.eventSinks | nindent 6 }}
28 changes: 28 additions & 0 deletions deploy/helm/templates/controller/clusterrole.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{{- if .Values.controller.enabled }}
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: kubeskoop-controller
rules:
- apiGroups: [""]
resources:
- nodes
- nodes/proxy
- services
- endpoints
- configmaps
- namespaces
- pods
verbs: ["get", "list", "watch"]
- apiGroups: ["apps"]
resources: ["daemonsets"]
verbs: ["get", "list"]
- apiGroups: ["networking.k8s.io"]
resources: ["networkpolicies"]
verbs: ["get", "list"]
- apiGroups: ["projectcalico.org", "crd.projectcalico.org"]
resources: ["ippools"]
verbs: ["get", "list"]
- nonResourceURLs: ["/metrics"]
verbs: ["get"]
{{- end }}
14 changes: 14 additions & 0 deletions deploy/helm/templates/controller/clusterrolebinding.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{{- if .Values.controller.enabled }}
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: kubeskoop-controller
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: kubeskoop-controller
subjects:
- kind: ServiceAccount
name: default
namespace: {{ .Release.Namespace }}
{{- end }}
20 changes: 20 additions & 0 deletions deploy/helm/templates/controller/configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{{- if .Values.controller.enabled }}
apiVersion: v1
kind: ConfigMap
metadata:
name: controller-config
namespace: {{ .Release.Namespace }}
data:
controller.yaml: |-
logLevel: debug
server:
httpPort: 10264
agentPort: 10263
controller:
namespace: {{ .Release.Namespace }}
prometheus: "{{ .Values.controller.config.prometheusEndpoint }}"
loki: "{{ .Values.controller.config.lokiEndpoint }}"
database:
type: sqlite3
diagnose: {}
{{- end }}
47 changes: 47 additions & 0 deletions deploy/helm/templates/controller/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{{- if .Values.controller.enabled }}
apiVersion: apps/v1
kind: Deployment
metadata:
name: controller
namespace: {{ .Release.Namespace }}
{{- with .Values.controller }}
spec:
replicas: 1
selector:
matchLabels:
app: controller
template:
metadata:
name: controller
labels:
app: controller
spec:
containers:
- name: controller
image: "{{ .image.repository }}:{{ .image.tag }}"
imagePullPolicy: {{ .image.imagePullPolicy }}
command:
- "/bin/controller"
volumeMounts:
- name: lib
mountPath: /var/lib/kubeskoop
- name: config
mountPath: /etc/kubeskoop
resources:
{{ toYaml .resources | nindent 12 }}
{{- with .nodeSelector }}
nodeSelector:
{{ toYaml . | nindent 8 }}
{{- end }}
{{- with .tolerations }}
tolerations:
{{ toYaml . | nindent 8 }}
{{- end }}
volumes:
- name: lib
emptyDir: { }
- name: config
configMap:
name: controller-config
{{- end }}
{{- end }}
19 changes: 19 additions & 0 deletions deploy/helm/templates/controller/role.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{{- if .Values.controller.enabled }}
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: controller
namespace: {{ .Release.Namespace }}
rules:
- apiGroups: [""]
resources: ["configmaps"]
resourceNames: ["kubeskoop-config"]
verbs: ["get", "update"]
- apiGroups: [""]
resources:
- pods
verbs: ["get", "list", "watch", "delete", "create"]
- apiGroups: [""]
resources: ["pods/exec", "pods/attach", "pods/portforward"]
verbs: ["create", "get", "list", "update", "delete"]
{{- end }}
15 changes: 15 additions & 0 deletions deploy/helm/templates/controller/rolebinding.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{{- if .Values.controller.enabled }}
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: controller
namespace: {{ .Release.Namespace }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: controller
subjects:
- kind: ServiceAccount
name: default
namespace: {{ .Release.Namespace }}
{{- end }}
17 changes: 17 additions & 0 deletions deploy/helm/templates/controller/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{{- if .Values.controller.enabled}}
apiVersion: v1
kind: Service
metadata:
name: controller
namespace: {{ .Release.Namespace }}
spec:
selector:
app: controller
ports:
- name: grpc
port: 10263
targetPort: 10263
- name: http
port: 10264
targetPort: 10264
{{- end }}
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: {{ .Values.name }}
name: agent
namespace: {{ .Release.Namespace }}
labels:
app: {{ .Values.appName }}
app: kubeskoop-agent
{{- with .Values.agent }}
spec:
selector:
matchLabels:
app: {{ .Values.appName }}
app: kubeskoop-agent
template:
metadata:
labels:
app: {{ .Values.appName }}
app: kubeskoop-agent
annotations:
prometheus.io/path: /metrics
prometheus.io/port: "9102"
prometheus.io/port: "{{ .config.port }}"
prometheus.io/scheme: http
prometheus.io/scrape: "true"
name: {{ .Values.appName }}
spec:
hostNetwork: true
hostPID: true
hostIPC: true
dnsPolicy: ClusterFirstWithHostNet
{{- if .Values.initContainer.enabled }}
{{- if .btfhack.enabled }}
initContainers:
- name: preparels
image: {{ .Values.initContainer.repository }}:{{ .Values.initContainer.tag }}
imagePullPolicy: {{ .Values.initContainer.imagePullPolicy }}
- name: btfhack
image: "{{ .btfhack.repository }}:{{ .btfhack.tag }}"
imagePullPolicy: {{ .btfhack.imagePullPolicy }}
volumeMounts:
- name: bpfdir
mountPath: /etc/net-exporter/btf
Expand All @@ -42,8 +42,8 @@ spec:
{{- end }}
containers:
- name: inspector
image: {{ .Values.image.repository }}:{{ .Values.image.tag }}
imagePullPolicy: {{ .Values.image.imagePullPolicy }}
image: "{{ .image.repository }}:{{ .image.tag }}"
imagePullPolicy: {{ .image.imagePullPolicy }}
env:
- name: INSPECTOR_NODENAME
valueFrom:
Expand Down Expand Up @@ -74,12 +74,12 @@ spec:
securityContext:
privileged: true
resources:
{{- toYaml .Values.resources | nindent 12 }}
{{- with .Values.nodeSelector }}
{{- toYaml .resources | nindent 12 }}
{{- with .nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
{{- with .tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
Expand All @@ -89,7 +89,7 @@ spec:
path: /proc
- name: runtimeendpoint
hostPath:
path: {{ .Values.runtimeEndpoint }}
path: {{ .config.runtimeEndpoint }}
- name: boot
hostPath:
path: /boot/
Expand All @@ -112,3 +112,4 @@ spec:
name: kubeskoop-config
- name: bpfdir
emptyDir: {}
{{- end }}
54 changes: 54 additions & 0 deletions deploy/helm/templates/webconsole/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{{- if and .Values.controller.enabled .Values.webconsole.enabled }}
apiVersion: apps/v1
kind: Deployment
metadata:
name: webconsole
namespace: {{ .Release.Namespace }}
{{- with .Values.webconsole }}
spec:
replicas: 1
selector:
matchLabels:
app: webconsole
template:
metadata:
name: webconsole
labels:
app: webconsole
spec:
containers:
- name: webconsole
image: "{{ .image.repository }}:{{ .image.tag }}"
imagePullPolicy: {{ .image.imagePullPolicy }}
command: [ "/bin/webconsole" ]
env:
- name: CONTROLLER_ENDPOINT
value: "http://controller:10264"
- name: GRAFANA_PROXY
value: "{{ .grafana.proxy }}"
- name: GRAFANA_ENDPOINT
value: "{{ .grafana.endpoint }}"
- name: GRAFANA_USERNAME
value: "{{ .grafana.username }}"
- name: GRAFANA_PASSWORD
value: "{{ .grafana.password }}"
- name: AUTH_USERNAME
value: "{{ .auth.username }}"
- name: AUTH_PASSWORD
value: "{{ .auth.password }}"
resources:
{{- toYaml .resources | nindent 12 }}
ports:
- name: http
containerPort: 8080
protocol: TCP
{{ with .nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{ with .tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- end }}
{{- end }}
17 changes: 17 additions & 0 deletions deploy/helm/templates/webconsole/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{{- if and .Values.controller.enabled .Values.webconsole.enabled}}
apiVersion: v1
kind: Service
metadata:
name: webconsole
namespace: {{ .Release.Namespace }}
annotations:
{{- .Values.webconsole.service.annotations | toYaml | nindent 4 }}
spec:
type: {{ .Values.webconsole.service.type }}
selector:
app: webconsole
ports:
- name: http
port: {{ .Values.webconsole.service.port }}
targetPort: 8080
{{- end }}
Loading

0 comments on commit 0b1df4f

Please sign in to comment.