Skip to content

Comments

Upgrade controller-runtime to v0.23.1#1395

Merged
matheuscscp merged 2 commits intomainfrom
c-r-0.23
Jan 28, 2026
Merged

Upgrade controller-runtime to v0.23.1#1395
matheuscscp merged 2 commits intomainfrom
c-r-0.23

Conversation

@matheuscscp
Copy link
Member

@matheuscscp matheuscscp commented Jan 27, 2026

Fixes: #1394

This PR is also fixing CRD upgrades with the CreateReplace policy, whose test that runs only in the main branch is failing:

https://github.com/fluxcd/helm-controller/actions/runs/21357699633

@matheuscscp matheuscscp added the dependencies Pull requests that update a dependency label Jan 27, 2026
@matheuscscp matheuscscp changed the title Upgrade controller-runtime to v0.23.1 Upgrade controller-runtime to v0.23.1 Jan 27, 2026
@matheuscscp matheuscscp force-pushed the c-r-0.23 branch 3 times, most recently from bf4b93a to 0062015 Compare January 27, 2026 23:18
@matheuscscp
Copy link
Member Author

There are two issues with CRDs:

  1. First issue is trivial, fixed in 0062015
  2. Second issue: Helm's kstatus implementation is getting stuck waiting after the CreateReplace

Still investigating 2. (and wondering if we can hard-code the legacy waiter for CRDs...)

@matheuscscp
Copy link
Member Author

matheuscscp commented Jan 27, 2026

Still investigating 2. (and wondering if we can hard-code the legacy waiter for CRDs...)

Simple: kstatus has no special handling for CRDs and CRDs do not have the Ready condition :)

This is Helm's legacy waiting logic for CRDs:

func (c *ReadyChecker) crdReady(crd apiextv1.CustomResourceDefinition) bool {
	for _, cond := range crd.Status.Conditions {
		switch cond.Type {
		case apiextv1.Established:
			if cond.Status == apiextv1.ConditionTrue {
				return true
			}
		case apiextv1.NamesAccepted:
			if cond.Status == apiextv1.ConditionFalse {
				// This indicates a naming conflict, but it's probably not the
				// job of this function to fail because of that. Instead,
				// we treat it as a success, since the process should be able to
				// continue.
				return true
			}
		default:
			// intentionally left empty
		}
	}
	return false
}

@matheuscscp
Copy link
Member Author

Actually, kstatus does have logic for CRDs:

func crdConditions(u *unstructured.Unstructured) (*Result, error) {
	obj := u.UnstructuredContent()

	objc, err := GetObjectWithConditions(obj)
	if err != nil {
		return nil, err
	}

	for _, c := range objc.Status.Conditions {
		if c.Type == "NamesAccepted" && c.Status == corev1.ConditionFalse {
			return newFailedStatus(c.Reason, c.Message), nil
		}
		if c.Type == "Established" {
			if c.Status == corev1.ConditionFalse && c.Reason != "Installing" {
				return newFailedStatus(c.Reason, c.Message), nil
			}
			if c.Status == corev1.ConditionTrue {
				return &Result{
					Status:     CurrentStatus,
					Message:    "CRD is established",
					Conditions: []Condition{},
				}, nil
			}
		}
	}
	return newInProgressStatus("Installing", "Install in progress"), nil
}

@matheuscscp
Copy link
Member Author

kstatus is correctly waiting for the CRDs, the issue is actually waiting for the CRs, see: helm/helm#31768

@matheuscscp matheuscscp force-pushed the c-r-0.23 branch 3 times, most recently from d0be692 to 6d024fe Compare January 28, 2026 09:10
Signed-off-by: Matheus Pimenta <matheuscscp@gmail.com>
Signed-off-by: Matheus Pimenta <matheuscscp@gmail.com>
Copy link
Member

@stefanprodan stefanprodan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@matheuscscp matheuscscp merged commit dacd7ea into main Jan 28, 2026
5 checks passed
@matheuscscp matheuscscp deleted the c-r-0.23 branch January 28, 2026 10:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency

Projects

None yet

Development

Successfully merging this pull request may close these issues.

New default queue from controller-runtime causes uninstall upgrade remediation to leave the release uninstalled

2 participants