Unexpected resource key on the v0.47.3-rc0
ffjlabo opened this issue · 1 comments
What happened:
When deploying a namespaced resource with spec.input.namespace in the app.piped.yaml, the namespace in the resource key isn't correct.
For example, I deployed the Deployment resource with the app.pipecd.yaml which has spec.input.namespace: test
using v0.47.3-rc0.
I expected the resource key as apps/v1:Deployment:test:namescoped-and-clusterrole-with-ns
. But it is apps/v1:Deployment::namescoped-and-clusterrole-with-ns
, which doesn't have a namespace.
% kubectl describe deployment namescoped-and-clusterrole-with-ns --namespace test
Name: namescoped-and-clusterrole-with-ns
Namespace: test
CreationTimestamp: Tue, 25 Jun 2024 22:12:21 +0900
Labels: app=namescoped-and-clusterrole-with-ns
Annotations: deployment.kubernetes.io/revision: 1
pipecd.dev/application: 01febc94-f3d7-4e72-b028-c79b60420839
pipecd.dev/commit-hash: ebf50778fb9959353ed00d8466c7de56f98e29a2
pipecd.dev/managed-by: piped
pipecd.dev/original-api-version: apps/v1
pipecd.dev/piped: 26964575-5537-4157-ab2c-ce891a7d3b31
pipecd.dev/resource-key: apps/v1:Deployment::namescoped-and-clusterrole-with-ns
pipecd.dev/variant: primary
Selector: app=namescoped-and-clusterrole-with-ns,pipecd.dev/variant=primary
...
The resource key is used to prune unused resources so should be the correct value.
What you expected to happen:
The resource key when reading manifest from git repo should be apps/v1:Deployment:test:namescoped-and-clusterrole-with-ns
How to reproduce it:
For example, deploy a Deployment resource with spec.input.namespace:test
in the app.piped.yaml.
app,pipecd.yaml↓
apiVersion: pipecd.dev/v1beta1
kind: KubernetesApp
spec:
name: namescoped-and-clusterrole-with-ns
input:
namespace: test
labels:
env: namescoped-and-clusterrole-with-ns
team: product
quickSync:
prune: true
description: |
This is a test app for clusterrole. Especially for testing the prune on QuickSync.
deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: namescoped-and-clusterrole-with-ns
labels:
app: namescoped-and-clusterrole-with-ns
spec:
replicas: 1
selector:
matchLabels:
app: namescoped-and-clusterrole-with-ns
pipecd.dev/variant: primary
template:
metadata:
labels:
app: namescoped-and-clusterrole-with-ns
pipecd.dev/variant: primary
annotations:
sidecar.istio.io/inject: "false"
spec:
containers:
- name: helloworld
image: ghcr.io/pipe-cd/helloworld:v0.32.0
args:
- server
ports:
- containerPort: 9085
Environment:
piped
version: v0.47.3-rc0control-plane
version:- Others:
We will fix it later on pipedv1.