github.com/openshift/installer@v1.4.17/cmd/openshift-install/imagebased.go (about) 1 package main 2 3 import ( 4 "context" 5 6 "github.com/spf13/cobra" 7 8 "github.com/openshift/installer/pkg/asset" 9 "github.com/openshift/installer/pkg/asset/imagebased/configimage" 10 "github.com/openshift/installer/pkg/asset/imagebased/image" 11 "github.com/openshift/installer/pkg/asset/kubeconfig" 12 "github.com/openshift/installer/pkg/asset/password" 13 ) 14 15 func newImageBasedCmd(ctx context.Context) *cobra.Command { 16 imagebasedCmd := &cobra.Command{ 17 Use: "image-based", 18 Short: "Commands for supporting cluster installation using the image-based installer", 19 RunE: func(cmd *cobra.Command, args []string) error { 20 return cmd.Help() 21 }, 22 } 23 24 imagebasedCmd.AddCommand(newImageBasedCreateCmd(ctx)) 25 return imagebasedCmd 26 } 27 28 var ( 29 imageBasedInstallationConfigTemplateTarget = target{ 30 name: "Image-based Installation ISO Configuration template", 31 command: &cobra.Command{ 32 Use: "image-config-template", 33 Short: "Generates a template of the Image-based Installation ISO config manifest used by the Image-based installer", 34 Args: cobra.ExactArgs(0), 35 }, 36 assets: []asset.WritableAsset{ 37 &image.ImageBasedInstallationConfig{}, 38 }, 39 } 40 41 imageBasedInstallationImageTarget = target{ 42 name: "Image-based Installation ISO Image", 43 command: &cobra.Command{ 44 Use: "image", 45 Short: "Generates a bootable ISO image containing all the information needed to deploy a cluster", 46 Args: cobra.ExactArgs(0), 47 }, 48 assets: []asset.WritableAsset{ 49 &image.Image{}, 50 }, 51 } 52 53 imageBasedConfigTemplateTarget = target{ 54 name: "Image-based Installer Config ISO Configuration Template", 55 command: &cobra.Command{ 56 Use: "config-template", 57 Short: "Generates a template of the Image-based Config ISO config manifest used by the image-based installer", 58 Args: cobra.ExactArgs(0), 59 }, 60 assets: []asset.WritableAsset{ 61 &configimage.ImageBasedConfig{}, 62 }, 63 } 64 65 imageBasedConfigImageTarget = target{ 66 name: "Image-based Installer Config ISO Image", 67 command: &cobra.Command{ 68 Use: "config-image", 69 Short: "Generates an ISO containing configuration files only", 70 Args: cobra.ExactArgs(0), 71 }, 72 assets: []asset.WritableAsset{ 73 &configimage.ConfigImage{}, 74 &kubeconfig.ImageBasedAdminClient{}, 75 &password.KubeadminPassword{}, 76 }, 77 } 78 79 imageBasedTargets = []target{ 80 imageBasedInstallationConfigTemplateTarget, 81 imageBasedInstallationImageTarget, 82 imageBasedConfigTemplateTarget, 83 imageBasedConfigImageTarget, 84 } 85 ) 86 87 func newImageBasedCreateCmd(ctx context.Context) *cobra.Command { 88 cmd := &cobra.Command{ 89 Use: "create", 90 Short: "Commands for generating image-based installer artifacts", 91 RunE: func(cmd *cobra.Command, args []string) error { 92 return cmd.Help() 93 }, 94 } 95 96 for _, t := range imageBasedTargets { 97 t.command.Args = cobra.ExactArgs(0) 98 t.command.Run = runTargetCmd(ctx, t.assets...) 99 cmd.AddCommand(t.command) 100 } 101 102 return cmd 103 }