-
Notifications
You must be signed in to change notification settings - Fork 116
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This fixes an issue where `WaitForFirstConsumer` PVCs could cause deadlocks due to the downstream consumer waiting for the PVC to be bound. We now attempt to fetch the PVC's storage class and the corresponding `volumeBindMode`. If we can find the bind mode, then we consider a `WaitForFirstConsumer ` PVC ready once it's `Pending`. The existing behavior is preserved if we can't find the bind mode, or if it's `Immediate`. An e2e test is included. I'm omitting unit tests as this might end up getting refactored in some later PRs. Fixes #895.
- Loading branch information
Showing
6 changed files
with
189 additions
and
24 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
name: pvc | ||
runtime: yaml | ||
description: | | ||
Tests PVC with WaitForFirstConsumer (https://github.com/pulumi/pulumi-kubernetes/issues/895) | ||
resources: | ||
ns: | ||
type: kubernetes:core/v1:Namespace | ||
|
||
provider: | ||
type: pulumi:providers:kubernetes | ||
properties: | ||
namespace: ${ns.metadata.name} | ||
|
||
sc: | ||
type: kubernetes:storage.k8s.io/v1:StorageClass | ||
properties: | ||
volumeBindingMode: WaitForFirstConsumer | ||
provisioner: rancher.io/local-path | ||
options: | ||
provider: ${provider} | ||
|
||
pvc: | ||
type: kubernetes:core/v1:PersistentVolumeClaim | ||
properties: | ||
spec: | ||
accessModes: | ||
- ReadWriteOnce | ||
storageClassName: ${sc.metadata.name} | ||
resources: | ||
requests: | ||
storage: 1Mi | ||
options: | ||
provider: ${provider} | ||
|
||
outputs: | ||
status: ${pvc.status.phase} |
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,64 @@ | ||
name: pvc | ||
runtime: yaml | ||
description: | | ||
Tests PVC with WaitForFirstConsumer (https://github.com/pulumi/pulumi-kubernetes/issues/895) | ||
resources: | ||
ns: | ||
type: kubernetes:core/v1:Namespace | ||
|
||
provider: | ||
type: pulumi:providers:kubernetes | ||
properties: | ||
namespace: ${ns.metadata.name} | ||
|
||
sc: | ||
type: kubernetes:storage.k8s.io/v1:StorageClass | ||
properties: | ||
volumeBindingMode: WaitForFirstConsumer | ||
provisioner: rancher.io/local-path | ||
options: | ||
provider: ${provider} | ||
|
||
pvc: | ||
type: kubernetes:core/v1:PersistentVolumeClaim | ||
properties: | ||
spec: | ||
accessModes: | ||
- ReadWriteOnce | ||
storageClassName: ${sc.metadata.name} | ||
resources: | ||
requests: | ||
storage: 1Mi | ||
options: | ||
provider: ${provider} | ||
|
||
# Add a deployment to consume the PVC. | ||
deployment: | ||
type: kubernetes:apps/v1:Deployment | ||
properties: | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
app: nginx | ||
template: | ||
metadata: | ||
labels: | ||
app: nginx | ||
spec: | ||
containers: | ||
- name: nginx | ||
image: nginx:stable-alpine3.17-slim | ||
volumeMounts: | ||
- name: local | ||
mountPath: /usr/share/nginx/html | ||
volumes: | ||
- name: local | ||
persistentVolumeClaim: | ||
claimName: ${pvc.metadata.name} | ||
options: | ||
provider: ${provider} | ||
|
||
outputs: | ||
status: ${pvc.status.phase} |