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

TektonConfig Fails To Reconcile if Pruner Settings Are Missing #2450

Open
adambkaplan opened this issue Dec 9, 2024 · 2 comments
Open

TektonConfig Fails To Reconcile if Pruner Settings Are Missing #2450

adambkaplan opened this issue Dec 9, 2024 · 2 comments
Labels
kind/bug Categorizes issue or PR as related to a bug.

Comments

@adambkaplan
Copy link

Expected Behavior

If a TektonConfig object is created without the .spec.pruner.keep or .spec.pruner.keep-since setting, the operator applies a default setting to one of these values.

Actual Behavior

If the .spec.pruner.keep and .spec.pruner.keep-since settings are missing, the operator fails to reconcile because any update request is blocked by the validating webhook

Steps to Reproduce the Problem

Observed when deploying the Shipwright Operator with OLM, which uses API dependency resolution to deploy the Tekton Operator.

Additional Info

  • Kubernetes version:

    Output of kubectl version:

Version 1.30.z


- Tekton Pipeline version: 0.62.x

**Output of `tkn version` or `kubectl get pods -n tekton-pipelines -l app=tekton-pipelines-controller -o=jsonpath='{.items[0].metadata.labels.version}'`**


<!-- Any other additional information -->

Log from Tekton Operator:

{"level":"info","timestamp":"2024-11-25T18:36:53.401Z","logger":"tekton-operator-lifecycle.event-broadcaster","caller":"record/event.go:364","msg":"Event(v1.ObjectReference{Kind:"TektonConfig", Namespace:"", Name:"config", UID:"de70e9b6-ec63-4b25-b377-add833640a29", APIVersion:"operator.tekton.dev/v1alpha1", ResourceVersion:"17433", FieldPath:""}): type: 'Warning' reason: 'UpdateFailed' Failed to update status for "config": admission webhook "validation.webhook.operator.tekton.dev" denied the request: validation failed: expected exactly one, got neither: spec.pruner.keep, spec.pruner.keep-since\nmissing field(s): spec.pruner.resources","commit":"391a4f0","knative.dev/pod":"openshift-pipelines-operator-648cb677d9-vv4fc"}


Red Hat issue tracker: https://issues.redhat.com/browse/SRVKP-6832

Related Shipwright operator bug: https://github.com/shipwright-io/operator/issues/231
@adambkaplan adambkaplan added the kind/bug Categorizes issue or PR as related to a bug. label Dec 9, 2024
adambkaplan added a commit to adambkaplan/shipwright-operator that referenced this issue Dec 11, 2024
Starting in Tekton Operator v0.58.0, TektonConfig objects must set a
value for `keep` or `keepSince` if the pruner is enabled [1].
If Shipwright bootstraps the TektonConfig object and does not set a
value for `.spec.pruner.keep` (or `.keepSince`), it risks failing to
reconcile the TektonConfig instance or worse [2].

Fixing by setting the `keep` value to match the Tekton operator
default.

Fixes shipwright-io#231

[1] tektoncd/operator#410
[2] tektoncd/operator#2450
adambkaplan added a commit to adambkaplan/shipwright-operator that referenced this issue Dec 11, 2024
Starting in Tekton Operator v0.58.0, TektonConfig objects must set a
value for `keep` or `keepSince` if the pruner is enabled [1].
If Shipwright bootstraps the TektonConfig object and does not set a
value for `.spec.pruner.keep` (or `.keepSince`), it risks failing to
reconcile the TektonConfig instance or worse [2].

Fixing by setting the `keep` value to match the Tekton operator
default.

Fixes shipwright-io#231

[1] tektoncd/operator#410
[2] tektoncd/operator#2450

Signed-off-by: Adam Kaplan <[email protected]>
@jkhelil
Copy link
Member

jkhelil commented Dec 17, 2024

@adambkaplan defaulting one of these values is already there https://github.com/tektoncd/operator/blob/v0.73.0/pkg/apis/operator/v1alpha1/tektonconfig_defaults.go#L79
Can this be a race between shipwright operator trying to create tektonconfig without spec.pruner.keep and tekton operator trying to default it ?
There is also an alternative to have a default tektonconfig created by tekton operator via AUTOINSTALL_COMPONENTS
https://github.com/tektoncd/operator/blob/v0.73.0/operatorhub/openshift/release-artifacts/bundle/manifests/tekton-config-defaults_v1_configmap.yaml#L3

@adambkaplan
Copy link
Author

Can this be a race between shipwright operator trying to create tektonconfig without spec.pruner.keep and tekton operator trying to default it ?

I can't rule that out for certain. In any case we added a pruner default setting on the Shipwright operator side, and plan to release it soon: shipwright-io/operator#233

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug.
Projects
None yet
Development

No branches or pull requests

2 participants