From da2799bee3932349ce1fb8c5163e6c9007cf17b5 Mon Sep 17 00:00:00 2001 From: Kostiantyn Kalynovskyi Date: Thu, 16 Apr 2020 19:31:38 -0500 Subject: [PATCH] Change bootstrap bundle entrypoint to phase dir Change-Id: I85151f42e510eb113bcc3bb86d56043d51bf348a Relates-To: #175 --- .../site/test-bootstrap/ephemeral/bootstrap/kustomization.yaml | 2 ++ manifests/site/test-bootstrap/ephemeral/kustomization.yaml | 2 -- pkg/bootstrap/isogen/command.go | 2 +- pkg/bootstrap/isogen/command_test.go | 2 +- .../test-site/ephemeral/{ => bootstrap}/kustomization.yaml | 0 .../site/test-site/ephemeral/{ => bootstrap}/secret.yaml | 0 pkg/cluster/initinfra/infra.go | 2 +- pkg/config/constants.go | 3 ++- pkg/remote/remote_direct.go | 2 +- .../site/test-site/ephemeral/{ => bootstrap}/baremetal.yaml | 0 .../test-site/ephemeral/{ => bootstrap}/kustomization.yaml | 0 .../site/test-site/ephemeral/{ => bootstrap}/baremetal.yaml | 0 .../test-site/ephemeral/{ => bootstrap}/kustomization.yaml | 0 13 files changed, 8 insertions(+), 7 deletions(-) create mode 100644 manifests/site/test-bootstrap/ephemeral/bootstrap/kustomization.yaml delete mode 100644 manifests/site/test-bootstrap/ephemeral/kustomization.yaml rename pkg/bootstrap/isogen/testdata/primary/site/test-site/ephemeral/{ => bootstrap}/kustomization.yaml (100%) rename pkg/bootstrap/isogen/testdata/primary/site/test-site/ephemeral/{ => bootstrap}/secret.yaml (100%) rename pkg/remote/testdata/base/manifests/site/test-site/ephemeral/{ => bootstrap}/baremetal.yaml (100%) rename pkg/remote/testdata/base/manifests/site/test-site/ephemeral/{ => bootstrap}/kustomization.yaml (100%) rename pkg/remote/testdata/emptyurl/manifests/site/test-site/ephemeral/{ => bootstrap}/baremetal.yaml (100%) rename pkg/remote/testdata/emptyurl/manifests/site/test-site/ephemeral/{ => bootstrap}/kustomization.yaml (100%) diff --git a/manifests/site/test-bootstrap/ephemeral/bootstrap/kustomization.yaml b/manifests/site/test-bootstrap/ephemeral/bootstrap/kustomization.yaml new file mode 100644 index 000000000..80844afc6 --- /dev/null +++ b/manifests/site/test-bootstrap/ephemeral/bootstrap/kustomization.yaml @@ -0,0 +1,2 @@ +resources: + - ../../../../type/test-bootstrap diff --git a/manifests/site/test-bootstrap/ephemeral/kustomization.yaml b/manifests/site/test-bootstrap/ephemeral/kustomization.yaml deleted file mode 100644 index 8572e662f..000000000 --- a/manifests/site/test-bootstrap/ephemeral/kustomization.yaml +++ /dev/null @@ -1,2 +0,0 @@ -resources: - - ../../../type/test-bootstrap diff --git a/pkg/bootstrap/isogen/command.go b/pkg/bootstrap/isogen/command.go index 124f06f8c..c471e545e 100644 --- a/pkg/bootstrap/isogen/command.go +++ b/pkg/bootstrap/isogen/command.go @@ -54,7 +54,7 @@ func GenerateBootstrapIso(settings *environment.AirshipCTLSettings) error { // TODO (dukov) replace with the appropriate function once it's available // in document module - root, err := globalConf.CurrentContextEntryPoint(config.Ephemeral, "") + root, err := globalConf.CurrentContextEntryPoint(config.Ephemeral, config.BootstrapPhase) if err != nil { return err } diff --git a/pkg/bootstrap/isogen/command_test.go b/pkg/bootstrap/isogen/command_test.go index 35bc6b843..881181879 100644 --- a/pkg/bootstrap/isogen/command_test.go +++ b/pkg/bootstrap/isogen/command_test.go @@ -59,7 +59,7 @@ func (mc *mockContainer) GetID() string { } func TestBootstrapIso(t *testing.T) { - bundle, err := document.NewBundleByPath("testdata/primary/site/test-site/ephemeral") + bundle, err := document.NewBundleByPath("testdata/primary/site/test-site/ephemeral/bootstrap") require.NoError(t, err, "Building Bundle Failed") tempVol, cleanup := testutil.TempDir(t, "bootstrap-test") diff --git a/pkg/bootstrap/isogen/testdata/primary/site/test-site/ephemeral/kustomization.yaml b/pkg/bootstrap/isogen/testdata/primary/site/test-site/ephemeral/bootstrap/kustomization.yaml similarity index 100% rename from pkg/bootstrap/isogen/testdata/primary/site/test-site/ephemeral/kustomization.yaml rename to pkg/bootstrap/isogen/testdata/primary/site/test-site/ephemeral/bootstrap/kustomization.yaml diff --git a/pkg/bootstrap/isogen/testdata/primary/site/test-site/ephemeral/secret.yaml b/pkg/bootstrap/isogen/testdata/primary/site/test-site/ephemeral/bootstrap/secret.yaml similarity index 100% rename from pkg/bootstrap/isogen/testdata/primary/site/test-site/ephemeral/secret.yaml rename to pkg/bootstrap/isogen/testdata/primary/site/test-site/ephemeral/bootstrap/secret.yaml diff --git a/pkg/cluster/initinfra/infra.go b/pkg/cluster/initinfra/infra.go index 0d187e8f7..6f4fb2819 100644 --- a/pkg/cluster/initinfra/infra.go +++ b/pkg/cluster/initinfra/infra.go @@ -69,7 +69,7 @@ func (infra *Infra) Deploy() error { return err } - kustomizePath, err := globalConf.CurrentContextEntryPoint(infra.ClusterType, config.Initinfra) + kustomizePath, err := globalConf.CurrentContextEntryPoint(infra.ClusterType, config.InitinfraPhase) if err != nil { return err } diff --git a/pkg/config/constants.go b/pkg/config/constants.go index 9695dc04e..2b30752ed 100644 --- a/pkg/config/constants.go +++ b/pkg/config/constants.go @@ -24,7 +24,8 @@ const ( // Constants related to Phases const ( - Initinfra = "initinfra" + InitinfraPhase = "initinfra" + BootstrapPhase = "bootstrap" ) // AllClusterTypes holds cluster types diff --git a/pkg/remote/remote_direct.go b/pkg/remote/remote_direct.go index a4166a1e0..2dc86eeb1 100644 --- a/pkg/remote/remote_direct.go +++ b/pkg/remote/remote_direct.go @@ -98,7 +98,7 @@ func (a *Adapter) initializeAdapter(settings *environment.AirshipCTLSettings) er return config.ErrMissingConfig{What: "RemoteDirect options not defined in bootstrap config"} } - bundlePath, err := cfg.CurrentContextEntryPoint(config.Ephemeral, "") + bundlePath, err := cfg.CurrentContextEntryPoint(config.Ephemeral, config.BootstrapPhase) if err != nil { return err } diff --git a/pkg/remote/testdata/base/manifests/site/test-site/ephemeral/baremetal.yaml b/pkg/remote/testdata/base/manifests/site/test-site/ephemeral/bootstrap/baremetal.yaml similarity index 100% rename from pkg/remote/testdata/base/manifests/site/test-site/ephemeral/baremetal.yaml rename to pkg/remote/testdata/base/manifests/site/test-site/ephemeral/bootstrap/baremetal.yaml diff --git a/pkg/remote/testdata/base/manifests/site/test-site/ephemeral/kustomization.yaml b/pkg/remote/testdata/base/manifests/site/test-site/ephemeral/bootstrap/kustomization.yaml similarity index 100% rename from pkg/remote/testdata/base/manifests/site/test-site/ephemeral/kustomization.yaml rename to pkg/remote/testdata/base/manifests/site/test-site/ephemeral/bootstrap/kustomization.yaml diff --git a/pkg/remote/testdata/emptyurl/manifests/site/test-site/ephemeral/baremetal.yaml b/pkg/remote/testdata/emptyurl/manifests/site/test-site/ephemeral/bootstrap/baremetal.yaml similarity index 100% rename from pkg/remote/testdata/emptyurl/manifests/site/test-site/ephemeral/baremetal.yaml rename to pkg/remote/testdata/emptyurl/manifests/site/test-site/ephemeral/bootstrap/baremetal.yaml diff --git a/pkg/remote/testdata/emptyurl/manifests/site/test-site/ephemeral/kustomization.yaml b/pkg/remote/testdata/emptyurl/manifests/site/test-site/ephemeral/bootstrap/kustomization.yaml similarity index 100% rename from pkg/remote/testdata/emptyurl/manifests/site/test-site/ephemeral/kustomization.yaml rename to pkg/remote/testdata/emptyurl/manifests/site/test-site/ephemeral/bootstrap/kustomization.yaml