Deploy CSI snapshotter on init

Signed-off-by: Daniel Weiße <dw@edgeless.systems>
This commit is contained in:
Daniel Weiße 2023-06-22 16:31:35 +02:00 committed by Daniel Weiße
parent 2c8c86a0cb
commit 8619a90149
20 changed files with 1193 additions and 25 deletions

View file

@ -236,17 +236,35 @@ func (k *KubeWrapper) InitCluster(
return nil, fmt.Errorf("installing constellation-services: %w", err)
}
// cert-manager is necessary for our operator deployments.
// cert-manager provides CRDs used by other deployments,
// so it should be installed as early as possible, but after our microservices.
log.Infof("Installing cert-manager")
if err = k.helmClient.InstallCertManager(ctx, helmReleases.CertManager); err != nil {
if err = k.helmClient.InstallChart(ctx, helmReleases.CertManager); err != nil {
return nil, fmt.Errorf("installing cert-manager: %w", err)
}
// CSI snapshot-controller requires CRDs from cert-manager. It must be installed after it.
// CSI snapshot support should also only be deployed on clouds where we can deploy CSI drivers,
// and the deployment was not disabled by the user.
if helmReleases.SnapshotCRDs != nil && helmReleases.SnapshotController != nil {
log.Infof("Installing CSI snapshot CRDs")
if err = k.helmClient.InstallChart(ctx, *helmReleases.SnapshotCRDs); err != nil {
return nil, fmt.Errorf("installing CSI snapshot CRDs: %w", err)
}
log.Infof("Installing CSI snapshot-controller")
if err = k.helmClient.InstallChart(ctx, *helmReleases.SnapshotController); err != nil {
return nil, fmt.Errorf("installing CSI snapshot-controller: %w", err)
}
}
operatorVals, err := k.setupOperatorVals(ctx)
if err != nil {
return nil, fmt.Errorf("setting up operator vals: %w", err)
}
// Constellation operators require CRDs from cert-manager.
// They must be installed after it.
log.Infof("Installing operators")
if err = k.helmClient.InstallOperators(ctx, helmReleases.Operators, operatorVals); err != nil {
return nil, fmt.Errorf("installing operators: %w", err)