Skip to content

Commit 84b673e

Browse files
authored
fix: revert storageclass checks for git server and seed registry (#2311)
## Description #2180 introduced a bug and this PR removes the cause of the bug. Actions conditionals are being added to Zarf in #2276 to allow these sort of checks to account for various use cases in a more clean way. Also reopened #1824 ## Related Issue Relates to #2273 ## Type of change - [x] Bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Other (security config, docs update, etc) ## Checklist before merging - [x] Test, docs, adr added or updated as needed - [x] [Contributor Guide Steps](https://github.com/defenseunicorns/zarf/blob/main/CONTRIBUTING.md#developer-workflow) followed
1 parent 0cc2328 commit 84b673e

File tree

3 files changed

+0
-58
lines changed

3 files changed

+0
-58
lines changed

packages/gitea/zarf.yaml

-6
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,6 @@ components:
6666
actions:
6767
onDeploy:
6868
before:
69-
- description: Check that the cluster has the specified storage class
70-
maxTotalSeconds: 3
71-
wait:
72-
cluster:
73-
kind: storageclass
74-
name: "\"${ZARF_STORAGE_CLASS}\""
7569
- cmd: ./zarf internal update-gitea-pvc --no-progress
7670
setVariables:
7771
- name: GIT_SERVER_CREATE_PVC

packages/zarf-registry/zarf.yaml

-9
Original file line numberDiff line numberDiff line change
@@ -111,15 +111,6 @@ components:
111111
images:
112112
# The seed image (or images) that will be injected (see zarf-config.toml)
113113
- "###ZARF_PKG_TMPL_REGISTRY_IMAGE_DOMAIN######ZARF_PKG_TMPL_REGISTRY_IMAGE###:###ZARF_PKG_TMPL_REGISTRY_IMAGE_TAG###"
114-
actions:
115-
onDeploy:
116-
before:
117-
- description: Check that the cluster has the specified storage class
118-
maxTotalSeconds: 3
119-
wait:
120-
cluster:
121-
kind: storageclass
122-
name: "\"${ZARF_STORAGE_CLASS}\""
123114

124115
- name: zarf-registry
125116
description: |

src/test/e2e/20_zarf_init_test.go

-43
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import (
1212

1313
"encoding/json"
1414

15-
"github.com/defenseunicorns/zarf/src/pkg/utils"
1615
"github.com/defenseunicorns/zarf/src/types"
1716
"github.com/stretchr/testify/require"
1817
)
@@ -50,8 +49,6 @@ func TestZarfInit(t *testing.T) {
5049
require.Contains(t, stdErr, expectedErrorMessage)
5150
}
5251

53-
initWithoutStorageClass(t)
54-
5552
if !e2e.ApplianceMode {
5653
// throw a pending pod into the cluster to ensure we can properly ignore them when selecting images
5754
_, _, err := e2e.Kubectl("apply", "-f", "https://raw.githubusercontent.com/kubernetes/website/main/content/en/examples/pods/pod-with-node-affinity.yaml")
@@ -127,43 +124,3 @@ func checkLogForSensitiveState(t *testing.T, logText string, zarfState types.Zar
127124
require.NotContains(t, logText, zarfState.RegistryInfo.Secret)
128125
require.NotContains(t, logText, zarfState.LoggingSecret)
129126
}
130-
131-
// Verify `zarf init` produces an error when there is no storage class in cluster.
132-
func initWithoutStorageClass(t *testing.T) {
133-
/*
134-
Exit early if testing with Zarf-deployed k3s cluster.
135-
This is a chicken-egg problem because we can't interact with a cluster that Zarf hasn't created yet.
136-
Zarf deploys k3s with the Rancher local-path storage class out of the box,
137-
so we don't expect any problems with no storage class in this case.
138-
*/
139-
if e2e.ApplianceMode {
140-
return
141-
}
142-
143-
jsonPathQuery := `{range .items[?(@.metadata.annotations.storageclass\.kubernetes\.io/is-default-class=="true")]}{.metadata.name}{end}`
144-
defaultStorageClassName, _, err := e2e.Kubectl("get", "storageclass", "-o=jsonpath="+jsonPathQuery)
145-
require.NoError(t, err)
146-
require.NotEmpty(t, defaultStorageClassName)
147-
148-
storageClassYaml, _, err := e2e.Kubectl("get", "storageclass", defaultStorageClassName, "-o=yaml")
149-
require.NoError(t, err)
150-
151-
storageClassFileName := "storage-class.yaml"
152-
153-
err = utils.WriteFile(storageClassFileName, []byte(storageClassYaml))
154-
require.NoError(t, err)
155-
defer e2e.CleanFiles(storageClassFileName)
156-
157-
_, _, err = e2e.Kubectl("delete", "storageclass", defaultStorageClassName)
158-
require.NoError(t, err)
159-
160-
_, stdErr, err := e2e.Zarf("init", "--confirm")
161-
require.Error(t, err, stdErr)
162-
require.Contains(t, stdErr, "unable to run component before action: command \"Check that the cluster has the specified storage class\"")
163-
164-
_, _, err = e2e.Zarf("destroy", "--confirm")
165-
require.NoError(t, err)
166-
167-
_, _, err = e2e.Kubectl("apply", "-f", storageClassFileName)
168-
require.NoError(t, err)
169-
}

0 commit comments

Comments
 (0)