Skip to content

feat: I expose CamelMonitor availability on Integrations - #6902

Open
manduinca wants to merge 2 commits into
apache:mainfrom
manduinca:feature/6898-camel-monitor-condition
Open

manduinca wants to merge 2 commits into
apache:mainfrom
manduinca:feature/6898-camel-monitor-condition

Conversation

@manduinca

@manduinca manduinca commented Oct 22, 2026 •

Copy link
Copy Markdown

I add the CamelMonitorAvailable condition and a final Camel Monitor kubectl column to show whether an Integration has an associated monitor. I keep resource discovery independent of runtime readiness.

I let optional CamelMonitor watches enqueue the Integration and update the condition through the existing monitor action and status update path. I remove the condition when the resource is absent, unassociated, or its API is not installed. Lookup failures report Unknown and use normal controller retries; they do not prevent the runtime monitoring checks from running.

I verify the monitor's name, namespace and owner UID, either directly through the Integration or through its Deployment/CronJob. I reuse the unstructured lookup helper and handle creation, deletion and ownership changes, including non-controller owners. The lookup follows the same-name contract; it does not discover revision-suffixed monitors.

I register optional watches after checking discovery and permissions for each effective namespace. I add only get/list/watch permissions for CamelMonitor and regenerate the CRD and Helm artifacts. I document the restart needed when the CRD or watch permissions are added after operator startup.

Validation:

  • 39 CamelMonitor test results pass, including the real monitor action lifecycle, idempotent early exits, ownership, optional watches and permissions. A lookup failure still allows normal runtime monitoring to move an Integration from Deploying to Running and update Ready.
  • make generate, make update-docs, make fmt, make goimport and make lint pass; lint reports 0 issues. The source and generated CRD/Helm column order match.
  • The unfiltered make test run reports 1,421 passes, one skip and one failure: TestGitCloneCommit in the unchanged builder package. The same worktree contains unstaged changes failure was reproduced in a clean worktree at main (a27343186).
  • I have not run cluster e2e tests.

Fixes #6898

For the code, AI directed by me (@manduinca). I write it, AI helps with my English.

I add an informational condition and kubectl column to show whether
an Integration has an associated CamelMonitor. I verify direct ownership
or the bounded Deployment/CronJob chain by namespace, name and UID.

I reuse unstructured lookup and optional watches to keep the discovery
condition current without changing runtime readiness. I add focused
regression tests, minimal read permissions and regenerated CRD/Helm assets.

Fixes apache#6898

@squakez squakez left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for the PR. I think the logic can be simplified.

We should "watch" the CamelMonitor resources (when installed) and trigger a drift if a cmon is either created or removed. Then, in the monitoring state, the existing monitor action should just add or remove the condition accordingly.

Comment thread pkg/apis/camel/v1/integration_types.go Outdated
// +kubebuilder:storageversion
// +kubebuilder:subresource:scale:specpath=.spec.replicas,statuspath=.status.replicas,selectorpath=.status.selector
// +kubebuilder:printcolumn:name="Phase",type=string,JSONPath=`.status.phase`,description="The integration phase"
// +kubebuilder:printcolumn:name="Camel Monitor",type=string,JSONPath=`.status.conditions[?(@.type=="CamelMonitorAvailable")].status`,description="Whether an associated CamelMonitor resource is available"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Better move as last column

I let CamelMonitor events use normal reconciliation and update the
availability condition from the existing monitor action. I remove the
separate status patch and fixed retry from the reconciler.

I clear the condition when the association disappears and keep lookup
errors from interrupting normal runtime monitoring. I move the kubectl
column last and update the regression tests and documentation.

Fixes apache#6898
@manduinca

Copy link
Copy Markdown
Author

I've pushed the requested update: the column is last, and the condition uses the existing monitor action. The focused tests pass; the known baseline failure is documented in the description. Could you approve the pending workflows and take another look once CI has run?

I write it, AI helps with my English (@manduinca).

// updateCamelMonitorCondition reports resource discovery, independently of runtime readiness.
// Lookup failures use the existing action error/retry path.
func updateCamelMonitorCondition(ctx context.Context, c ctrl.Reader, integration *v1.Integration) error {
monitor, err := kubernetes.GetUnstructured(ctx, c, camelMonitorGVK, integration.Name, integration.Namespace)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We should avoid to use the "unstructured" type and use instead the api coming from https://github.com/camel-tooling/camel-monitor-operator project.

@squakez

squakez commented Oct 24, 2026

Copy link
Copy Markdown
Contributor

I've pushed the requested update: the column is last, and the condition uses the existing monitor action. The focused tests pass; the known baseline failure is documented in the description. Could you approve the pending workflows and take another look once CI has run?

Sorry, it does not seem to go in the right direction. I have the feeling this work require a bit more knowledge on the foundation for the project. I'm removing the "good first issue" as it does not seem to be that easy as we originally thought.

This branch has not been deployed

No deployments
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

Successfully merging this pull request may close these issues.

Add a condition and a kubebuilder flag for CamelMonitor resources

2 participants