Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

StorageCapacityTracking feature changes #236

Merged
merged 13 commits into from
Jul 31, 2023
8 changes: 8 additions & 0 deletions charts/csi-powermax/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,11 @@ Return the appropriate sidecar images based on k8s version
{{- end -}}
{{- end -}}
{{- end -}}

{{- define "csi-powermax.isStorageCapacitySupported" -}}
{{- if eq .Values.storageCapacity.enabled true -}}
{{- if and (eq .Capabilities.KubeVersion.Major "1") (ge (trimSuffix "+" .Capabilities.KubeVersion.Minor) "24") -}}
{{- true -}}
{{- end -}}
{{- end -}}
{{- end -}}
27 changes: 25 additions & 2 deletions charts/csi-powermax/templates/controller.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,19 @@ rules:
- apiGroups: [""]
resources: ["configmaps"]
verbs: ["create", "delete", "get", "list", "watch", "update", "patch"]
{{- end}}
{{- end}}
# Permissions for Storage Capacity
{{- if eq (include "csi-powermax.isStorageCapacitySupported" .) "true" }}
- apiGroups: ["storage.k8s.io"]
resources: ["csistoragecapacities"]
verbs: ["get", "list", "watch", "create", "update", "patch", "delete"]
- apiGroups: [""]
resources: ["pods"]
verbs: ["get"]
- apiGroups: ["apps"]
resources: ["replicasets"]
verbs: ["get"]
{{- end }}
---
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
Expand Down Expand Up @@ -184,9 +196,20 @@ spec:
- "--leader-election"
- "--extra-create-metadata"
- "--feature-gates=Topology=true"
- "--enable-capacity={{ (include "csi-powermax.isStorageCapacitySupported" .) | default false }}"
- "--capacity-ownerref-level=2"
- "--capacity-poll-interval={{ .Values.storageCapacity.pollInterval | default "5m" }}"
env:
- name: ADDRESS
value: /var/run/csi/csi.sock
- name: NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
volumeMounts:
- name: socket-dir
mountPath: /var/run/csi
Expand Down Expand Up @@ -487,4 +510,4 @@ spec:
secret:
secretName: proxy-server-root-certificate
{{ end }}
{{ end }}
{{ end }}
4 changes: 3 additions & 1 deletion charts/csi-powermax/templates/csidriver.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,7 @@ metadata:
name: csi-powermax
{{- end }}
spec:
podInfoOnMount: true
attachRequired: true
fsGroupPolicy: {{ .Values.fsGroupPolicy }}
storageCapacity: {{ (include "csi-powermax.isStorageCapacitySupported" .) | default true }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Default value will be false.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done changing it

fsGroupPolicy: {{ .Values.fsGroupPolicy }}
14 changes: 14 additions & 0 deletions charts/csi-powermax/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,20 @@ authorization:
# Default value: "true"
skipCertificateValidation: true

# Storage Capacity Tracking
# Note: Capacity tracking is supported in kubernetes v1.25 and above, this feature will be automatically disabled in older versions.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tssushma In this comment, the version should be v1.24 as the feature is supported in k8s v1.24 and above.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed the version to v1.24

storageCapacity:
# enabled : Enable/Disable storage capacity tracking
# Allowed values:
# true: enable storage capacity tracking
# false: disable storage capacity tracking
# Default value: true
enabled: true
# pollInterval : Configure how often external-provisioner polls the driver to detect changed capacity
# Allowed values: 1m,2m,3m,...,10m,...,60m etc
# Default value: 5m
pollInterval: 5m

# VMware/vSphere virtualization support
# set enable to true, if you to enable VMware virtualized environment support via RDM
# Allowed Values:
Expand Down