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

Triggers ignore namespace attribute #1405

Open
treyhyde opened this issue Dec 21, 2021 · 6 comments
Open

Triggers ignore namespace attribute #1405

treyhyde opened this issue Dec 21, 2021 · 6 comments

Comments

@treyhyde
Copy link

For a trigger defined as

apiVersion: config.lighthouse.jenkins-x.io/v1alpha1
kind: TriggerConfig
spec:
  presubmits:
  - name: e2e
    namespace: cypress-e2e
    context: "cypress/e2e"
    always_run: false
    require_run: true
    optional: false
    trigger: "/test"
    rerun_command: "/retest"
    source: e2e.yaml
    error_on_eviction: false

a LighthouseJob is created

kind: LighthouseJob
...
spec:
  agent: tekton-pipeline
  context: cypress/e2e
  job: e2e
  namespace: cypress-e2e
  pipeline_run_spec:
    pipelineSpec:
...

however, the PipelineRun is created in the lighthouse namespace, not cypress-e2e as I would expect.

- apiVersion: tekton.dev/v1beta1
  kind: PipelineRun
  metadata:
   ...
    name: ...cypress-e2e-8d9fk
    namespace: lighthouse
@treyhyde
Copy link
Author

treyhyde commented Jan 4, 2022

This also fails if you assume a single namespace and change your global prowjob_namespace, pod_namespace attributes to something besides lighthouse

{"component":"lighthouse-tekton-controller","controller":"tekton-controller","file":".../code/lighthouse/pkg/engines/tekton/controller.go:124","func":"github.com/jenkins-x/lighthouse/pkg/engines/tekton.(*LighthouseJobReconciler).Reconcile","level":"error","msg":"Failed to set owner reference: cross-namespace owner references are disallowed, owner's namespace lighthouse, obj's namespace cypress-e2e","time":"2022-01-04T00:58:44Z"}

@treyhyde
Copy link
Author

treyhyde commented Jan 4, 2022

If I switch the tekton/controller.go namespace to be job.Spec.Namespace in various places, I again get failures do to kube owner references being cross namespaces... There are "namespace" fields all over the place, but it seems they all need to be the same?

@CPinhoK
Copy link

CPinhoK commented May 15, 2023

Did you ever solve this problem @treyhyde

@CPinhoK
Copy link

CPinhoK commented May 15, 2023

/kind question

@treyhyde
Copy link
Author

Did you ever solve this problem @treyhyde

No, we gave up on lighthouse

@mathew-fleisch
Copy link

mathew-fleisch commented May 16, 2024

I know this is an old issue, but I think I found why this is (still) happening, but I'm not sure how to fix/test a change. maybe @ankitm123 or @abayer knows since they touched the tekton controller last... 😬 sorry for the ping.
It seems to me like this function passes the same namespace that the lighthouseJob uses to build the tekton pipelineRun resource, rather than pulling the namespace from the triggerConfig:
https://github.com/jenkins-x/lighthouse/blob/main/pkg/engines/tekton/controller.go#L113

My question is, can we pull the namespace from triggerConfig like @treyhyde and I expected, rather than using the namespace that the lighthouseJob uses? I have a bit of go experience, but I don't know how to test these changes or add some breakpoints to inspect variables to pass the correct one in an actual deployment with other lighthouse components.

This seems like a bug that forces one to install lighthouse in the same namespace that the tekton pipelineRun resources are running, and limits to that one namespace.

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

No branches or pull requests

3 participants