Skip to content

Commit

Permalink
Feat: Enable goldpinger collector and analyzer (#1265)
Browse files Browse the repository at this point in the history
* Enable goldpinger collector and analyzer

* use goldpinger namespace

* pin images

* Conditionally disable the goldpinger collector in airgap installs

This is only a temporary workaround until we get the goldpinger image included in our airgap builds.

* Use proxied images by digest

* operator airgap values

* airgap operator values

* instead of hardcoding values hashes in unit testing build them from the expected values

* airgap chart spec

* remove print

* operator airgap tests

* v

---------

Co-authored-by: Andrew Lavery <laverya@umich.edu>
  • Loading branch information
hedge-sparrow and laverya authored Oct 24, 2024
1 parent 3971e1b commit 37ceee7
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: embedded-cluster-troubleshoot-goldpinger
labels:
troubleshoot.sh/kind: support-bundle
{{- with (include "embedded-cluster-operator.labels" $ | fromYaml) }}
{{- toYaml . | nindent 4 }}
{{- end }}
data:
support-bundle-spec: |
apiVersion: troubleshoot.sh/v1beta2
kind: SupportBundle
metadata:
name: embedded-cluster-troubleshoot-goldpinger
labels:
troubleshoot.sh/kind: support-bundle
spec:
collectors:
- goldpinger:
namespace: goldpinger
image: proxy.replicated.com/anonymous/bloomberg/goldpinger@sha256:70416f19f1cbeedd344d37b08e64114779976b99905e0d018e71c437cde750dc
podLaunchOptions:
image: proxy.replicated.com/anonymous/library/busybox@sha256:768e5c6f5cb6db0794eec98dc7a967f40631746c32232b78a3105fb946f3ab83
exclude: {{ .Values.isAirgap }}
analyzers:
- goldpinger:
exclude: {{ .Values.isAirgap }}
1 change: 1 addition & 0 deletions operator/charts/embedded-cluster-operator/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ embeddedClusterVersion: v0.0.0
embeddedClusterK0sVersion: v0.0.0
embeddedBinaryName: v0.0.0
embeddedClusterID: 123456789
isAirgap: false

image:
repository: replicated/embedded-cluster-operator-image-staging
Expand Down
1 change: 1 addition & 0 deletions operator/charts/embedded-cluster-operator/values.yaml.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ embeddedClusterVersion: v0.0.0
embeddedClusterK0sVersion: v0.0.0
embeddedBinaryName: v0.0.0
embeddedClusterID: 123456789
isAirgap: false

image:
repository: ${IMAGE_NAME}
Expand Down
22 changes: 19 additions & 3 deletions operator/pkg/charts/charts_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,22 @@ kotsVersion: 1.2.3-admin-console
utilsImage: abc-repo/ec-utils:latest-amd64@sha256:92dec6e167ff57b35953da389c2f62c8ed9e529fe8dac3c3621269c3a66291f0
`

const test_airgapOperatorValues = `embeddedBinaryName: test-binary-name
embeddedClusterID: e79f0701-67f3-4abf-a672-42a1f3ed231b
embeddedClusterK0sVersion: 0.0.0
embeddedClusterVersion: v1.2.3-operator
global:
labels:
replicated.com/disaster-recovery: infra
replicated.com/disaster-recovery-chart: embedded-cluster-operator
image:
repository: docker.io/replicated/embedded-cluster-operator-image
tag: latest-amd64@sha256:eeed01216b5d2192afbd90e2e1f70419a8758551d8708f9d4b4f50f41d106ce8
isAirgap: "true"
kotsVersion: 1.2.3-admin-console
utilsImage: abc-repo/ec-utils:latest-amd64@sha256:92dec6e167ff57b35953da389c2f62c8ed9e529fe8dac3c3621269c3a66291f0
`

const test_proxyOperatorValues = `embeddedBinaryName: test-binary-name
embeddedClusterID: e79f0701-67f3-4abf-a672-42a1f3ed231b
embeddedClusterK0sVersion: 0.0.0
Expand Down Expand Up @@ -749,7 +765,7 @@ func Test_generateHelmConfigs(t *testing.T) {
Name: "embedded-cluster-operator",
ChartName: "oci://proxy.replicated.com/anonymous/registry.replicated.com/library/embedded-cluster-operator",
Version: "1.2.3-operator",
Values: test_operatorValues,
Values: test_airgapOperatorValues,
TargetNS: "embedded-cluster",
ForceUpgrade: ptr.To(false),
Order: 103,
Expand Down Expand Up @@ -815,7 +831,7 @@ func Test_generateHelmConfigs(t *testing.T) {
Name: "embedded-cluster-operator",
ChartName: "oci://proxy.replicated.com/anonymous/registry.replicated.com/library/embedded-cluster-operator",
Version: "1.2.3-operator",
Values: test_operatorValues,
Values: test_airgapOperatorValues,
TargetNS: "embedded-cluster",
ForceUpgrade: ptr.To(false),
Order: 103,
Expand Down Expand Up @@ -881,7 +897,7 @@ func Test_generateHelmConfigs(t *testing.T) {
Name: "embedded-cluster-operator",
ChartName: "oci://proxy.replicated.com/anonymous/registry.replicated.com/library/embedded-cluster-operator",
Version: "1.2.3-operator",
Values: test_operatorValues,
Values: test_airgapOperatorValues,
TargetNS: "embedded-cluster",
ForceUpgrade: ptr.To(false),
Order: 103,
Expand Down
6 changes: 3 additions & 3 deletions operator/pkg/charts/reconcile_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1294,8 +1294,8 @@ func TestReconcileHelmCharts(t *testing.T) {
ObjectMeta: metav1.ObjectMeta{
Name: "embedded-cluster-operator",
},
Spec: k0shelmv1beta1.ChartSpec{ReleaseName: "embedded-cluster-operator", Values: test_operatorValues},
Status: k0shelmv1beta1.ChartStatus{Version: "1.2.3-operator", ValuesHash: k0shelmv1beta1.ChartSpec{ReleaseName: "embedded-cluster-operator", Values: test_operatorValues}.HashValues()},
Spec: k0shelmv1beta1.ChartSpec{ReleaseName: "embedded-cluster-operator", Values: test_airgapOperatorValues},
Status: k0shelmv1beta1.ChartStatus{Version: "1.2.3-operator", ValuesHash: k0shelmv1beta1.ChartSpec{ReleaseName: "embedded-cluster-operator", Values: test_airgapOperatorValues}.HashValues()},
},
&k0shelmv1beta1.Chart{
ObjectMeta: metav1.ObjectMeta{
Expand Down Expand Up @@ -1346,7 +1346,7 @@ func TestReconcileHelmCharts(t *testing.T) {
Name: "embedded-cluster-operator",
ChartName: "oci://proxy.replicated.com/anonymous/registry.replicated.com/library/embedded-cluster-operator",
Version: "1.2.3-operator",
Values: test_operatorValues,
Values: test_airgapOperatorValues,
TargetNS: "embedded-cluster",
ForceUpgrade: ptr.To(false),
Order: 103,
Expand Down
3 changes: 3 additions & 0 deletions pkg/addons/embeddedclusteroperator/embeddedclusteroperator.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,9 @@ func (e *EmbeddedClusterOperator) GenerateHelmConfig(provider *defaults.Provider
if !onlyDefaults {
helmValues["embeddedBinaryName"] = e.binaryName
helmValues["embeddedClusterID"] = metrics.ClusterID().String()
if e.airgap {
helmValues["isAirgap"] = "true"
}
if len(e.proxyEnv) > 0 {
extraEnv := []map[string]interface{}{}
for _, k := range []string{"HTTP_PROXY", "HTTPS_PROXY", "NO_PROXY"} {
Expand Down

0 comments on commit 37ceee7

Please sign in to comment.