Skip to content

Commit

Permalink
fix reconciling of shoot
Browse files Browse the repository at this point in the history
  • Loading branch information
ostempel committed Nov 18, 2024
1 parent 751bd21 commit c1c3fab
Show file tree
Hide file tree
Showing 3 changed files with 91 additions and 4 deletions.
39 changes: 39 additions & 0 deletions example/pod.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
---
apiVersion: v1
kind: Pod
metadata:
name: volume-test
namespace: default
spec:
containers:
- name: volume-test
image: nginx:stable-alpine
imagePullPolicy: IfNotPresent
volumeMounts:
- name: linear
mountPath: /linear
- name: mirror
mountPath: /mirror
- name: striped
mountPath: /striped
- name: default
mountPath: /default
ports:
- containerPort: 80
resources:
limits:
cpu: 100m
memory: 100M
volumes:
- name: linear
persistentVolumeClaim:
claimName: csi-pvc-linear
- name: mirror
persistentVolumeClaim:
claimName: csi-pvc-mirror
- name: striped
persistentVolumeClaim:
claimName: csi-pvc-striped
- name: default
persistentVolumeClaim:
claimName: csi-pvc-default
48 changes: 48 additions & 0 deletions example/pvc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: csi-pvc-linear
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 10Mi
storageClassName: csi-driver-lvm-linear
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: csi-pvc-striped
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 10Mi
storageClassName: csi-driver-lvm-striped
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: csi-pvc-mirror
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 10Mi
storageClassName: csi-driver-lvm-mirror
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: csi-pvc-default
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 10Mi
storageClassName: csi-lvm
8 changes: 4 additions & 4 deletions pkg/controller/csi-driver-lvm/actuator.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ func (a *actuator) controllerObjects(namespace string) ([]client.Object, error)
},
{
APIGroups: []string{"storage.k8s.io"},
Resources: []string{"storageclaess"},
Resources: []string{"storageclasses"},
Verbs: []string{"get", "list", "watch"},
},
{
Expand Down Expand Up @@ -779,7 +779,7 @@ func (a *actuator) isOldCsiLvmExisting(ctx context.Context, shootNamespace strin
err = shootClient.Get(ctx, client.ObjectKeyFromObject(namespace), namespace)

if err == nil {
return true, nil
return true, fmt.Errorf("old csi-lvm namespace is existing")
} else if !apierrors.IsNotFound(err) {
return true, fmt.Errorf("error while getting old csi-lvm namespace: %w", err)
}
Expand All @@ -793,9 +793,9 @@ func (a *actuator) isOldCsiLvmExisting(ctx context.Context, shootNamespace strin
err = shootClient.Get(ctx, client.ObjectKeyFromObject(storageClass), storageClass, &client.GetOptions{})
if err == nil {
if storageClass.Provisioner == provisioner {
return true, nil
return false, nil
} else {
return false, fmt.Errorf("old csi-lvm storageclass is existing ")
return true, fmt.Errorf("old csi-lvm storageclass is existing")
}
} else if !apierrors.IsNotFound(err) {
return true, fmt.Errorf("error while getting old csi-lvm storageclass: %w", err)
Expand Down

0 comments on commit c1c3fab

Please sign in to comment.