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

type: Reference complains about empty namespace #27

Closed
JohanSandblom3 opened this issue Aug 30, 2024 · 4 comments
Closed

type: Reference complains about empty namespace #27

JohanSandblom3 opened this issue Aug 30, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@JohanSandblom3
Copy link

What happened?

When trying to get extra resource using Reference a ReconcileError happens.

How can we reproduce it?

composition step:

  - step: run-function-extra-resources
    functionRef:
      name: function-extra-resources
    input:
      apiVersion: extra-resources.fn.crossplane.io/v1beta1
      kind: Input
      spec:
        extraResources:
        - apiVersion: v1
          into: my-secret-into
          kind: Secret
          ref:
            name: my-secret
          type: Reference

Status of XR:

status:
  conditions:
  - lastTransitionTime: "2024-08-30T12:05:20Z"
    message: 'cannot compose resources: fetching resources for my-secret-into: cannot
      get extra resource by name: an empty namespace may not be set when a resource
      name is provided'
    reason: ReconcileError
    status: "False"
    type: Synced

The very secret secret

kubectl create secret generic my-secret --from-literal=secret=value

What environment did it happen in?

Function version: v0.0.3
Crossplane version: 1.16.0-up.1

All running locally in a kind cluster.

  • Cloud provider or hardware configuration
  • Kubernetes version v1.25.3
  • Kubernetes distribution kind
  • OS Ubuntu 22.04.3 LTS on WSL2
  • Kernel Linux CND1323TQQ 5.15.153.1-microsoft-standard-WSL2 fix(deps): update module k8s.io/apimachinery to v0.32.0 #1 SMP Fri Mar 29 23:14:13 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
@JohanSandblom3 JohanSandblom3 added the bug Something isn't working label Aug 30, 2024
@JohanSandblom3
Copy link
Author

JohanSandblom3 commented Aug 30, 2024

Shot in the dark here. Could it be that this is a bug in Crossplane?
https://github.com/crossplane/crossplane/blob/master/internal/controller/apiextensions/composite/extra_resources.go#L122

Ref:
https://github.com/kubernetes/kubernetes/blob/master/staging/src/k8s.io/client-go/rest/request.go#L1032-L1034

They way I understand this is that namespace should be nil and never empty string when calling the API. Crossplane's usage of types.NamespacedName{Name: rs.GetMatchName()}(ref) will result in namespace being "" when it in fact have to be nil

@bobh66
Copy link

bobh66 commented Aug 30, 2024

Secrets are namespaced so I would think it would be required? The function should probably accept a namespace if it is provided. I guess the better question is whether function-extra-resources supports namespaced resources?

@phisco
Copy link
Collaborator

phisco commented Sep 3, 2024

Hi, yes, it's required, only cluster-scoped resources are allowed, the error message could be definitely more explicit.

@JohanSandblom3
Copy link
Author

Hi, yes, it's required, only cluster-scoped resources are allowed, the error message could be definitely more explicit.

Ok, closing this issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants