Skip to content

Commit

Permalink
Revert storageclass checks for git server and seed registry
Browse files Browse the repository at this point in the history
  • Loading branch information
Lucas Rodriguez committed Feb 17, 2024
1 parent 0cc2328 commit 5b8288d
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 58 deletions.
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://github.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)
}

0 comments on commit 5b8288d

Please sign in to comment.