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

Unexpected resource key on the v0.47.3-rc0 #4994

Open
ffjlabo opened this issue Jun 25, 2024 · 0 comments
Open

Unexpected resource key on the v0.47.3-rc0 #4994

ffjlabo opened this issue Jun 25, 2024 · 0 comments
Assignees
Labels
kind/bug Something isn't working

Comments

@ffjlabo
Copy link
Member

ffjlabo commented Jun 25, 2024

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
PipeCD

Environment:

  • piped version: v0.47.3-rc0
  • control-plane version:
  • Others:
@ffjlabo ffjlabo added the kind/bug Something isn't working label Jun 25, 2024
@ffjlabo ffjlabo self-assigned this Jun 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working
Projects
Status: 📋 New
Status: No status
Development

No branches or pull requests

1 participant