cli: only install aws-lb and csi charts conditionally (#2131)

* init

* upgrade csi chart conditionally
This commit is contained in:
Adrian Stobbe 2023-07-25 10:54:47 +02:00 committed by GitHub
parent 7152633255
commit 04dc6256e6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -14,6 +14,7 @@ import (
"time"
"github.com/edgelesssys/constellation/v2/cli/internal/clusterid"
"github.com/edgelesssys/constellation/v2/internal/cloud/cloudprovider"
"github.com/edgelesssys/constellation/v2/internal/compatibility"
"github.com/edgelesssys/constellation/v2/internal/config"
"github.com/edgelesssys/constellation/v2/internal/constants"
@ -109,8 +110,7 @@ func (c *Client) Upgrade(ctx context.Context, config *config.Config, idFile clus
upgradeErrs := []error{}
upgradeReleases := []*chart.Chart{}
newReleases := []*chart.Chart{}
for _, info := range []chartInfo{ciliumInfo, certManagerInfo, constellationOperatorsInfo, constellationServicesInfo, csiInfo, awsLBControllerInfo} {
for _, info := range getManagedCharts(config) {
c.log.Debugf("Checking release %s", info.releaseName)
chart, err := loadChartsDir(helmFS, info.path)
if err != nil {
@ -187,6 +187,17 @@ func (c *Client) Upgrade(ctx context.Context, config *config.Config, idFile clus
return errors.Join(upgradeErrs...)
}
func getManagedCharts(config *config.Config) []chartInfo {
charts := []chartInfo{ciliumInfo, certManagerInfo, constellationOperatorsInfo, constellationServicesInfo, csiInfo}
if config.GetProvider() == cloudprovider.AWS {
charts = append(charts, awsLBControllerInfo)
}
if config.DeployCSIDriver() {
charts = append(charts, csiInfo)
}
return charts
}
// Versions queries the cluster for running versions and returns a map of releaseName -> version.
func (c *Client) Versions() (ServiceVersions, error) {
ciliumVersion, err := c.currentVersion(ciliumInfo.releaseName)