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

fix: revert storageclass checks for git server and seed registry #2311

Merged
merged 1 commit into from
Feb 19, 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
6 changes: 0 additions & 6 deletions packages/gitea/zarf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,6 @@ components:
actions:
onDeploy:
before:
- description: Check that the cluster has the specified storage class
maxTotalSeconds: 3
wait:
cluster:
kind: storageclass
name: "\"${ZARF_STORAGE_CLASS}\""
- cmd: ./zarf internal update-gitea-pvc --no-progress
setVariables:
- name: GIT_SERVER_CREATE_PVC
Expand Down
9 changes: 0 additions & 9 deletions packages/zarf-registry/zarf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -111,15 +111,6 @@ components:
images:
# The seed image (or images) that will be injected (see zarf-config.toml)
- "###ZARF_PKG_TMPL_REGISTRY_IMAGE_DOMAIN######ZARF_PKG_TMPL_REGISTRY_IMAGE###:###ZARF_PKG_TMPL_REGISTRY_IMAGE_TAG###"
actions:
onDeploy:
before:
- description: Check that the cluster has the specified storage class
maxTotalSeconds: 3
wait:
cluster:
kind: storageclass
name: "\"${ZARF_STORAGE_CLASS}\""

- name: zarf-registry
description: |
Expand Down
43 changes: 0 additions & 43 deletions src/test/e2e/20_zarf_init_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import (

"encoding/json"

"github.com/defenseunicorns/zarf/src/pkg/utils"
"github.com/defenseunicorns/zarf/src/types"
"github.com/stretchr/testify/require"
)
Expand Down Expand Up @@ -50,8 +49,6 @@ func TestZarfInit(t *testing.T) {
require.Contains(t, stdErr, expectedErrorMessage)
}

initWithoutStorageClass(t)

if !e2e.ApplianceMode {
// throw a pending pod into the cluster to ensure we can properly ignore them when selecting images
_, _, err := e2e.Kubectl("apply", "-f", "https://raw.githubusercontent.com/kubernetes/website/main/content/en/examples/pods/pod-with-node-affinity.yaml")
Expand Down Expand Up @@ -127,43 +124,3 @@ func checkLogForSensitiveState(t *testing.T, logText string, zarfState types.Zar
require.NotContains(t, logText, zarfState.RegistryInfo.Secret)
require.NotContains(t, logText, zarfState.LoggingSecret)
}

// Verify `zarf init` produces an error when there is no storage class in cluster.
func initWithoutStorageClass(t *testing.T) {
/*
Exit early if testing with Zarf-deployed k3s cluster.
This is a chicken-egg problem because we can't interact with a cluster that Zarf hasn't created yet.
Zarf deploys k3s with the Rancher local-path storage class out of the box,
so we don't expect any problems with no storage class in this case.
*/
if e2e.ApplianceMode {
return
}

jsonPathQuery := `{range .items[?(@.metadata.annotations.storageclass\.kubernetes\.io/is-default-class=="true")]}{.metadata.name}{end}`
defaultStorageClassName, _, err := e2e.Kubectl("get", "storageclass", "-o=jsonpath="+jsonPathQuery)
require.NoError(t, err)
require.NotEmpty(t, defaultStorageClassName)

storageClassYaml, _, err := e2e.Kubectl("get", "storageclass", defaultStorageClassName, "-o=yaml")
require.NoError(t, err)

storageClassFileName := "storage-class.yaml"

err = utils.WriteFile(storageClassFileName, []byte(storageClassYaml))
require.NoError(t, err)
defer e2e.CleanFiles(storageClassFileName)

_, _, err = e2e.Kubectl("delete", "storageclass", defaultStorageClassName)
require.NoError(t, err)

_, stdErr, err := e2e.Zarf("init", "--confirm")
require.Error(t, err, stdErr)
require.Contains(t, stdErr, "unable to run component before action: command \"Check that the cluster has the specified storage class\"")

_, _, err = e2e.Zarf("destroy", "--confirm")
require.NoError(t, err)

_, _, err = e2e.Kubectl("apply", "-f", storageClassFileName)
require.NoError(t, err)
}
Loading