diff --git a/cmd/qliksense/crds.go b/cmd/qliksense/crds.go index fe31c1e..fa5899c 100644 --- a/cmd/qliksense/crds.go +++ b/cmd/qliksense/crds.go @@ -12,31 +12,35 @@ var crdsCmd = &cobra.Command{ } func crdsViewCmd(q *qliksense.Qliksense) *cobra.Command { - opts := &qliksense.CrdCommandOptions{} + opts := &qliksense.CrdCommandOptions{ + All: true, + } c := &cobra.Command{ Use: "view", - Short: "View CRDs for qliksense application. use view --all to see opearator crd as well ", - Long: `View CRDs for qliksense application. use view --all to see opearator crd as well`, + Short: "View CRDs for qliksense application. Use view --all=false to exclude the operator CRD", + Long: "View CRDs for qliksense application. Use view --all=false to exclude the operator CRD", RunE: func(cmd *cobra.Command, args []string) error { return q.ViewCrds(opts) }, } f := c.Flags() - f.BoolVarP(&opts.All, "all", "", false, "Include All CRDs") + f.BoolVarP(&opts.All, "all", "", opts.All, "If set to false, then the operator CRD is excluded") return c } func crdsInstallCmd(q *qliksense.Qliksense) *cobra.Command { - opts := &qliksense.CrdCommandOptions{} + opts := &qliksense.CrdCommandOptions{ + All: true, + } c := &cobra.Command{ Use: "install", - Short: "Install CRDs fro Qliksense application. Use install --all to include operator crd", - Long: `Install CRDs fro Qliksense application. Use install --all to include operator crd`, + Short: "Install CRDs for Qliksense application. Use install --all=false to exclude the operator CRD", + Long: "Install CRDs for Qliksense application. Use install --all=false to exclude the operator CRD", RunE: func(cmd *cobra.Command, args []string) error { return q.InstallCrds(opts) }, } f := c.Flags() - f.BoolVarP(&opts.All, "all", "", false, "Include All CRDs") + f.BoolVarP(&opts.All, "all", "", opts.All, "If set to false, then the operator CRD is excluded") return c } diff --git a/go.mod b/go.mod index 4e26f69..9b1e901 100644 --- a/go.mod +++ b/go.mod @@ -40,7 +40,7 @@ require ( github.com/mitchellh/go-homedir v1.1.0 github.com/otiai10/copy v1.1.1 github.com/pkg/errors v0.9.1 - github.com/qlik-oss/k-apis v0.1.4 + github.com/qlik-oss/k-apis v0.1.5 github.com/robfig/cron/v3 v3.0.1 github.com/rogpeppe/go-internal v1.5.2 // indirect github.com/spf13/cobra v0.0.6 diff --git a/go.sum b/go.sum index 151b053..5eb46f1 100644 --- a/go.sum +++ b/go.sum @@ -889,6 +889,8 @@ github.com/qlik-oss/k-apis v0.1.2 h1:BBcrXl+NxdsvuRsZuJbvIFxMv5QIXqWBzhXOcr5KUX8 github.com/qlik-oss/k-apis v0.1.2/go.mod h1:yoYGgPJ/H0t9H3NSq64dWfyQY6QWi2L9c+hCJoVO03U= github.com/qlik-oss/k-apis v0.1.4 h1:YXnjKXm/yhPblzYYyVCtD0dNbIkLPLlDdBKnjeYW0IY= github.com/qlik-oss/k-apis v0.1.4/go.mod h1:yoYGgPJ/H0t9H3NSq64dWfyQY6QWi2L9c+hCJoVO03U= +github.com/qlik-oss/k-apis v0.1.5 h1:IeqHuF1IIQCsuSmsUhL7GjdfkOFsNgh3z2UyX59GTsk= +github.com/qlik-oss/k-apis v0.1.5/go.mod h1:yoYGgPJ/H0t9H3NSq64dWfyQY6QWi2L9c+hCJoVO03U= github.com/qlik-oss/kustomize/api v0.3.3-0.20200514233516-4ac83864b7bd h1:dYd6duTr54L7OqykGkd3Z+336frAvzsibWNYruYkYVc= github.com/qlik-oss/kustomize/api v0.3.3-0.20200514233516-4ac83864b7bd/go.mod h1:zh3yFgE5zFk1kreqzVyyj1eXyIxQJT53l4zSg8Wt4SA= github.com/quasilyte/go-consistent v0.0.0-20190521200055-c6f3937de18c/go.mod h1:5STLWrekHfjyYwxBRVRXNOSewLJ3PWfDJd1VyTS21fI= diff --git a/pkg/api/kubectl.go b/pkg/api/kubectl.go index a756bf3..4a199c1 100644 --- a/pkg/api/kubectl.go +++ b/pkg/api/kubectl.go @@ -9,7 +9,7 @@ import ( "strings" ) -// KubectlApply create resoruces in the provided namespace, +// KubectlApply create resources in the provided namespace, // if namespace="" then use whatever the kubectl default is func KubectlApply(manifests, namespace string) error { return kubectlOperation(manifests, "apply", namespace) @@ -19,7 +19,7 @@ func KubectlApplyVerbose(manifests, namespace string, verbose bool) error { return kubectlOperationVerbose(manifests, "apply", namespace, verbose) } -// KubectlDelete delete resoruces in the provided namespace, +// KubectlDelete delete resources in the provided namespace, // if namespace="" then use whatever the kubectl default is func KubectlDelete(manifests, namespace string) error { return kubectlOperation(manifests, "delete", namespace) diff --git a/pkg/qliksense/config.go b/pkg/qliksense/config.go index 1030241..8c2d1f0 100644 --- a/pkg/qliksense/config.go +++ b/pkg/qliksense/config.go @@ -39,9 +39,9 @@ func (q *Qliksense) ConfigApplyQK8s() error { return errors.New(agreementTempalte + "\nPlease do $ qliksense config set-configs qliksense.acceptEULA=yes\n") } - // create patch dependent resoruces + // create patch dependent resources fmt.Println("Installing resources used by the kuztomize patch") - if err := q.createK8sResoruceBeforePatch(qcr); err != nil { + if err := q.createK8sResourceBeforePatch(qcr); err != nil { return err } diff --git a/pkg/qliksense/context_configs.go b/pkg/qliksense/context_configs.go index a494857..cc06f0b 100644 --- a/pkg/qliksense/context_configs.go +++ b/pkg/qliksense/context_configs.go @@ -358,8 +358,6 @@ func (q *Qliksense) processSetOpsRunner(arg string, cr *api.QliksenseCR) error { cr.Spec.OpsRunner.WatchBranch = args[1] case "image": cr.Spec.OpsRunner.Image = args[1] - case "crPvc": - cr.Spec.OpsRunner.CrPvc = args[1] default: return errors.New(arg + " does not match any cr spec") } diff --git a/pkg/qliksense/install.go b/pkg/qliksense/install.go index a94b899..810dc50 100644 --- a/pkg/qliksense/install.go +++ b/pkg/qliksense/install.go @@ -69,7 +69,7 @@ func (q *Qliksense) InstallQK8s(version string, opts *InstallCommandOptions, kee fmt.Println("error verifying whether CRDs are installed", err) return err } else if !installed { - return errors.New(`please install CRDs by executing: $ qliksense crds install --all`) + return errors.New(`please install CRDs by executing: $ qliksense crds install`) } if err := applyImagePullSecret(qConfig); err != nil { @@ -87,13 +87,13 @@ func (q *Qliksense) InstallQK8s(version string, opts *InstallCommandOptions, kee return err } - // create patch dependent resoruces + // create patch dependent resources fmt.Println("Installing resources used by the kuztomize patch") - if err := q.createK8sResoruceBeforePatch(qcr); err != nil { + if err := q.createK8sResourceBeforePatch(qcr); err != nil { return err } - if qcr.Spec.Git != nil && qcr.Spec.Git.Repository != "" { + if qcr.Spec.OpsRunner != nil { // fetching and applying manifest will be in the operator controller // get decrypted cr if dcr, err := qConfig.GetDecryptedCr(qcr); err != nil { @@ -207,7 +207,7 @@ func (q *Qliksense) applyCR(cr *qapi.QliksenseCR) error { return nil } -func (q *Qliksense) createK8sResoruceBeforePatch(qcr *qapi.QliksenseCR) error { +func (q *Qliksense) createK8sResourceBeforePatch(qcr *qapi.QliksenseCR) error { for svc, nvs := range qcr.Spec.Secrets { for _, nv := range nvs { if isK8sSecretNeedToCreate(nv) { diff --git a/pkg/qliksense/install_test.go b/pkg/qliksense/install_test.go index 75d81ab..1bc0e53 100644 --- a/pkg/qliksense/install_test.go +++ b/pkg/qliksense/install_test.go @@ -18,7 +18,7 @@ import ( qapi "github.com/qlik-oss/sense-installer/pkg/api" ) -func TestCreateK8sResoruceBeforePatch(t *testing.T) { +func TestCreateK8sResourceBeforePatch(t *testing.T) { td := setup() sampleCr := ` apiVersion: qlik.com/v1 @@ -66,7 +66,7 @@ spec: t.Log(err) t.FailNow() } - if err = q.createK8sResoruceBeforePatch(cr); err != nil { + if err = q.createK8sResourceBeforePatch(cr); err != nil { t.Log(err) t.FailNow() } diff --git a/pkg/qliksense/operator.go b/pkg/qliksense/operator.go index 8205017..d121aad 100644 --- a/pkg/qliksense/operator.go +++ b/pkg/qliksense/operator.go @@ -41,7 +41,7 @@ func (q *Qliksense) getYamlFromPackrFile(packrFile string) string { if err != nil { fmt.Printf("Cannot read file %s", packrFile) } - return fmt.Sprintln("#soruce: " + packrFile + "\n\n" + s + "\n---") + return fmt.Sprintln("#source: " + packrFile + "\n\n" + s + "\n---") } func (q *Qliksense) getFileList(resourceType string) []string { var resList []string