-
Notifications
You must be signed in to change notification settings - Fork 787
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
Implement KEP3751 ("ControllerModifyVolume") #1941
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
fd89862
Refactor modification primitives out of ModifyVolumeProperties to sep…
ConnorJC3 17d5bd1
Implement ControllerModifyVolume and MutableParameters in CreateVolume
ConnorJC3 d91c53c
Update unit tests for ControllerModifyVolume/MutableParameters
ConnorJC3 067890a
Add VolumeAttributesClass RBAC permissions to external-resizier and e…
ConnorJC3 8250d06
Add ControllerModifyVolume e2e tests
ConnorJC3 3048ea8
Add docs and example for VolumeAttributesClass
ConnorJC3 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
# Volume Modification via `VolumeAttributesClass` | ||
|
||
## Prerequisites | ||
|
||
This example will only work on a cluster with the `VolumeAttributesClass` feature enabled. For more information see the [installation instructions in the EBS CSI `ModifyVolume` documentation](../docs/modify-volume.md). | ||
|
||
## Usage | ||
|
||
1. Deploy the example `Pod`, `PersistentVolumeClaim`, and `StorageClass` to your cluster | ||
```sh | ||
$ kubectl apply -f manifests/pod-with-volume.yaml | ||
|
||
storageclass.storage.k8s.io/ebs-sc created | ||
persistentvolumeclaim/ebs-claim created | ||
pod/app created | ||
``` | ||
|
||
2. Wait for the `PersistentVolumeClaim` to bind and the pod to reach the `Running` state | ||
```sh | ||
$ kubectl get pvc ebs-claim | ||
NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS VOLUMEATTRIBUTESCLASS AGEebs-claim Bound pvc-076b2d14-b643-47d4-a2ce-fbf9cd36572b 100Gi RWO ebs-sc <unset> 2m51s | ||
|
||
$ kubectl get pod app | ||
NAME READY STATUS RESTARTS AGE | ||
app 1/1 Running 0 3m24 | ||
``` | ||
|
||
3. Watch the logs of the pod | ||
```sh | ||
$ kubectl logs -f app | ||
Mon Feb 26 22:28:19 UTC 2024 | ||
Mon Feb 26 22:28:24 UTC 2024 | ||
Mon Feb 26 22:28:29 UTC 2024 | ||
Mon Feb 26 22:28:34 UTC 2024 | ||
Mon Feb 26 22:28:39 UTC 2024 | ||
... | ||
``` | ||
|
||
4. Simultaneously, deploy the `VolumeAttributesClass` and edit the `PersistentVolumeClaim` to point to this class | ||
```sh | ||
$ kubectl patch pvc ebs-claim --patch '{"spec": {"volumeAttributesClassName": "io2-class"}}' | ||
persistentvolumeclaim/ebs-claim patched | ||
``` | ||
|
||
5. Wait for the `VolumeAttributesClass` to apply to the volume | ||
```sh | ||
$ kubectl get pvc ebs-claim | ||
NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS VOLUMEATTRIBUTESCLASS AGE | ||
ebs-claim Bound pvc-076b2d14-b643-47d4-a2ce-fbf9cd36572b 100Gi RWO ebs-sc io2-class 5m54s | ||
``` | ||
|
||
6. (Optional) Delete example resources | ||
```sh | ||
$ kubectl delete -f manifests | ||
storageclass.storage.k8s.io "ebs-sc" deleted | ||
persistentvolumeclaim "ebs-claim" deleted | ||
pod "app" deleted | ||
volumeattributesclass.storage.k8s.io "io2-class" deleted | ||
``` |
39 changes: 39 additions & 0 deletions
39
examples/kubernetes/modify-volume/manifests/pod-with-volume.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
--- | ||
apiVersion: storage.k8s.io/v1 | ||
kind: StorageClass | ||
metadata: | ||
name: ebs-sc | ||
provisioner: ebs.csi.aws.com | ||
volumeBindingMode: WaitForFirstConsumer | ||
parameters: | ||
type: gp3 | ||
--- | ||
apiVersion: v1 | ||
kind: PersistentVolumeClaim | ||
metadata: | ||
name: ebs-claim | ||
spec: | ||
accessModes: | ||
- ReadWriteOnce | ||
storageClassName: ebs-sc | ||
resources: | ||
requests: | ||
storage: 100Gi | ||
--- | ||
apiVersion: v1 | ||
kind: Pod | ||
metadata: | ||
name: app | ||
spec: | ||
containers: | ||
- name: app | ||
image: centos | ||
command: ["/bin/sh"] | ||
args: ["-c", "while true; do echo $(date -u) | tee /data/out.txt; sleep 5; done"] | ||
volumeMounts: | ||
- name: persistent-storage | ||
mountPath: /data | ||
volumes: | ||
- name: persistent-storage | ||
persistentVolumeClaim: | ||
claimName: ebs-claim |
9 changes: 9 additions & 0 deletions
9
examples/kubernetes/modify-volume/manifests/volumeattributesclass.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
apiVersion: storage.k8s.io/v1alpha1 | ||
kind: VolumeAttributesClass | ||
metadata: | ||
name: io2-class | ||
driverName: ebs.csi.aws.com | ||
parameters: | ||
type: io2 | ||
iops: "10000" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
throughput