Skip to content

Commit

Permalink
⌥ Make operator deployment optional
Browse files Browse the repository at this point in the history
This allows you to deploy the operator separately from other resources
like the agent injectors, cluster defaults etc.
  • Loading branch information
andersonshatch authored and gamingrobot committed Jun 25, 2024
1 parent 46f1583 commit eeca2e6
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
4 changes: 3 additions & 1 deletion manifests/helm/build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,17 @@ param(

function Invoke-Kustomize([string] $BasePath, [string] $OutputFilePath)
{
kubectl kustomize ([System.IO.Path]::GetFullPath($BasePath)) | Out-File -FilePath $OutputFilePath
kubectl kustomize ([System.IO.Path]::GetFullPath($BasePath)) | Out-File -Append -FilePath $OutputFilePath
}

$root = $PSScriptRoot

# Generate Manifests
Write-Host "Generating manifests..."
Invoke-Kustomize -BasePath "$root/build/crds" -OutputFilePath "$root/crds/generated.yaml"
Write-Output "{{ if ne .Values.operator.enabled false }}" | Out-File -FilePath "$root/templates/generated.yaml"
Invoke-Kustomize -BasePath "$root/build/templates" -OutputFilePath "$root/templates/generated.yaml"
Write-Output "{{ end }}" | Out-File -Append -FilePath "$root/templates/generated.yaml"

# Package
Write-Host "Linting chart."
Expand Down
7 changes: 5 additions & 2 deletions manifests/helm/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{ .Chart.Name }} version {{ .Chart.Version }} deployed!
{{ .Chart.Name }} chart version {{ .Chart.Version }} deployed!

{{- if .Values.agentInjectors.enabled }}
✅ {{ len .Values.agentInjectors.injectors }} {{ len .Values.agentInjectors.injectors | plural "injector" "injectors" }} {{ len .Values.agentInjectors.injectors | plural "has" "have" }} been deployed to {{ len .Values.agentInjectors.namespaces | plural "namespace" "namespaces" }}: {{ join ", " .Values.agentInjectors.namespaces}}
Expand Down Expand Up @@ -32,9 +32,12 @@
{{- else }}
⚠️ clusterDefaults.enabled was false, so no agent connections deployed. Enable this and provide agent credentials for easier deployment via this chart, or refer to documentation here to manually create them: https://docs.contrastsecurity.com/en/agent-operator-configuration.html#clusteragentconnection or https://docs.contrastsecurity.com/en/agent-operator-configuration.html#agentconnection
{{- end }}

{{ if .Values.operator.enabled }}
👀 To watch the operator logs:
⎈ kubectl logs -f -l app.kubernetes.io/part-of=contrast-agent-operator --namespace {{ .Values.namespace }}
{{- else }}
⚠️ operator.enabled was false, Contrast operator was not included in this deployment.
{{- end }}

📄 More documentation: https://docs.contrastsecurity.com/en/agent-operator.html

Expand Down
2 changes: 2 additions & 0 deletions manifests/helm/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ imageCredentials:
email:

operator:
# If enabled, deploy the operator. Disable if you want to deploy only configuration resources (injectors, cluster defaults).
enabled: true
# The default registry to use, defaults to docker.io/contrast.
defaultRegistry: contrast
# The settle duration in seconds.
Expand Down

0 comments on commit eeca2e6

Please sign in to comment.