Skip to content
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

Support creating AgentInjectors in the chart #172

Merged
merged 2 commits into from
Jan 26, 2024
Merged
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
44 changes: 44 additions & 0 deletions manifests/helm/templates/agent-injectors.yaml.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{{ if .Values.agentInjectors.enabled }}
{{- range $injector := .Values.agentInjectors.injectors }}
{{- range $namespace := .namespaces }}
---
apiVersion: agents.contrastsecurity.com/v1beta1
kind: AgentInjector
metadata:
name: {{ $injector.name }}
namespace: {{ $namespace }}
spec:
{{- if eq $injector.enabled false}}
enabled: false
{{- end }}
{{- if $injector.connectionName }}
connection:
name: {{ $injector.connectionName }}
{{- end}}
{{- if $injector.configurationName }}
configuration:
name: {{ $injector.configurationName }}
{{- end }}
{{- if $injector.imageVersion }}
version: {{ quote $injector.imageVersion }}
{{- end }}
type: {{ $injector.language }}
{{- if $injector.image }}
image:
{{- $injector.image | toYaml | nindent 4 }}
{{- end}}
{{- if or $injector.selector $injector.images }}
{{ $selector := $injector.selector | default dict -}}
selector:
{{- if $selector.labels }}
labels:
{{- $selector.labels | toYaml | nindent 6 }}
{{- end }}
{{- if $selector.images }}
images:
{{- $selector.images | toYaml | nindent 6 }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
{{ end }}
13 changes: 13 additions & 0 deletions manifests/helm/values.testing.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,16 @@ clusterDefaults:
yaml: |-
enable: true
second-line: something

agentInjectors:
enabled: true
injectors:
- language: java
name: helm-java-injector
namespaces:
- test1
- test2
selector:
labels:
- name: contrast-agent
value: java
55 changes: 55 additions & 0 deletions manifests/helm/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,58 @@ clusterDefaults:
# Optional. Any custom configuration to use. Must be in the format of the standard YAML file.
yaml: |-
enable: true

agentInjectors:
enabled: true
injectors:
- language: java
name: contrast-java-injector
# Optional, defaults to true (enabled)
enabled: true
# Required. This injector will be created in each specified namespace.
namespaces:
andersonshatch marked this conversation as resolved.
Show resolved Hide resolved
- default
# Optional, specify labels and/or image names to inject. If omitted, all workloads will be injected.
# Label selections are cumulative using the logical AND operation.
selector:
labels:
- name: contrast-agent
value: java
#images:
# - imagename
# Optional image configuration.
# image:
# registry: docker.io/contrast
# name: agent-java
# pullPolicy: Always
# Optional image version, defaults to latest
#imageVersion: 5
# Optional name of an AgentConfiguration to use with this injector
#configurationName: custom-config-name
# Optional name of an AgentConnection to use with this injector
#connectionName: custom-connection-name

- language: dotnet-core
name: contrast-dotnet-core-injector
namespaces:
- default
selector:
labels:
- name: contrast-agent
value: dotnet-core
- language: nodejs
name: contrast-nodejs-injector
namespaces:
- default
selector:
labels:
- name: contrast-agent
value: nodejs
- language: php
name: contrast-php-injector
namespaces:
- default
selector:
labels:
- name: contrast-agent
value: php
Loading