csi: skip validation when installing snapshotter
in kubernetes 1.18 we are seeing CRD validation
errors when installing with kubectl, adding
validate=false to skip the validation and
to make tests works with kubernetes 1.18
closes: #9670
Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
(cherry picked from commit c40ff24410)
This commit is contained in:
1 parent
4c41b5ea07
commit
9b217884ac
1 file changed
+16
-3
@@ -112,20 +112,33 @@ func (k8sh *K8sHelper) DeleteSnapshotController() error {
|
||||
|
||||
// snapshotCRD can be used for creating or deleting the snapshot CRD's
|
||||
func (k8sh *K8sHelper) snapshotCRD(action string) error {
|
||||
// setting validate=false to skip CRD validation during create operation to
|
||||
// support lower Kubernetes versions.
|
||||
args := func(crdpath string) []string {
|
||||
a := []string{
|
||||
action,
|
||||
"-f",
|
||||
crdpath,
|
||||
}
|
||||
if action == "create" {
|
||||
a = append(a, "--validate=false")
|
||||
}
|
||||
return a
|
||||
}
|
||||
snapshotClassCRD := fmt.Sprintf("%s/%s/%s", repoURL, snapshotterVersion, snapshotClassCRDPath)
|
||||
_, err := k8sh.Kubectl(action, "-f", snapshotClassCRD)
|
||||
_, err := k8sh.Kubectl(args(snapshotClassCRD)...)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
snapshotContentsCRD := fmt.Sprintf("%s/%s/%s", repoURL, snapshotterVersion, volumeSnapshotContentsCRDPath)
|
||||
_, err = k8sh.Kubectl(action, "-f", snapshotContentsCRD)
|
||||
_, err = k8sh.Kubectl(args(snapshotContentsCRD)...)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
snapshotCRD := fmt.Sprintf("%s/%s/%s", repoURL, snapshotterVersion, volumeSnapshotCRDPath)
|
||||
_, err = k8sh.Kubectl(action, "-f", snapshotCRD)
|
||||
_, err = k8sh.Kubectl(args(snapshotCRD)...)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user