Do more Helm templating

This commit is contained in:
M. Mert Yildiran 2023-04-12 01:33:41 +03:00
parent 3ebf816a68
commit d2b9bddf78
No known key found for this signature in database
GPG Key ID: DA5D6DCBB758A461
6 changed files with 26 additions and 5 deletions

View File

@ -126,7 +126,7 @@ var hubPodMappings = map[string]interface{}{
}, },
{ {
"name": "NAMESPACES", "name": "NAMESPACES",
"value": "{{ .Values.tap.namespaces }}", "value": "{{ .Values.tap.allnamespaces | ternary \"\" .Values.tap.namespaces | quote }}",
}, },
{ {
"name": "STORAGE_LIMIT", "name": "STORAGE_LIMIT",
@ -139,26 +139,32 @@ var hubPodMappings = map[string]interface{}{
}, },
"spec.containers[0].image": "{{ .Values.tap.docker.registry }}/hub:{{ .Values.tap.docker.tag }}", "spec.containers[0].image": "{{ .Values.tap.docker.registry }}/hub:{{ .Values.tap.docker.tag }}",
"spec.containers[0].imagePullPolicy": "{{ .Values.tap.docker.imagePullPolicy }}", "spec.containers[0].imagePullPolicy": "{{ .Values.tap.docker.imagePullPolicy }}",
"spec.imagePullSecrets": "{{ .Values.tap.docker.imagepullsecrets }}",
"spec.containers[0].resources.limits.cpu": "{{ .Values.tap.resources.hub.cpu-limit }}", "spec.containers[0].resources.limits.cpu": "{{ .Values.tap.resources.hub.cpu-limit }}",
"spec.containers[0].resources.limits.memory": "{{ .Values.tap.resources.hub.memory-limit }}", "spec.containers[0].resources.limits.memory": "{{ .Values.tap.resources.hub.memory-limit }}",
"spec.containers[0].resources.requests.cpu": "{{ .Values.tap.resources.hub.cpu-requests }}", "spec.containers[0].resources.requests.cpu": "{{ .Values.tap.resources.hub.cpu-requests }}",
"spec.containers[0].resources.requests.memory": "{{ .Values.tap.resources.hub.memory-requests }}", "spec.containers[0].resources.requests.memory": "{{ .Values.tap.resources.hub.memory-requests }}",
"spec.containers[0].command[0]": "{{ .Values.tap.debug | ternary \"./hub -debug\" \"./hub\" }}",
} }
var hubServiceMappings = namespaceMappings var hubServiceMappings = namespaceMappings
var frontPodMappings = map[string]interface{}{ var frontPodMappings = map[string]interface{}{
"metadata.name": "{{ .Values.tap.selfnamespace }}", "metadata.name": "{{ .Values.tap.selfnamespace }}",
"spec.containers[0].image": "{{ .Values.tap.docker.registry }}/front:{{ .Values.tap.docker.tag }}", "spec.containers[0].image": "{{ .Values.tap.docker.registry }}/front:{{ .Values.tap.docker.tag }}",
"spec.containers[0].imagePullPolicy": "{{ .Values.tap.docker.imagePullPolicy }}", "spec.containers[0].imagePullPolicy": "{{ .Values.tap.docker.imagePullPolicy }}",
"spec.imagePullSecrets": "{{ .Values.tap.docker.imagepullsecrets }}",
} }
var frontServiceMappings = namespaceMappings var frontServiceMappings = namespaceMappings
var workerDaemonSetMappings = map[string]interface{}{ var workerDaemonSetMappings = map[string]interface{}{
"metadata.name": "{{ .Values.tap.selfnamespace }}", "metadata.name": "{{ .Values.tap.selfnamespace }}",
"spec.template.spec.containers[0].image": "{{ .Values.tap.docker.registry }}/worker:{{ .Values.tap.docker.tag }}", "spec.template.spec.containers[0].image": "{{ .Values.tap.docker.registry }}/worker:{{ .Values.tap.docker.tag }}",
"spec.template.spec.containers[0].imagePullPolicy": "{{ .Values.tap.docker.imagePullPolicy }}", "spec.template.spec.containers[0].imagePullPolicy": "{{ .Values.tap.docker.imagePullPolicy }}",
"spec.imagePullSecrets": "{{ .Values.tap.docker.imagepullsecrets }}",
"spec.template.spec.containers[0].resources.limits.cpu": "{{ .Values.tap.resources.worker.cpu-limit }}", "spec.template.spec.containers[0].resources.limits.cpu": "{{ .Values.tap.resources.worker.cpu-limit }}",
"spec.template.spec.containers[0].resources.limits.memory": "{{ .Values.tap.resources.worker.memory-limit }}", "spec.template.spec.containers[0].resources.limits.memory": "{{ .Values.tap.resources.worker.memory-limit }}",
"spec.template.spec.containers[0].resources.requests.cpu": "{{ .Values.tap.resources.worker.cpu-requests }}", "spec.template.spec.containers[0].resources.requests.cpu": "{{ .Values.tap.resources.worker.cpu-requests }}",
"spec.template.spec.containers[0].resources.requests.memory": "{{ .Values.tap.resources.worker.memory-requests }}", "spec.template.spec.containers[0].resources.requests.memory": "{{ .Values.tap.resources.worker.memory-requests }}",
"spec.template.spec.containers[0].command[0]": "{{ .Values.tap.debug | ternary \"./worker -debug\" \"./worker\" }}",
"spec.template.spec.containers[0].command[6]": "{{ .Values.tap.packetcapture }}",
} }
func init() { func init() {

View File

@ -11,12 +11,12 @@ metadata:
spec: spec:
containers: containers:
- command: - command:
- ./hub - '{{ .Values.tap.debug | ternary "./hub -debug" "./hub" }}'
env: env:
- name: POD_REGEX - name: POD_REGEX
value: '{{ .Values.tap.regex }}' value: '{{ .Values.tap.regex }}'
- name: NAMESPACES - name: NAMESPACES
value: '{{ .Values.tap.namespaces }}' value: '{{ .Values.tap.allnamespaces | ternary "" .Values.tap.namespaces | quote }}'
- name: STORAGE_LIMIT - name: STORAGE_LIMIT
value: '{{ .Values.tap.storagelimit }}' value: '{{ .Values.tap.storagelimit }}'
- name: LICENSE - name: LICENSE
@ -32,6 +32,7 @@ spec:
cpu: '{{ .Values.tap.resources.hub.cpu-requests }}' cpu: '{{ .Values.tap.resources.hub.cpu-requests }}'
memory: '{{ .Values.tap.resources.hub.memory-requests }}' memory: '{{ .Values.tap.resources.hub.memory-requests }}'
dnsPolicy: ClusterFirstWithHostNet dnsPolicy: ClusterFirstWithHostNet
imagePullSecrets: '{{ .Values.tap.docker.imagepullsecrets }}'
serviceAccountName: kubeshark-service-account serviceAccountName: kubeshark-service-account
terminationGracePeriodSeconds: 0 terminationGracePeriodSeconds: 0
tolerations: tolerations:

View File

@ -35,6 +35,7 @@ spec:
cpu: 50m cpu: 50m
memory: 50Mi memory: 50Mi
dnsPolicy: ClusterFirstWithHostNet dnsPolicy: ClusterFirstWithHostNet
imagePullSecrets: '{{ .Values.tap.docker.imagepullsecrets }}'
serviceAccountName: kubeshark-service-account serviceAccountName: kubeshark-service-account
terminationGracePeriodSeconds: 0 terminationGracePeriodSeconds: 0
tolerations: tolerations:

View File

@ -9,6 +9,7 @@ metadata:
name: '{{ .Values.tap.selfnamespace }}' name: '{{ .Values.tap.selfnamespace }}'
namespace: kubeshark namespace: kubeshark
spec: spec:
imagePullSecrets: '{{ .Values.tap.docker.imagepullsecrets }}'
selector: selector:
matchLabels: matchLabels:
app: kubeshark-worker-daemon-set app: kubeshark-worker-daemon-set
@ -26,11 +27,13 @@ spec:
spec: spec:
containers: containers:
- command: - command:
- ./worker - '{{ .Values.tap.debug | ternary "./worker -debug" "./worker" }}'
- -i - -i
- any - any
- -port - -port
- "8897" - "8897"
- -packet-capture
- '{{ .Values.tap.packetcapture }}'
- -servicemesh - -servicemesh
- -tls - -tls
- -procfs - -procfs

View File

@ -706,7 +706,15 @@ func (provider *Provider) BuildWorkerDaemonSet(
} }
// Command // Command
command := []string{"./worker", "-i", "any", "-port", "8897"} command := []string{
"./worker",
"-i",
"any",
"-port",
"8897",
"-packet-capture",
config.Config.Tap.PacketCapture,
}
if debug { if debug {
command = append(command, "-debug") command = append(command, "-debug")
} }

View File

@ -31,6 +31,8 @@ spec:
- any - any
- -port - -port
- "8897" - "8897"
- -packet-capture
- libpcap
- -servicemesh - -servicemesh
- -tls - -tls
- -procfs - -procfs