Skip to content

Commit

Permalink
removed flags for the operator. configure via chart
Browse files Browse the repository at this point in the history
  • Loading branch information
mlbiam committed Oct 12, 2022
1 parent ab9624d commit aded831
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 39 deletions.
12 changes: 7 additions & 5 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
]
Expand Down
2 changes: 1 addition & 1 deletion build.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

export VERSION="0.0.7"
export VERSION="0.0.8"

rm -rf target
mkdir -p target
Expand Down
4 changes: 1 addition & 3 deletions cmd/installAuthPortal.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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")
Expand Down
4 changes: 1 addition & 3 deletions cmd/installSatelite.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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")
Expand Down
2 changes: 1 addition & 1 deletion depxml.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

export VERSION="0.0.7"
export VERSION="0.0.8"

rm -rf target
mkdir -p target
Expand Down
32 changes: 6 additions & 26 deletions openunison/deployer.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit aded831

Please sign in to comment.