csi: move csi management to admin
Going forward, admin will manage the csi operator
CR's and rook will only manage Ceph Connection cr
and client Profile cr.
The old csi driver is completely removed from Rook
and can no longer be used starting in Rook v1.20.
The upgrade guide will contain the needed transition steps
for managing the csi operator settings.
Signed-off-by: subhamkrai <srai@redhat.com>
(cherry picked from commit 4eefad42e8)
This commit is contained in:
1 parent
9f978ec685
commit
a9d29bdec6
84 files changed
+515
-9262
No files matched your search
@@ -21,6 +21,7 @@ import (
|
||||
"os"
|
||||
"path"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"gopkg.in/yaml.v2"
|
||||
@@ -137,6 +138,37 @@ func (h *HelmHelper) InstallVersionedChart(namespace, chart, version string, val
|
||||
return nil
|
||||
}
|
||||
|
||||
func (h *HelmHelper) InstallOrUpgradeHelmRepoChart(namespace, release, repoURL, repoName, chartName, version string, values map[string]interface{}) error {
|
||||
if _, err := h.Execute("repo", "add", repoName, repoURL, "--force-update"); err != nil {
|
||||
return fmt.Errorf("failed to add helm repo %q: %w", repoName, err)
|
||||
}
|
||||
if _, err := h.Execute("repo", "update"); err != nil {
|
||||
logger.Warningf("helm repo update failed: %v", err)
|
||||
}
|
||||
cmdArgs := []string{
|
||||
"upgrade", "--install", "--create-namespace",
|
||||
release, repoName + "/" + chartName,
|
||||
"--version", version,
|
||||
"--namespace", namespace,
|
||||
}
|
||||
if err := h.installChart(cmdArgs, values); err != nil {
|
||||
return fmt.Errorf("helm upgrade --install %q in namespace %q: %w", release, namespace, err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (h *HelmHelper) UninstallHelmReleaseIfExists(namespace, release string) error {
|
||||
out, err := h.Execute("uninstall", release, "--namespace", namespace)
|
||||
if err == nil {
|
||||
return nil
|
||||
}
|
||||
msg := strings.ToLower(out + err.Error())
|
||||
if strings.Contains(msg, "not found") {
|
||||
return nil
|
||||
}
|
||||
return fmt.Errorf("helm uninstall %q in namespace %q: %w; output=%s", release, namespace, err, out)
|
||||
}
|
||||
|
||||
func (h *HelmHelper) installChart(cmdArgs []string, values map[string]interface{}) error {
|
||||
if values != nil {
|
||||
testValuesPath := "values-test.yaml"
|
||||
|
||||
@@ -62,7 +62,7 @@ func (k8sh *K8sHelper) CheckSnapshotISReadyToUse(name, namespace string, retries
|
||||
return false, fmt.Errorf("giving up waiting for %q snapshot in namespace %q", name, namespace)
|
||||
}
|
||||
|
||||
// snapshotController creates or deletes the snapshotcontroller and required RBAC
|
||||
// snapshotController creates/applies or deletes the snapshotcontroller and required RBAC
|
||||
func (k8sh *K8sHelper) snapshotController(action string) error {
|
||||
controllerURL := fmt.Sprintf("%s/%s/%s", repoURL, snapshotterVersion, controllerPath)
|
||||
controllerManifest, err := getManifestFromURL(controllerURL)
|
||||
@@ -106,8 +106,8 @@ func (k8sh *K8sHelper) WaitForSnapshotController(retries int) error {
|
||||
}
|
||||
|
||||
// CreateSnapshotController creates the snapshotcontroller and required RBAC
|
||||
func (k8sh *K8sHelper) CreateSnapshotController() error {
|
||||
return k8sh.snapshotController("create")
|
||||
func (k8sh *K8sHelper) CreateSnapshotController(action string) error {
|
||||
return k8sh.snapshotController(action)
|
||||
}
|
||||
|
||||
// DeleteSnapshotController delete the snapshotcontroller and required RBAC
|
||||
@@ -115,9 +115,9 @@ func (k8sh *K8sHelper) DeleteSnapshotController() error {
|
||||
return k8sh.snapshotController("delete")
|
||||
}
|
||||
|
||||
// snapshotCRD can be used for creating or deleting the snapshot CRD's
|
||||
// snapshotCRD can be used for creating, applying or deleting the snapshot CRD's
|
||||
func (k8sh *K8sHelper) snapshotCRD(action string) error {
|
||||
// setting validate=false to skip CRD validation during create operation to
|
||||
// setting validate=false to skip CRD validation during create/apply to
|
||||
// support lower Kubernetes versions.
|
||||
args := func(crdpath string) []string {
|
||||
a := []string{
|
||||
@@ -125,7 +125,7 @@ func (k8sh *K8sHelper) snapshotCRD(action string) error {
|
||||
"-f",
|
||||
crdpath,
|
||||
}
|
||||
if action == "create" {
|
||||
if action == "create" || action == "apply" {
|
||||
a = append(a, "--validate=false")
|
||||
}
|
||||
return a
|
||||
@@ -169,8 +169,8 @@ func (k8sh *K8sHelper) snapshotCRD(action string) error {
|
||||
}
|
||||
|
||||
// CreateSnapshotCRD creates the snapshot CRD
|
||||
func (k8sh *K8sHelper) CreateSnapshotCRD() error {
|
||||
return k8sh.snapshotCRD("create")
|
||||
func (k8sh *K8sHelper) CreateSnapshotCRD(action string) error {
|
||||
return k8sh.snapshotCRD(action)
|
||||
}
|
||||
|
||||
// DeleteSnapshotCRD deletes the snapshot CRD
|
||||
|
||||
Reference in new issue
Block a user