diff --git a/cmd/cluster/cluster.go b/cmd/cluster/cluster.go index 23e6146d3..04b68a6d7 100644 --- a/cmd/cluster/cluster.go +++ b/cmd/cluster/cluster.go @@ -43,7 +43,6 @@ func NewClusterCommand(rootSettings *environment.AirshipCTLSettings) *cobra.Comm }, } - clusterRootCmd.AddCommand(NewInitInfraCommand(rootSettings)) clusterRootCmd.AddCommand(NewInitCommand(rootSettings)) return clusterRootCmd diff --git a/cmd/cluster/initinfra.go b/cmd/cluster/initinfra.go deleted file mode 100644 index ee51c1528..000000000 --- a/cmd/cluster/initinfra.go +++ /dev/null @@ -1,75 +0,0 @@ -/* -Copyright 2014 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package cluster - -import ( - "github.com/spf13/cobra" - - "opendev.org/airship/airshipctl/pkg/cluster/initinfra" - "opendev.org/airship/airshipctl/pkg/environment" -) - -const ( - // TODO add labels in description, when we have them designed - initInfraLong = ` -Deploy initial infrastructure to kubernetes cluster such as -metal3.io, argo, tiller and other manifest documents with appropriate labels -` - initInfraExample = ` -# Deploy infrastructure to a cluster -airshipctl cluster initinfra -` -) - -// NewInitInfraCommand creates a command to deploy initial airship infrastructure. -func NewInitInfraCommand(rootSettings *environment.AirshipCTLSettings) *cobra.Command { - i := initinfra.NewInfra(rootSettings) - initinfraCmd := &cobra.Command{ - Use: "initinfra", - Short: "Deploy initinfra components to cluster", - Long: initInfraLong[1:], - Example: initInfraExample, - RunE: func(cmd *cobra.Command, args []string) error { - return i.Run() - }, - } - addInitinfraFlags(i, initinfraCmd) - return initinfraCmd -} - -func addInitinfraFlags(i *initinfra.Infra, cmd *cobra.Command) { - flags := cmd.Flags() - flags.BoolVar( - &i.DryRun, - "dry-run", - false, - "don't deliver documents to the cluster, simulate the changes instead") - - flags.BoolVar( - &i.Prune, - "prune", - false, - `if set to true, command will delete all kubernetes resources that are not`+ - ` defined in airship documents and have airshipit.org/deployed=initinfra label`) - - flags.StringVar( - &i.ClusterType, - "cluster-type", - "ephemeral", - `select cluster type to deploy initial infrastructure to;`+ - ` currently only ephemeral is supported`) -} diff --git a/cmd/cluster/initinfra_test.go b/cmd/cluster/initinfra_test.go deleted file mode 100644 index d13371d29..000000000 --- a/cmd/cluster/initinfra_test.go +++ /dev/null @@ -1,42 +0,0 @@ -/* - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - https://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -*/ - -package cluster_test - -import ( - "testing" - - "opendev.org/airship/airshipctl/cmd/cluster" - "opendev.org/airship/airshipctl/pkg/environment" - "opendev.org/airship/airshipctl/testutil" -) - -func TestNewInitInfraCommand(t *testing.T) { - fakeRootSettings := &environment.AirshipCTLSettings{ - AirshipConfigPath: "../../testdata/k8s/config.yaml", - KubeConfigPath: "../../testdata/k8s/kubeconfig.yaml", - } - fakeRootSettings.InitConfig() - - tests := []*testutil.CmdTest{ - { - Name: "cluster-initinfra-cmd-with-help", - CmdLine: "--help", - Cmd: cluster.NewInitInfraCommand(fakeRootSettings), - }, - } - for _, testcase := range tests { - testutil.RunTest(t, testcase) - } -} diff --git a/cmd/cluster/testdata/TestNewClusterCommandGoldenOutput/cluster-cmd-with-help.golden b/cmd/cluster/testdata/TestNewClusterCommandGoldenOutput/cluster-cmd-with-help.golden index 23e5a1173..efca6c53b 100644 --- a/cmd/cluster/testdata/TestNewClusterCommandGoldenOutput/cluster-cmd-with-help.golden +++ b/cmd/cluster/testdata/TestNewClusterCommandGoldenOutput/cluster-cmd-with-help.golden @@ -7,7 +7,6 @@ Usage: Available Commands: help Help about any command init Deploy cluster-api provider components - initinfra Deploy initinfra components to cluster Flags: -h, --help help for cluster diff --git a/cmd/cluster/testdata/TestNewInitInfraCommandGoldenOutput/cluster-initinfra-cmd-with-help.golden b/cmd/cluster/testdata/TestNewInitInfraCommandGoldenOutput/cluster-initinfra-cmd-with-help.golden deleted file mode 100644 index b084368a9..000000000 --- a/cmd/cluster/testdata/TestNewInitInfraCommandGoldenOutput/cluster-initinfra-cmd-with-help.golden +++ /dev/null @@ -1,17 +0,0 @@ -Deploy initial infrastructure to kubernetes cluster such as -metal3.io, argo, tiller and other manifest documents with appropriate labels - -Usage: - initinfra [flags] - -Examples: - -# Deploy infrastructure to a cluster -airshipctl cluster initinfra - - -Flags: - --cluster-type string select cluster type to deploy initial infrastructure to; currently only ephemeral is supported (default "ephemeral") - --dry-run don't deliver documents to the cluster, simulate the changes instead - -h, --help help for initinfra - --prune if set to true, command will delete all kubernetes resources that are not defined in airship documents and have airshipit.org/deployed=initinfra label diff --git a/pkg/cluster/initinfra/infra.go b/pkg/cluster/initinfra/infra.go deleted file mode 100644 index 804f6d560..000000000 --- a/pkg/cluster/initinfra/infra.go +++ /dev/null @@ -1,92 +0,0 @@ -/* - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - https://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -*/ - -package initinfra - -import ( - "opendev.org/airship/airshipctl/pkg/config" - "opendev.org/airship/airshipctl/pkg/document" - "opendev.org/airship/airshipctl/pkg/environment" - "opendev.org/airship/airshipctl/pkg/k8s/client" -) - -// Infra is an abstraction used to initialize base infrastructure -type Infra struct { - FileSystem document.FileSystem - RootSettings *environment.AirshipCTLSettings - Client client.Interface - - DryRun bool - Prune bool - ClusterType string -} - -// NewInfra return instance of Infra -func NewInfra(rs *environment.AirshipCTLSettings) *Infra { - // At this point AirshipCTLSettings may not be fully initialized - infra := &Infra{RootSettings: rs} - return infra -} - -// Run intinfra subcommand logic -func (infra *Infra) Run() error { - infra.FileSystem = document.NewDocumentFs() - var err error - infra.Client, err = client.NewClient(infra.RootSettings) - if err != nil { - return err - } - return infra.Deploy() -} - -// Deploy method deploys documents -func (infra *Infra) Deploy() error { - kctl := infra.Client.Kubectl() - ao, err := kctl.ApplyOptions() - if err != nil { - return err - } - - ao.SetDryRun(infra.DryRun) - // If prune is true, set selector for purning - if infra.Prune { - ao.SetPrune(document.ApplyPhaseSelector + "initinfra") - } - - globalConf := infra.RootSettings.Config - if err = globalConf.EnsureComplete(); err != nil { - return err - } - - kustomizePath, err := globalConf.CurrentContextEntryPoint(config.InitinfraPhase) - if err != nil { - return err - } - - b, err := document.NewBundleByPath(kustomizePath) - if err != nil { - return err - } - - // Returns all documents for this phase - docs, err := b.Select(document.NewDeployToK8sSelector()) - if err != nil { - return err - } - if len(docs) == 0 { - return document.ErrDocNotFound{} - } - - return kctl.Apply(docs, ao) -} diff --git a/pkg/cluster/initinfra/infra_test.go b/pkg/cluster/initinfra/infra_test.go deleted file mode 100644 index 73e889da0..000000000 --- a/pkg/cluster/initinfra/infra_test.go +++ /dev/null @@ -1,115 +0,0 @@ -/* - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - https://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -*/ - -package initinfra_test - -import ( - "errors" - "path/filepath" - "testing" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - - "opendev.org/airship/airshipctl/pkg/cluster/initinfra" - "opendev.org/airship/airshipctl/pkg/document" - "opendev.org/airship/airshipctl/pkg/environment" - "opendev.org/airship/airshipctl/pkg/k8s/client" - "opendev.org/airship/airshipctl/pkg/k8s/client/fake" - "opendev.org/airship/airshipctl/pkg/k8s/kubectl" - "opendev.org/airship/airshipctl/testutil/k8sutils" -) - -const ( - kubeconfigPath = "testdata/kubeconfig.yaml" - filenameRC = "testdata/primary/site/test-site/ephemeral/initinfra/replicationcontroller.yaml" - airshipConfigFile = "testdata/config.yaml" -) - -var ( - DynamicClientError = errors.New("DynamicClientError") -) - -func TestNewInfra(t *testing.T) { - rs := makeNewFakeRootSettings(t, kubeconfigPath, airshipConfigFile) - infra := initinfra.NewInfra(rs) - - assert.NotNil(t, infra.RootSettings) -} - -func TestDeploy(t *testing.T) { - rs := makeNewFakeRootSettings(t, kubeconfigPath, airshipConfigFile) - tf := k8sutils.NewFakeFactoryForRC(t, filenameRC) - defer tf.Cleanup() - - infra := initinfra.NewInfra(rs) - infra.ClusterType = "ephemeral" - infra.DryRun = true - - infra.FileSystem = document.NewDocumentFs() - - kctl := kubectl.NewKubectl(tf) - - tests := []struct { - theInfra *initinfra.Infra - client client.Interface - prune bool - expectedError error - }{ - { - - client: fake.NewClient(fake.WithKubectl( - kubectl.NewKubectl(k8sutils. - NewMockKubectlFactory(). - WithDynamicClientByError(nil, DynamicClientError)))), - expectedError: DynamicClientError, - }, - { - expectedError: nil, - prune: false, - client: fake.NewClient(fake.WithKubectl(kctl)), - }, - { - expectedError: nil, - prune: true, - client: fake.NewClient(fake.WithKubectl(kctl)), - }, - } - - for _, test := range tests { - infra.Prune = test.prune - infra.Client = test.client - actualErr := infra.Deploy() - assert.Equal(t, test.expectedError, actualErr) - } -} - -// makeNewFakeRootSettings takes kubeconfig path and directory path to fixture dir as argument. -func makeNewFakeRootSettings(t *testing.T, kp string, dir string) *environment.AirshipCTLSettings { - t.Helper() - - akp, err := filepath.Abs(kp) - require.NoError(t, err) - - adir, err := filepath.Abs(dir) - require.NoError(t, err) - - settings := &environment.AirshipCTLSettings{ - AirshipConfigPath: adir, - KubeConfigPath: akp, - } - - settings.InitConfig() - return settings -} diff --git a/pkg/cluster/initinfra/testdata/config.yaml b/pkg/cluster/initinfra/testdata/config.yaml deleted file mode 100644 index 97635df0d..000000000 --- a/pkg/cluster/initinfra/testdata/config.yaml +++ /dev/null @@ -1,44 +0,0 @@ -apiVersion: airshipit.org/v1alpha1 -bootstrapInfo: - dummy_bootstrap_config: - container: - volume: /tmp/airship:/config - image: quay.io/airshipit/isogen:latest-debian_stable - containerRuntime: docker - builder: - userDataFileName: user-data - networkConfigFileName: network-config - outputMetadataFileName: output-metadata.yaml - remoteDirect: - isoUrl: http://localhost:8099/debian-custom.iso - remoteType: redfish -clusters: - dummycluster: - clusterType: - ephemeral: - bootstrapInfo: dummy_bootstrap_config - clusterKubeconf: dummycluster_ephemeral -contexts: - dummy_cluster: - contextKubeconf: dummy_cluster - manifest: dummy_manifest -currentContext: dummy_cluster -kind: Config -manifests: - dummy_manifest: - primaryRepositoryName: primary - repositories: - primary: - auth: - sshKey: testdata/test-key.pem - type: ssh-key - checkout: - branch: "" - force: false - remoteRef: "" - tag: v1.0.1 - url: http://dummy.url.com/primary.git - subPath: primary/site/test-site - targetPath: testdata -users: - dummy_user: {} \ No newline at end of file diff --git a/pkg/cluster/initinfra/testdata/kubeconfig.yaml b/pkg/cluster/initinfra/testdata/kubeconfig.yaml deleted file mode 100644 index b0d205918..000000000 --- a/pkg/cluster/initinfra/testdata/kubeconfig.yaml +++ /dev/null @@ -1,19 +0,0 @@ -apiVersion: v1 -clusters: -- cluster: - certificate-authority-data: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUN5RENDQWJDZ0F3SUJBZ0lCQURBTkJna3Foa2lHOXcwQkFRc0ZBREFWTVJNd0VRWURWUVFERXdwcmRXSmwKY201bGRHVnpNQjRYRFRFNU1Ea3lPVEUzTURNd09Wb1hEVEk1TURreU5qRTN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TmxoSitUMwowQlBVaHBQTlJBNTNJN0hRQjhVUDR2elNONTkzZ1VFbVlFQ2Jic2RYSzB6ZVR6SDdWWHR2Zmd5WTVWWT0KLS0tLS1FTkQgQ0VSVElGSUNBVEUtLS0tLQo= - server: https://127.0.0.1:6443 - name: dummycluster_ephemeral -contexts: -- context: - cluster: dummycluster_ephemeral - user: kubernetes-admin - name: dummy_cluster -current-context: dummy_cluster -kind: Config -preferences: {} -users: -- name: kubernetes-admin - user: - client-certificate-data: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUM4akNDQWRxZ0F3SUJBZ0lJQXhEdzk2RUY4SXN3RFFZSktvWklodmNOQVFFTEJRQXdGVEVUTUJFR0ExVUUKQXhNS2EzVmlaWEp1WlhSbGN6QWVGdzB4T1RBNU1qa3hOekF6TURsYUZ3MHlNREE1TWpneE56QXpNVEphTURReApGekFWQmdOVkJBb1REbk41YzNSbGJUcHRZWE4wWlhKek1Sa3dGd1lEVlFRREV4QnJkV0psY201bGRHVnpMV0ZrCmJXbHVNSUlCSWpBTkJna3Foa2lHOXcwQkFRRUZBQU9DQVE4QU1JSUJDZ0tDQVFFQXV6R0pZdlBaNkRvaTQyMUQKSzhXSmFaQ25OQWQycXo1cC8wNDJvRnpRUGJyQWd6RTJxWVZrek9MOHhBVmVSN1NONXdXb1RXRXlGOEVWN3JyLwo0K0hoSEdpcTVQbXF1SUZ5enpuNi9JWmM4alU5eEVmenZpa2NpckxmVTR2UlhKUXdWd2dBU05sMkFXQUloMmRECmRUcmpCQ2ZpS1dNSHlqMFJiSGFsc0J6T3BnVC9IVHYzR1F6blVRekZLdjJkajVWMU5rUy9ESGp5UlJKK0VMNlEKQlltR3NlZzVQNE5iQzllYnVpcG1NVEFxL0p1bU9vb2QrRmpMMm5acUw2Zkk2ZkJ0RjVPR2xwQ0IxWUo4ZnpDdApHUVFaN0hUSWJkYjJ0cDQzRlZPaHlRYlZjSHFUQTA0UEoxNSswV0F5bVVKVXo4W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JT2JDeEtLa0R0ZXJSaFhHd3g5c1pONVJCbG9VRThZNGJBb0dBQ3ZsdVhMZWRxcng5VkE0bDNoNXUKVDJXRVUxYjgxZ1orcmtRc1I1S0lNWEw4cllBTElUNUpHKzFuendyN3BkaEFXZmFWdVV2SDRhamdYT0h6MUs5aQpFODNSVTNGMG9ldUg0V01PY1RwU0prWm0xZUlXcWRiaEVCb1FGdUlWTXRib1BsV0d4ZUhFRHJoOEtreGp4aThSCmdEcUQyajRwY1IzQ0g5QjJ5a0lqQjVFQ2dZRUExc0xXLys2enE1c1lNSm14K1JXZThhTXJmL3pjQnVTSU1LQWgKY0dNK0wwMG9RSHdDaUU4TVNqcVN1ajV3R214YUFuanhMb3ZwSFlRV1VmUEVaUW95UE1YQ2VhRVBLOU4xbk8xMwp0V2lHRytIZkIxaU5PazFCc0lhNFNDbndOM1FRVTFzeXBaeEgxT3hueS9LYmkvYmEvWEZ5VzNqMGFUK2YvVWxrCmJGV1ZVdWtDZ1lFQTBaMmRTTFlmTjV5eFNtYk5xMWVqZXdWd1BjRzQxR2hQclNUZEJxdHFac1doWGE3aDdLTWEKeHdvamh5SXpnTXNyK2tXODdlajhDQ2h0d21sQ1p5QU92QmdOZytncnJ1cEZLM3FOSkpKeU9YREdHckdpbzZmTQp5aXB3Q2tZVGVxRThpZ1J6UkI5QkdFUGY4eVpjMUtwdmZhUDVhM0lRZmxiV0czbGpUemNNZVZjPQotLS0tLUVORCBSU0EgUFJJVkFURSBLRVktLS0tLQo= diff --git a/pkg/cluster/initinfra/testdata/primary/site/test-site/ephemeral/initinfra/kustomization.yaml b/pkg/cluster/initinfra/testdata/primary/site/test-site/ephemeral/initinfra/kustomization.yaml deleted file mode 100644 index 72ab8548e..000000000 --- a/pkg/cluster/initinfra/testdata/primary/site/test-site/ephemeral/initinfra/kustomization.yaml +++ /dev/null @@ -1,2 +0,0 @@ -resources: - - replicationcontroller.yaml diff --git a/pkg/cluster/initinfra/testdata/primary/site/test-site/ephemeral/initinfra/replicationcontroller.yaml b/pkg/cluster/initinfra/testdata/primary/site/test-site/ephemeral/initinfra/replicationcontroller.yaml deleted file mode 100644 index 83aca9454..000000000 --- a/pkg/cluster/initinfra/testdata/primary/site/test-site/ephemeral/initinfra/replicationcontroller.yaml +++ /dev/null @@ -1,19 +0,0 @@ -apiVersion: v1 -kind: ReplicationController -metadata: - name: test-rc - namespace: test - labels: - airshipit.org/phase: "initinfra" -spec: - replicas: 1 - template: - metadata: - labels: - name: test-rc - spec: - containers: - - name: test-rc - image: nginx - ports: - - containerPort: 80 diff --git a/pkg/cluster/initinfra/testdata/primary/site/test-site/ephemeral/kustomization.yaml b/pkg/cluster/initinfra/testdata/primary/site/test-site/ephemeral/kustomization.yaml deleted file mode 100644 index 3789004c6..000000000 --- a/pkg/cluster/initinfra/testdata/primary/site/test-site/ephemeral/kustomization.yaml +++ /dev/null @@ -1,2 +0,0 @@ -resources: - - initinfra diff --git a/playbooks/airship-airshipctl-test-runner.yaml b/playbooks/airship-airshipctl-test-runner.yaml index 4ef1dfa8f..d86c30b8c 100644 --- a/playbooks/airship-airshipctl-test-runner.yaml +++ b/playbooks/airship-airshipctl-test-runner.yaml @@ -22,7 +22,7 @@ - airshipctl-build-ephemeral-iso - install-kubectl - airshipctl-deploy-ephemeral-node - - airshipctl-cluster-initinfra + - airshipctl-phase-apply-initinfra var_files_default: - local-dev.yaml - airship-ipam.yaml diff --git a/roles/airshipctl-cluster-initinfra/defaults/main.yaml b/roles/airshipctl-phase-apply-initinfra/defaults/main.yaml similarity index 100% rename from roles/airshipctl-cluster-initinfra/defaults/main.yaml rename to roles/airshipctl-phase-apply-initinfra/defaults/main.yaml diff --git a/roles/airshipctl-cluster-initinfra/tasks/main.yaml b/roles/airshipctl-phase-apply-initinfra/tasks/main.yaml similarity index 95% rename from roles/airshipctl-cluster-initinfra/tasks/main.yaml rename to roles/airshipctl-phase-apply-initinfra/tasks/main.yaml index a477b4281..50df3f760 100644 --- a/roles/airshipctl-cluster-initinfra/tasks/main.yaml +++ b/roles/airshipctl-phase-apply-initinfra/tasks/main.yaml @@ -10,9 +10,9 @@ # See the License for the specific language governing permissions and # limitations under the License. -- name: deploy infra to cluster +- name: apply phases to cluster command: >- - airshipctl cluster initinfra + airshipctl phase apply initinfra --debug # TODO: As soon as issue #127 is complete, this check for pods should # be removed and initinfra command should check for resource status. diff --git a/tools/gate/27_cluster_initinfra.sh b/tools/gate/27_phase_apply_initinfra.sh similarity index 95% rename from tools/gate/27_cluster_initinfra.sh rename to tools/gate/27_phase_apply_initinfra.sh index d0d1f4c78..d5f351d94 100755 --- a/tools/gate/27_cluster_initinfra.sh +++ b/tools/gate/27_phase_apply_initinfra.sh @@ -25,5 +25,5 @@ PLAYBOOK_CONFIG=${PLAYBOOK_CONFIG:-"${TMP_DIR}/config.yaml"} sudo ansible-playbook -i "$ANSIBLE_HOSTS" \ playbooks/airship-airshipctl-test-runner.yaml \ - -e @tools/gate/config_cluster_initinfra.yaml \ + -e @tools/gate/config_phase_apply_initinfra.yaml \ -e @"$PLAYBOOK_CONFIG" diff --git a/tools/gate/config_cluster_initinfra.yaml b/tools/gate/config_phase_apply_initinfra.yaml similarity index 93% rename from tools/gate/config_cluster_initinfra.yaml rename to tools/gate/config_phase_apply_initinfra.yaml index 0b917d1f8..eb00a1af1 100644 --- a/tools/gate/config_cluster_initinfra.yaml +++ b/tools/gate/config_phase_apply_initinfra.yaml @@ -12,4 +12,4 @@ --- test_roles: - - airshipctl-cluster-initinfra + - airshipctl-phase-apply-initinfra diff --git a/zuul.d/jobs.yaml b/zuul.d/jobs.yaml index 2dbea9797..aa4c97f7c 100644 --- a/zuul.d/jobs.yaml +++ b/zuul.d/jobs.yaml @@ -78,7 +78,7 @@ - airshipctl-build-ephemeral-iso - install-kubectl - airshipctl-deploy-ephemeral-node - - airshipctl-cluster-initinfra + - airshipctl-phase-apply-initinfra serve_dir: /srv/iso serve_port: 8099 @@ -102,7 +102,7 @@ - airshipctl-build-ephemeral-iso - install-kubectl - airshipctl-deploy-ephemeral-node - - airshipctl-cluster-initinfra + - airshipctl-phase-apply-initinfra serve_dir: /srv/iso serve_port: 8099 voting: false