From aded831d518c51e5cd2907007140e61050a9cf1d Mon Sep 17 00:00:00 2001 From: mlbiam Date: Wed, 12 Oct 2022 10:16:02 -0400 Subject: [PATCH] removed flags for the operator. configure via chart --- .vscode/launch.json | 12 +++++++----- build.sh | 2 +- cmd/installAuthPortal.go | 4 +--- cmd/installSatelite.go | 4 +--- depxml.sh | 2 +- openunison/deployer.go | 32 ++++++-------------------------- 6 files changed, 17 insertions(+), 39 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index 5954de4..7c536d7 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -17,17 +17,19 @@ "--additional-helm-charts=hsbc=/Users/marcboorshtein/Documents/Documents/customers/hsbc/v2/hsbcv2/hsbc-cp", "-s", - "~/Documents/Documents/customers/hsbc/v3/ldapspassword", + "/Users/marcboorshtein/Documents/Documents/customers/hsbc/v3/ldapspassword", "-b", - "~/Documents/Documents/customers/hsbc/v3/dbpassword", + "/Users/marcboorshtein/Documents/Documents/customers/hsbc/v3/dbpassword", "-t", - "~/Documents/Documents/customers/hsbc/v3/smtppassword", + "/Users/marcboorshtein/Documents/Documents/customers/hsbc/v3/smtppassword", + "-o", + "/Users/marcboorshtein/git-local/helm-charts/openunison-operator", "-c", "/Users/marcboorshtein/git-local/helm-charts/orchestra", - "~/Documents/Documents/customers/hsbc/v3/values-hsbcv3.yaml" + "/Users/marcboorshtein/Documents/Documents/customers/hsbc/v3/values-hsbcv3.yaml" ], "env": { - "KUBECONFIG": "~/.kube/hsbc-v3.conf" + "KUBECONFIG": "/Users/marcboorshtein/.kube/hsbc-v3.conf" } } ] diff --git a/build.sh b/build.sh index 8d41788..d559e49 100755 --- a/build.sh +++ b/build.sh @@ -1,6 +1,6 @@ #!/bin/bash -export VERSION="0.0.7" +export VERSION="0.0.8" rm -rf target mkdir -p target diff --git a/cmd/installAuthPortal.go b/cmd/installAuthPortal.go index c4c795a..e621739 100644 --- a/cmd/installAuthPortal.go +++ b/cmd/installAuthPortal.go @@ -28,7 +28,7 @@ var installAuthPortalCmd = &cobra.Command{ pathToValuesYaml = args[0] - openunisonDeployment, err := openunison.NewOpenUnisonDeployment(namespace, operatorImage, operatorDeployCrd, operatorChart, orchestraChart, orchestraLoginPortalChart, pathToValuesYaml, secretFile, clusterManagementChart, pathToDbPassword, pathToSmtpPassword, skipClusterManagement, parseChartSlices(&additionalCharts), parseChartSlices(&preCharts)) + openunisonDeployment, err := openunison.NewOpenUnisonDeployment(namespace, operatorChart, orchestraChart, orchestraLoginPortalChart, pathToValuesYaml, secretFile, clusterManagementChart, pathToDbPassword, pathToSmtpPassword, skipClusterManagement, parseChartSlices(&additionalCharts), parseChartSlices(&preCharts)) if err != nil { panic(err) @@ -68,8 +68,6 @@ func init() { // Cobra supports Persistent Flags which will work for this command // and all subcommands, e.g.: - installAuthPortalCmd.PersistentFlags().StringVarP(&operatorImage, "operator-image", "p", "docker.io/tremolosecurity/openunison-k8s-operator:latest", "Operator image name") - installAuthPortalCmd.PersistentFlags().BoolVarP(&operatorDeployCrd, "operator-deploy-crds", "d", true, "Deploy CRDs with the operator") installAuthPortalCmd.PersistentFlags().StringVarP(&operatorChart, "operator-chart", "o", "tremolo/openunison-operator", "Helm chart for OpenUnison's operator") installAuthPortalCmd.PersistentFlags().StringVarP(&orchestraChart, "orchestra-chart", "c", "tremolo/orchestra", "Helm chart of the orchestra portal") diff --git a/cmd/installSatelite.go b/cmd/installSatelite.go index df0e2fd..de67ba4 100644 --- a/cmd/installSatelite.go +++ b/cmd/installSatelite.go @@ -32,7 +32,7 @@ var installSateliteCmd = &cobra.Command{ controlPlaneCtxName := args[1] sateliteCtxName := args[2] - openunisonDeployment, err := openunison.NewSateliteDeployment(namespace, operatorImage, operatorDeployCrd, operatorChart, orchestraChart, orchestraLoginPortalChart, pathToValuesYaml, secretFile, controlPlaneCtxName, sateliteCtxName, addClusterChart, pathToSateliteYaml, parseChartSlices(&additionalCharts), parseChartSlices(&preCharts)) + openunisonDeployment, err := openunison.NewSateliteDeployment(namespace, operatorChart, orchestraChart, orchestraLoginPortalChart, pathToValuesYaml, secretFile, controlPlaneCtxName, sateliteCtxName, addClusterChart, pathToSateliteYaml, parseChartSlices(&additionalCharts), parseChartSlices(&preCharts)) if err != nil { panic(err) @@ -48,8 +48,6 @@ var installSateliteCmd = &cobra.Command{ func init() { rootCmd.AddCommand(installSateliteCmd) - installSateliteCmd.PersistentFlags().StringVarP(&operatorImage, "operator-image", "p", "docker.io/tremolosecurity/openunison-k8s-operator:latest", "Operator image name") - installSateliteCmd.PersistentFlags().BoolVarP(&operatorDeployCrd, "operator-deploy-crds", "d", true, "Deploy CRDs with the operator") installSateliteCmd.PersistentFlags().StringVarP(&operatorChart, "operator-chart", "o", "tremolo/openunison-operator", "Helm chart for OpenUnison's operator") installSateliteCmd.PersistentFlags().StringVarP(&orchestraChart, "orchestra-chart", "c", "tremolo/orchestra", "Helm chart of the orchestra portal") diff --git a/depxml.sh b/depxml.sh index 352b435..e426b00 100755 --- a/depxml.sh +++ b/depxml.sh @@ -1,6 +1,6 @@ #!/bin/bash -export VERSION="0.0.7" +export VERSION="0.0.8" rm -rf target mkdir -p target diff --git a/openunison/deployer.go b/openunison/deployer.go index 58e8882..1e064dc 100644 --- a/openunison/deployer.go +++ b/openunison/deployer.go @@ -42,9 +42,7 @@ func randSeq(n int) string { } type OperatorDeployment struct { - image string - deployCrd bool - chart string + chart string } // for sting info about additional helm charts @@ -83,8 +81,8 @@ type OpenUnisonDeployment struct { } // creates a new deployment structure -func NewOpenUnisonDeployment(namespace string, operatorImage string, operatorDeployCrd bool, operatorChart string, orchestraChart string, orchestraLoginPortalChart string, pathToValuesYaml string, secretFile string, clusterManagementChart string, pathToDbPassword string, pathToSmtpPassword string, skipClusterManagement bool, additionalCharts []HelmChartInfo, preCharts []HelmChartInfo) (*OpenUnisonDeployment, error) { - ou, err := NewSateliteDeployment(namespace, operatorImage, operatorDeployCrd, operatorChart, orchestraChart, orchestraLoginPortalChart, pathToValuesYaml, secretFile, "", "", "", "", additionalCharts, preCharts) +func NewOpenUnisonDeployment(namespace string, operatorChart string, orchestraChart string, orchestraLoginPortalChart string, pathToValuesYaml string, secretFile string, clusterManagementChart string, pathToDbPassword string, pathToSmtpPassword string, skipClusterManagement bool, additionalCharts []HelmChartInfo, preCharts []HelmChartInfo) (*OpenUnisonDeployment, error) { + ou, err := NewSateliteDeployment(namespace, operatorChart, orchestraChart, orchestraLoginPortalChart, pathToValuesYaml, secretFile, "", "", "", "", additionalCharts, preCharts) if err != nil { return nil, err @@ -99,13 +97,11 @@ func NewOpenUnisonDeployment(namespace string, operatorImage string, operatorDep } // creates a new deployment structure -func NewSateliteDeployment(namespace string, operatorImage string, operatorDeployCrd bool, operatorChart string, orchestraChart string, orchestraLoginPortalChart string, pathToValuesYaml string, secretFile string, controlPlanContextName string, sateliteContextName string, addClusterChart string, pathToSateliteYaml string, additionalCharts []HelmChartInfo, preCharts []HelmChartInfo) (*OpenUnisonDeployment, error) { +func NewSateliteDeployment(namespace string, operatorChart string, orchestraChart string, orchestraLoginPortalChart string, pathToValuesYaml string, secretFile string, controlPlanContextName string, sateliteContextName string, addClusterChart string, pathToSateliteYaml string, additionalCharts []HelmChartInfo, preCharts []HelmChartInfo) (*OpenUnisonDeployment, error) { ou := &OpenUnisonDeployment{} ou.namespace = namespace - ou.operator.image = operatorImage - ou.operator.deployCrd = operatorDeployCrd ou.operator.chart = operatorChart ou.orchestraChart = orchestraChart @@ -1414,16 +1410,8 @@ func (ou *OpenUnisonDeployment) DeployAuthPortal() error { return err } - // define values - vals := map[string]interface{}{ - "image": ou.operator.image, - "crd": map[string]interface{}{ - "deploy": ou.operator.deployCrd, - }, - } - //_, err = client.Run(chartReq, vals) - _, err = ou.runChartInstall(client, client.ReleaseName, chartReq, vals, actionConfig) + _, err = ou.runChartInstall(client, client.ReleaseName, chartReq, ou.helmValues, actionConfig) if err != nil { return err @@ -1446,17 +1434,9 @@ func (ou *OpenUnisonDeployment) DeployAuthPortal() error { return err } - // define values - vals := map[string]interface{}{ - "image": ou.operator.image, - "crd": map[string]interface{}{ - "deploy": ou.operator.deployCrd, - }, - } - //_, err = client.Run("openunison", chartReq, vals) - _, err = ou.runChartUpgrade(client, "openunison", chartReq, vals) + _, err = ou.runChartUpgrade(client, "openunison", chartReq, ou.helmValues) if err != nil { return err