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

Replace PersistentVolume if volume source changes #1015

Merged
merged 1 commit into from
Mar 4, 2020

Conversation

lblackstone
Copy link
Member

Proposed changes

Add replacement cases for PersistentVolume to the diff
logic. All PersistentVolumeSource fields are immutable.

Related issues (optional)

Fixes #1014

Add replacement cases for PersistentVolume to the diff
logic. All PersistentVolumeSource fields are immutable.
@@ -78,6 +78,31 @@ var forceNew = _groups{
var core = _versions{
"v1": _kinds{
"ConfigMap": properties{".binaryData", ".data"},
"PersistentVolume": append(
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's link the volume types doc.


Any chance we can programmatically pull this list from the API?

e.g.

kubectl explain pod.spec.volumes shows all volume types so it seems like API's should be possible. Thoughts?

Copy link
Member Author

Choose a reason for hiding this comment

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

I pulled this info from the API reference, but am not sure of a reliable way to do so programmatically. I included everything that had a Kind name ending in VolumeSource, but these Kinds don't seem to share a common interface.

https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.17/#volume-v1-core

Copy link
Contributor

Choose a reason for hiding this comment

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

Not a fan of reflect in Go due to its perf cost, but is it worth considering asserting the various interfaces to approach this programmatically. Is this viable?

Copy link
Member Author

Choose a reason for hiding this comment

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

Since the rest of this file is also manually curated for now, I'm inclined to defer further work here. We need to figure out a more robust approach at some point, but that's probably going to involve upstream work to fix the k8s OpenAPI spec.

Copy link
Member Author

Choose a reason for hiding this comment

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

PersistentVolume immutable fields don't trigger replace
2 participants