Plugin(s)
general
What happened?
While working on CronJob support for FindReferencingConfigMaps/FindReferencingSecrets, I noticed deleteVariantResources behaves differently between the two Kubernetes plugins.
In the regular kubernetes plugin, it checks if a resource is a workload using IsWorkload() this covers Deployment, StatefulSet, DaemonSet, ReplicaSet, and Pod.
In the kubernetes_multicluster plugin, the same function only checks IsDeployment() || IsStatefulSet().
So a canary/baseline resource that's a DaemonSet, ReplicaSet, or Pod won't be treated as a "workload" the same way on multicluster as it is on single cluster. It still gets deleted, but it's bucketed differently internally, which can cause it to be cleaned up in a different order than intended during rollback or canary teardown.
Not a crash, just an inconsistency between two plugins meant to behave the same way, and it could cause subtle ordering issues for anyone running DaemonSets on the multicluster plugin.
Steps to Reproduce
Set up a PipeCD Kubernetes multicluster deployment using a DaemonSet (or ReplicaSet/Pod) as the workload, with canary or baseline variants enabled.
Trigger a rollback or deployment that calls deleteVariantResources.
Compare the cleanup order/behavior against the same setup on the single cluster kubernetes plugin.
Expected Result
Both plugins should classify the same set of workload kinds (Deployment, StatefulSet, DaemonSet, ReplicaSet, Pod) when deciding cleanup order, since IsWorkload() already exists and is used elsewhere for this exact purpose.
Plugin version
built from main
Piped version
built from main
Environment information
Piped Environment
PipeCD Control Plane version: built from main (commit 1f2e3fbae)
OS: macOS (Ankit's local dev environment)
Piped configuration
apiVersion: pipecd.dev/v1beta1
kind: Piped
spec:
plugins:
- name: kubernetes_multicluster
port: 7001
url: https://xxxxxx
config:
...
deployTargets:
- name: xxx-dev
config:
...
Application configuration
apiVersion: pipecd.dev/v1beta1
kind: Application
spec:
pipeline:
...
plugins:
- name: kubernetes_multicluster
...
Log output
Not applicable, this issue was found via code review (comparing
deleteVariantResources in the kubernetes vs kubernetes_multicluster
plugins), not from a live deployment or runtime failure. No error logs
are involved. the bug is a logic/behavior inconsistency between the
two plugin implementations.
Additional context
Found this while working on CronJob support in FindReferencingConfigMaps/
FindReferencingSecrets (see #6761 / PR #7030). While comparing shared
logic between the kubernetes and kubernetes_multicluster plugins, I
noticed deleteVariantResources classifies workloads differently between
the two see "What happened" above for details.
Happy to submit a PR for this if the fix (swapping the check for
IsWorkload()) sounds right to a maintainer.
Plugin(s)
general
What happened?
While working on CronJob support for FindReferencingConfigMaps/FindReferencingSecrets, I noticed deleteVariantResources behaves differently between the two Kubernetes plugins.
In the regular kubernetes plugin, it checks if a resource is a workload using IsWorkload() this covers Deployment, StatefulSet, DaemonSet, ReplicaSet, and Pod.
In the kubernetes_multicluster plugin, the same function only checks IsDeployment() || IsStatefulSet().
So a canary/baseline resource that's a DaemonSet, ReplicaSet, or Pod won't be treated as a "workload" the same way on multicluster as it is on single cluster. It still gets deleted, but it's bucketed differently internally, which can cause it to be cleaned up in a different order than intended during rollback or canary teardown.
Not a crash, just an inconsistency between two plugins meant to behave the same way, and it could cause subtle ordering issues for anyone running DaemonSets on the multicluster plugin.
Steps to Reproduce
Set up a PipeCD Kubernetes multicluster deployment using a DaemonSet (or ReplicaSet/Pod) as the workload, with canary or baseline variants enabled.
Trigger a rollback or deployment that calls deleteVariantResources.
Compare the cleanup order/behavior against the same setup on the single cluster kubernetes plugin.
Expected Result
Both plugins should classify the same set of workload kinds (Deployment, StatefulSet, DaemonSet, ReplicaSet, Pod) when deciding cleanup order, since IsWorkload() already exists and is used elsewhere for this exact purpose.
Plugin version
built from main
Piped version
built from main
Environment information
Piped Environment
PipeCD Control Plane version: built from main (commit 1f2e3fbae)
OS: macOS (Ankit's local dev environment)
Piped configuration
Application configuration
Log output
Not applicable, this issue was found via code review (comparing deleteVariantResources in the kubernetes vs kubernetes_multicluster plugins), not from a live deployment or runtime failure. No error logs are involved. the bug is a logic/behavior inconsistency between the two plugin implementations.Additional context
Found this while working on CronJob support in FindReferencingConfigMaps/
FindReferencingSecrets (see #6761 / PR #7030). While comparing shared
logic between the kubernetes and kubernetes_multicluster plugins, I
noticed deleteVariantResources classifies workloads differently between
the two see "What happened" above for details.
Happy to submit a PR for this if the fix (swapping the check for
IsWorkload()) sounds right to a maintainer.