commit 0c870e5244a551fe68fb50fa7c8b399a1019057f Author: Ruslan Aliev Date: Wed Oct 7 22:26:54 2020 -0500 Remove clustertype-related functions We don't use clustertype anymore, so all the related functions must be deleted or adjusted as well as appropriate config fields. Change-Id: I3931fdc71d4318e916f8bbc2d94e062c9df5f641 Signed-off-by: Ruslan Aliev Relates-To: #349 diff --git a/cmd/config/get_context.go b/cmd/config/get_context.go index 0240306..a1497e4 100644 --- a/cmd/config/get_context.go +++ b/cmd/config/get_context.go @@ -63,7 +63,7 @@ func NewGetContextCommand(cfgFactory config.Factory) *cobra.Command { fmt.Fprintln(cmd.OutOrStdout(), "No Contexts found in the configuration.") } for _, context := range contexts { - fmt.Fprintln(cmd.OutOrStdout(), context.PrettyString()) + fmt.Fprintln(cmd.OutOrStdout(), context.String()) } return nil } @@ -76,7 +76,7 @@ func NewGetContextCommand(cfgFactory config.Factory) *cobra.Command { if err != nil { return err } - fmt.Fprintln(cmd.OutOrStdout(), context.PrettyString()) + fmt.Fprintln(cmd.OutOrStdout(), context.String()) return nil }, } diff --git a/cmd/config/set_context.go b/cmd/config/set_context.go index 6e6e9b2..e4ec0fa 100644 --- a/cmd/config/set_context.go +++ b/cmd/config/set_context.go @@ -98,12 +98,6 @@ func addSetContextFlags(o *config.ContextOptions, cmd *cobra.Command) { "", "set the encryption config for the specified context") - flags.StringVar( - &o.ClusterType, - "cluster-type", - "", - "set the cluster-type for the specified context") - flags.BoolVar( &o.Current, "current", diff --git a/cmd/config/set_context_test.go b/cmd/config/set_context_test.go index 8b6715b..fb67763 100644 --- a/cmd/config/set_context_test.go +++ b/cmd/config/set_context_test.go @@ -81,7 +81,6 @@ func TestSetContext(t *testing.T) { testName: "set-context", contextName: "dummycontext", flags: []string{ - "--cluster-type=target", "--manifest=" + defaultManifest, "--encryption-config=" + testEncryptionConfig, }, diff --git a/cmd/config/testdata/TestConfigSetContextGoldenOutput/config-cmd-set-context-too-many-args.golden b/cmd/config/testdata/TestConfigSetContextGoldenOutput/config-cmd-set-context-too-many-args.golden index e3c5d29..28edef1 100644 --- a/cmd/config/testdata/TestConfigSetContextGoldenOutput/config-cmd-set-context-too-many-args.golden +++ b/cmd/config/testdata/TestConfigSetContextGoldenOutput/config-cmd-set-context-too-many-args.golden @@ -16,7 +16,6 @@ airshipctl config set-context \ Flags: - --cluster-type string set the cluster-type for the specified context --current update the current context --encryption-config string set the encryption config for the specified context -h, --help help for set-context diff --git a/cmd/config/testdata/TestConfigSetContextGoldenOutput/config-cmd-set-context-with-help.golden b/cmd/config/testdata/TestConfigSetContextGoldenOutput/config-cmd-set-context-with-help.golden index 2da37a7..4927ca1 100644 --- a/cmd/config/testdata/TestConfigSetContextGoldenOutput/config-cmd-set-context-with-help.golden +++ b/cmd/config/testdata/TestConfigSetContextGoldenOutput/config-cmd-set-context-with-help.golden @@ -17,7 +17,6 @@ airshipctl config set-context \ Flags: - --cluster-type string set the cluster-type for the specified context --current update the current context --encryption-config string set the encryption config for the specified context -h, --help help for set-context diff --git a/cmd/config/testdata/TestGetContextCmdGoldenOutput/get-all-contexts.golden b/cmd/config/testdata/TestGetContextCmdGoldenOutput/get-all-contexts.golden index 0977b5e..1b9bd3d 100644 --- a/cmd/config/testdata/TestGetContextCmdGoldenOutput/get-all-contexts.golden +++ b/cmd/config/testdata/TestGetContextCmdGoldenOutput/get-all-contexts.golden @@ -1,18 +1,12 @@ -Context: ContextBar contextKubeconf: ContextBar_ephemeral managementConfiguration: "" manifest: Manifest_ContextBar - -Context: ContextBaz contextKubeconf: ContextBaz_ephemeral managementConfiguration: "" manifest: Manifest_ContextBaz - -Context: ContextFoo contextKubeconf: ContextFoo_ephemeral managementConfiguration: "" manifest: Manifest_ContextFoo - diff --git a/cmd/config/testdata/TestGetContextCmdGoldenOutput/get-context.golden b/cmd/config/testdata/TestGetContextCmdGoldenOutput/get-context.golden index 693d927..eb4c504 100644 --- a/cmd/config/testdata/TestGetContextCmdGoldenOutput/get-context.golden +++ b/cmd/config/testdata/TestGetContextCmdGoldenOutput/get-context.golden @@ -1,6 +1,4 @@ -Context: ContextFoo contextKubeconf: ContextFoo_ephemeral managementConfiguration: "" manifest: Manifest_ContextFoo - diff --git a/cmd/config/testdata/TestGetContextCmdGoldenOutput/get-current-context.golden b/cmd/config/testdata/TestGetContextCmdGoldenOutput/get-current-context.golden index 8d46094..85adf30 100644 --- a/cmd/config/testdata/TestGetContextCmdGoldenOutput/get-current-context.golden +++ b/cmd/config/testdata/TestGetContextCmdGoldenOutput/get-current-context.golden @@ -1,6 +1,4 @@ -Context: ContextBaz contextKubeconf: ContextBaz_ephemeral managementConfiguration: "" manifest: Manifest_ContextBaz - diff --git a/cmd/config/testdata/TestGetContextCmdGoldenOutput/get-multiple-contexts.golden b/cmd/config/testdata/TestGetContextCmdGoldenOutput/get-multiple-contexts.golden index 0977b5e..1b9bd3d 100644 --- a/cmd/config/testdata/TestGetContextCmdGoldenOutput/get-multiple-contexts.golden +++ b/cmd/config/testdata/TestGetContextCmdGoldenOutput/get-multiple-contexts.golden @@ -1,18 +1,12 @@ -Context: ContextBar contextKubeconf: ContextBar_ephemeral managementConfiguration: "" manifest: Manifest_ContextBar - -Context: ContextBaz contextKubeconf: ContextBaz_ephemeral managementConfiguration: "" manifest: Manifest_ContextBaz - -Context: ContextFoo contextKubeconf: ContextFoo_ephemeral managementConfiguration: "" manifest: Manifest_ContextFoo - diff --git a/docs/azure/azure-integration.md b/docs/azure/azure-integration.md index 1d1c440..4ea7d3e 100644 --- a/docs/azure/azure-integration.md +++ b/docs/azure/azure-integration.md @@ -137,36 +137,6 @@ az-target-cluster-md-0-z5lff Ready 17h v1.18.2 ```yaml apiVersion: airshipit.org/v1alpha1 -bootstrapInfo: - azure_bootstrap_config: - builder: - networkConfigFileName: network-config - outputMetadataFileName: output-metadata.yaml - userDataFileName: user-data - container: - containerRuntime: docker - image: quay.io/airshipit/isogen:latest-debian_stable - volume: /srv/iso:/config - remoteDirect: - isoUrl: http://localhost:8099/debian-custom.iso - default: - builder: - networkConfigFileName: network-config - outputMetadataFileName: output-metadata.yaml - userDataFileName: user-data - container: - containerRuntime: docker - image: quay.io/airshipit/isogen:latest-debian_stable - volume: /srv/iso:/config - remoteDirect: - isoUrl: http://localhost:8099/debian-custom.iso -clusters: - az-target-cluster: - clusterType: - target: - bootstrapInfo: default - clusterKubeconf: az-target-cluster_target - managementConfiguration: default contexts: az-target-cluster-admin@az-target-cluster: contextKubeconf: az-target-cluster_target @@ -208,6 +178,4 @@ manifests: url: https://opendev.org/airship/treasuremap subPath: treasuremap/manifests/site targetPath: /tmp/default -users: - az-target-cluster-admin: {} ``` \ No newline at end of file diff --git a/docs/source/cli/airshipctl_config_set-context.md b/docs/source/cli/airshipctl_config_set-context.md index f7d31eb..06ecf64 100644 --- a/docs/source/cli/airshipctl_config_set-context.md +++ b/docs/source/cli/airshipctl_config_set-context.md @@ -30,7 +30,6 @@ airshipctl config set-context \ ### Options ``` - --cluster-type string set the cluster-type for the specified context --current update the current context --encryption-config string set the encryption config for the specified context -h, --help help for set-context diff --git a/docs/source/cli/airshipctl_secret_decrypt.md b/docs/source/cli/airshipctl_secret_decrypt.md index c0e9934..0502566 100644 --- a/docs/source/cli/airshipctl_secret_decrypt.md +++ b/docs/source/cli/airshipctl_secret_decrypt.md @@ -37,7 +37,6 @@ airshipctl secret decrypt \ ``` --airshipconf string Path to file for airshipctl configuration. (default "$HOME/.airship/config") --debug enable verbose output - --kubeconfig string Path to kubeconfig associated with airshipctl configuration. (default "$HOME/.airship/kubeconfig") ``` ### SEE ALSO diff --git a/docs/source/cli/airshipctl_secret_encrypt.md b/docs/source/cli/airshipctl_secret_encrypt.md index 28a92b6..e6b2e3b 100644 --- a/docs/source/cli/airshipctl_secret_encrypt.md +++ b/docs/source/cli/airshipctl_secret_encrypt.md @@ -37,7 +37,6 @@ airshipctl secret encrypt \ ``` --airshipconf string Path to file for airshipctl configuration. (default "$HOME/.airship/config") --debug enable verbose output - --kubeconfig string Path to kubeconfig associated with airshipctl configuration. (default "$HOME/.airship/kubeconfig") ``` ### SEE ALSO diff --git a/pkg/clusterctl/cmd/command.go b/pkg/clusterctl/cmd/command.go index d749ff7..0ec1f95 100644 --- a/pkg/clusterctl/cmd/command.go +++ b/pkg/clusterctl/cmd/command.go @@ -20,6 +20,7 @@ import ( "opendev.org/airship/airshipctl/pkg/config" "opendev.org/airship/airshipctl/pkg/document" "opendev.org/airship/airshipctl/pkg/log" + "opendev.org/airship/airshipctl/pkg/phase" ) // Command adds a layer to clusterctl interface with airshipctl context @@ -89,11 +90,11 @@ func clusterctlOptions(bundle document.Bundle) (*airshipv1.Clusterctl, error) { } func getBundle(conf *config.Config) (document.Bundle, error) { - path, err := conf.CurrentContextEntryPoint(config.ClusterctlPhase) + helper, err := phase.NewHelper(conf) if err != nil { return nil, err } - return document.NewBundleByPath(path) + return document.NewBundleByPath(helper.PhaseRoot()) } // Move runs clusterctl move diff --git a/pkg/clusterctl/cmd/command_test.go b/pkg/clusterctl/cmd/command_test.go index 9ff3824..0e913b9 100644 --- a/pkg/clusterctl/cmd/command_test.go +++ b/pkg/clusterctl/cmd/command_test.go @@ -48,6 +48,7 @@ func TestNewCommand(t *testing.T) { TargetPath: "testdata", SubPath: "valid", PhaseRepositoryName: "primary", + MetadataPath: "metadata.yaml", Repositories: map[string]*config.Repository{ "primary": {}, }, diff --git a/pkg/clusterctl/cmd/testdata/metadata.yaml b/pkg/clusterctl/cmd/testdata/metadata.yaml new file mode 100755 index 0000000..220af9c --- /dev/null +++ b/pkg/clusterctl/cmd/testdata/metadata.yaml @@ -0,0 +1,2 @@ +phase: + path: phases \ No newline at end of file diff --git a/pkg/clusterctl/cmd/testdata/phases/cluster-map.yaml b/pkg/clusterctl/cmd/testdata/phases/cluster-map.yaml new file mode 100755 index 0000000..d53fe7e --- /dev/null +++ b/pkg/clusterctl/cmd/testdata/phases/cluster-map.yaml @@ -0,0 +1,11 @@ +--- +apiVersion: airshipit.org/v1alpha1 +kind: ClusterMap +metadata: + labels: + airshipit.org/deploy-k8s: "false" + name: main-map +map: + target-cluster: + parent: ephemeral-cluster + ephemeral-cluster: {} \ No newline at end of file diff --git a/pkg/clusterctl/cmd/testdata/phases/executors.yaml b/pkg/clusterctl/cmd/testdata/phases/executors.yaml new file mode 100755 index 0000000..3759b36 --- /dev/null +++ b/pkg/clusterctl/cmd/testdata/phases/executors.yaml @@ -0,0 +1,6 @@ +--- +apiVersion: airshipit.org/v1alpha1 +kind: Clusterctl +metadata: + name: clusterctl_init +action: init diff --git a/pkg/clusterctl/cmd/testdata/phases/kustomization.yaml b/pkg/clusterctl/cmd/testdata/phases/kustomization.yaml new file mode 100755 index 0000000..7d5a694 --- /dev/null +++ b/pkg/clusterctl/cmd/testdata/phases/kustomization.yaml @@ -0,0 +1,4 @@ +resources: + - phases.yaml + - executors.yaml + - cluster-map.yaml \ No newline at end of file diff --git a/pkg/clusterctl/cmd/testdata/phases/phases.yaml b/pkg/clusterctl/cmd/testdata/phases/phases.yaml new file mode 100755 index 0000000..a4f810c --- /dev/null +++ b/pkg/clusterctl/cmd/testdata/phases/phases.yaml @@ -0,0 +1,12 @@ +--- +apiVersion: airshipit.org/v1alpha1 +kind: Phase +metadata: + name: phase + clusterName: ephemeral-cluster +config: + executorRef: + apiVersion: airshipit.org/v1alpha1 + kind: KubernetesApply + name: kubernetes-apply + documentEntryPoint: ephemeral/initinfra diff --git a/pkg/config/config.go b/pkg/config/config.go index 1e187c4..92ef319 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -18,7 +18,6 @@ import ( "fmt" "io/ioutil" "os" - "path" "path/filepath" "sort" @@ -285,7 +284,6 @@ func (c *Config) AddContext(theContext *ContextOptions) *Context { // Ok , I have initialized structs for the Context information // We can use Modify to populate the correct information c.ModifyContext(nContext, theContext) - nContext.ClusterType() return nContext } @@ -304,9 +302,6 @@ func (c *Config) ModifyContext(context *Context, theContext *ContextOptions) { // GetCurrentContext methods Returns the appropriate information for the current context // Current Context holds labels for the appropriate config objects -// ClusterType is the name of the clustertype for this context, it should be a flag we pass to it?? -// Manifest is the default manifest to be use with this context -// Purpose for this method is simplifying the current context information func (c *Config) GetCurrentContext() (*Context, error) { currentContext, err := c.GetContext(c.CurrentContext) if err != nil { @@ -326,29 +321,6 @@ func (c *Config) CurrentContextManifest() (*Manifest, error) { return c.Manifests[currentContext.Manifest], nil } -// CurrentContextEntryPoint returns path to build bundle based on clusterType and phase -// example CurrentContextEntryPoint("ephemeral", "initinfra") -func (c *Config) CurrentContextEntryPoint(phase string) (string, error) { - clusterType, err := c.CurrentContextClusterType() - if err != nil { - return "", err - } - - ccm, err := c.CurrentContextManifest() - if err != nil { - return "", err - } - _, exists := ccm.Repositories[ccm.PhaseRepositoryName] - if !exists { - return "", ErrMissingPhaseRepo{} - } - epp := path.Join(ccm.TargetPath, ccm.SubPath, clusterType, phase) - if _, err := os.Stat(epp); err != nil { - return "", ErrMissingPhaseDocument{PhaseName: phase} - } - return epp, nil -} - // CurrentContextTargetPath returns target path from current context's manifest func (c *Config) CurrentContextTargetPath() (string, error) { ccm, err := c.CurrentContextManifest() @@ -372,24 +344,6 @@ func (c *Config) CurrentContextPhaseRepositoryDir() (string, error) { return util.GitDirNameFromURL(repo.URL()), nil } -// CurrentContextClusterType returns cluster type of current context -func (c *Config) CurrentContextClusterType() (string, error) { - context, err := c.GetCurrentContext() - if err != nil { - return "", err - } - return context.ClusterType(), nil -} - -// CurrentContextClusterName returns cluster name of current context -func (c *Config) CurrentContextClusterName() (string, error) { - context, err := c.GetCurrentContext() - if err != nil { - return "", err - } - return context.ClusterName(), nil -} - // GetManifests returns all of the Manifests associated with the Config sorted by name func (c *Config) GetManifests() []*Manifest { keys := make([]string, 0, len(c.Manifests)) diff --git a/pkg/config/config_test.go b/pkg/config/config_test.go index 51a69d3..93bf746 100644 --- a/pkg/config/config_test.go +++ b/pkg/config/config_test.go @@ -337,50 +337,6 @@ func TestCurrentPhaseRepositoryDir(t *testing.T) { assert.Equal(t, "", phaseRepoDir) } -func TestCurrentContextEntryPoint(t *testing.T) { - conf, cleanup := testutil.InitConfig(t) - defer cleanup(t) - - entryPoint, err := conf.CurrentContextEntryPoint(defaultString) - require.Error(t, err) - assert.Equal(t, "", entryPoint) - - conf.CurrentContext = currentContextName - conf.Contexts[currentContextName].Manifest = defaultString - - entryPoint, err = conf.CurrentContextEntryPoint(defaultString) - assert.Equal(t, config.ErrMissingPhaseDocument{PhaseName: defaultString}, err) - assert.Nil(t, nil, entryPoint) -} - -func TestCurrentContextClusterType(t *testing.T) { - conf, cleanup := testutil.InitConfig(t) - defer cleanup(t) - - expectedClusterType := "ephemeral" - - conf.CurrentContext = currentContextName - conf.Contexts[currentContextName].Manifest = defaultString - - actualClusterType, err := conf.CurrentContextClusterType() - require.NoError(t, err) - assert.Equal(t, expectedClusterType, actualClusterType) -} - -func TestCurrentContextClusterName(t *testing.T) { - conf, cleanup := testutil.InitConfig(t) - defer cleanup(t) - - expectedClusterName := "def" - - conf.CurrentContext = currentContextName - conf.Contexts[currentContextName].Manifest = defaultString - - actualClusterName, err := conf.CurrentContextClusterName() - require.NoError(t, err) - assert.Equal(t, expectedClusterName, actualClusterName) -} - func TestCurrentContextManifestMetadata(t *testing.T) { expectedMeta := &config.Metadata{ Inventory: &config.InventoryMeta{ @@ -469,49 +425,6 @@ func TestCurrentContextManifestMetadata(t *testing.T) { } } -func TestNewClusterComplexNameFromKubeClusterName(t *testing.T) { - tests := []struct { - name string - inputName string - expectedName string - expectedType string - }{ - { - name: "single-word", - inputName: "myCluster", - expectedName: "myCluster", - expectedType: config.AirshipDefaultClusterType, - }, - { - name: "multi-word", - inputName: "myCluster_two", - expectedName: "myCluster_two", - expectedType: config.AirshipDefaultClusterType, - }, - { - name: "cluster-appended", - inputName: "myCluster_ephemeral", - expectedName: "myCluster", - expectedType: config.Ephemeral, - }, - { - name: "multi-word-cluster-appended", - inputName: "myCluster_two_ephemeral", - expectedName: "myCluster_two", - expectedType: config.Ephemeral, - }, - } - - for _, tt := range tests { - tt := tt - t.Run(tt.name, func(t *testing.T) { - complexName := config.NewClusterComplexNameFromKubeClusterName(tt.inputName) - assert.Equal(t, tt.expectedName, complexName.Name) - assert.Equal(t, tt.expectedType, complexName.Type) - }) - } -} - func TestManagementConfigurationByName(t *testing.T) { conf, cleanupConfig := testutil.InitConfig(t) defer cleanupConfig(t) diff --git a/pkg/config/constants.go b/pkg/config/constants.go index ae9e2d2..95845c4 100644 --- a/pkg/config/constants.go +++ b/pkg/config/constants.go @@ -16,24 +16,14 @@ package config import "opendev.org/airship/airshipctl/pkg/remote/redfish" -// Constants related to the ClusterType type -const ( - Ephemeral = "ephemeral" - Target = "target" - AirshipClusterNameSeparator = "_" - AirshipDefaultClusterType = Target -) - // Constants related to Phases const ( + Ephemeral = "ephemeral" InitinfraPhase = "initinfra" ClusterctlPhase = InitinfraPhase BootstrapPhase = "bootstrap" ) -// AllClusterTypes holds cluster types -var AllClusterTypes = [2]string{Ephemeral, Target} - // Constants defining default values const ( AirshipConfig = "config" @@ -50,8 +40,6 @@ const ( AirshipDefaultManifest = "default" AirshipDefaultManifestRepo = "treasuremap" AirshipDefaultManifestRepoLocation = "https://opendev.org/airship/" + AirshipDefaultManifestRepo - AirshipKubeConfig = "kubeconfig" - AirshipKubeConfigEnv = "AIRSHIP_KUBECONFIG" AirshipPluginPath = "kustomize-plugins" AirshipPluginPathEnv = "AIRSHIP_KUSTOMIZE_PLUGINS" diff --git a/pkg/config/context.go b/pkg/config/context.go index 6e7e564..b985984 100644 --- a/pkg/config/context.go +++ b/pkg/config/context.go @@ -15,9 +15,6 @@ limitations under the License. package config import ( - "fmt" - "strings" - "sigs.k8s.io/yaml" ) @@ -49,66 +46,3 @@ func (c *Context) String() string { } return string(cyaml) } - -// PrettyString returns cluster name in a formatted string -func (c *Context) PrettyString() string { - clusterName := NewClusterComplexNameFromKubeClusterName(c.NameInKubeconf) - return fmt.Sprintf("Context: %s\n%s\n", clusterName.Name, c) -} - -// ClusterType returns cluster type by extracting the type portion from -// the complex cluster name -func (c *Context) ClusterType() string { - return NewClusterComplexNameFromKubeClusterName(c.NameInKubeconf).Type -} - -// ClusterName returns cluster name by extracting the name portion from -// the complex cluster name -func (c *Context) ClusterName() string { - return NewClusterComplexNameFromKubeClusterName(c.NameInKubeconf).Name -} - -// ClusterComplexName holds the complex cluster name information -// Encapsulates the different operations around using it. -type ClusterComplexName struct { - Name string - Type string -} - -// NewClusterComplexName returns a ClusterComplexName with the given name and type. -func NewClusterComplexName(clusterName, clusterType string) ClusterComplexName { - return ClusterComplexName{ - Name: clusterName, - Type: clusterType, - } -} - -// NewClusterComplexNameFromKubeClusterName takes the name of a cluster in a -// format which might be found in a kubeconfig file. This may be a simple -// string (e.g. myCluster), or it may be prepended with the type of the cluster -// (e.g. myCluster_target) -// -// If a valid cluster type was appended, the returned ClusterComplexName will -// have that type. If no cluster type is provided, the -// AirshipDefaultClusterType will be used. -func NewClusterComplexNameFromKubeClusterName(kubeClusterName string) ClusterComplexName { - parts := strings.Split(kubeClusterName, AirshipClusterNameSeparator) - - if len(parts) == 1 { - return NewClusterComplexName(kubeClusterName, AirshipDefaultClusterType) - } - - // kubeClusterName matches the format myCluster_something. - // Let's check if "something" is a clusterType. - potentialType := parts[len(parts)-1] - for _, ct := range AllClusterTypes { - if potentialType == ct { - // Rejoin the parts in the case of "my_cluster_etc_etc_" - name := strings.Join(parts[:len(parts)-1], AirshipClusterNameSeparator) - return NewClusterComplexName(name, potentialType) - } - } - - // "something" is not a valid clusterType, so just use the default - return NewClusterComplexName(kubeClusterName, AirshipDefaultClusterType) -} diff --git a/pkg/config/options.go b/pkg/config/options.go index 637e29d..8b84adf 100644 --- a/pkg/config/options.go +++ b/pkg/config/options.go @@ -23,7 +23,6 @@ import ( // ContextOptions holds all configurable options for context type ContextOptions struct { Name string - ClusterType string CurrentContext bool Manifest string Current bool diff --git a/pkg/config/options_test.go b/pkg/config/options_test.go index 0a19670..f041725 100644 --- a/pkg/config/options_test.go +++ b/pkg/config/options_test.go @@ -50,14 +50,6 @@ func TestContextOptionsValidate(t *testing.T) { }, expectError: false, }, - { - name: "ValidClusterType", - testOptions: config.ContextOptions{ - Name: "testContext", - ClusterType: "target", - }, - expectError: false, - }, } for _, tt := range tests { diff --git a/pkg/document/bundle.go b/pkg/document/bundle.go index 7cb1c8d..337b0d6 100644 --- a/pkg/document/bundle.go +++ b/pkg/document/bundle.go @@ -70,8 +70,8 @@ var pluginPathLock = &sync.Mutex{} // instead of inplace, useful, when you don't know if bundle will be needed or not, see phase for detail type BundleFactoryFunc func() (Bundle, error) -// NewBundleByPath helper function that returns new document.Bundle interface based on clusterType and -// phase, example: helpers.NewBunde(airConfig, "ephemeral", "initinfra") +// NewBundleByPath is a function which builds new document.Bundle from kustomize rootPath using default FS object +// example: document.NewBundleByPath("path/to/phase-root") func NewBundleByPath(rootPath string) (Bundle, error) { return NewBundle(NewDocumentFs(), rootPath) } diff --git a/tools/deployment/templates/azure_airshipconfig_template b/tools/deployment/templates/azure_airshipconfig_template index 9f36567..e720efa 100644 --- a/tools/deployment/templates/azure_airshipconfig_template +++ b/tools/deployment/templates/azure_airshipconfig_template @@ -1,11 +1,4 @@ apiVersion: airshipit.org/v1alpha1 -clusters: - kind-capi-azure: - clusterType: - target: - bootstrapInfo: default - clusterKubeconf: kind-capi-azure_target - managementConfiguration: default contexts: kind-capi-azure: contextKubeconf: kind-capi-azure_target