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

Container trait : setting container.name result in wrong integration condition type Ready #3941

Closed
gansheer opened this issue Dec 20, 2022 · 1 comment · Fixed by #3951
Closed

Comments

@gansheer
Copy link
Contributor

gansheer commented Dec 20, 2022

Environment

Version of camel k client : main (commit 45c2205)
Kubernetes : minikube 1.27.1

Description

I was writing some e2e test on container trait that had a strange behavior on condition status checking.
Using a different Container trait value for container.name than the default integration results in an error in the monitoring of status in the integration object.

To reproduce the problem:

  • execute same route with the trait (and without to compare results):
$ kamel run Apps.java --name apps
$ kamel run Apps.java -t container.name=notintegration --name apps2
  • Check if the pods are running:
NAMESPACE     NAME                                   READY   STATUS    RESTARTS        AGE
default       pod/apps-5df75b99c-d6fdn               1/1     Running   0               9m39s
default       pod/apps2-657ccf8fd7-bfpwz             1/1     Running   0               9m31s
  • Check the integration without the trait:
...
status:
  conditions:
...
  - firstTruthyTime: "2022-12-20T16:17:59Z"
    lastTransitionTime: "2022-12-20T16:17:59Z"
    lastUpdateTime: "2022-12-20T16:17:59Z"
    message: 1/1 ready replicas
    reason: DeploymentReady
    status: "True"
    type: Ready
....
  • Check the integration with the trait:
...
status:
  conditions:
...
  - lastTransitionTime: "2022-12-20T16:18:05Z"
    lastUpdateTime: "2022-12-20T16:18:05Z"
    message: 0/1 ready replicas
    reason: DeploymentProgressing
    status: "False"
    type: Ready
....

The code that results in this error is the following :

func findIntegrationContainer(spec corev1.PodSpec) *corev1.Container {
for _, c := range spec.Containers {
if c.Name == "integration" {
return &c
}
}

The container name filter is the hardcoded "integration" value.

The only other way I see that could allow to filter "integration pods" would be to filter by the presence of metadata's label "camel.apache.org/integration" in the pod description.

@squakez @tadayosi do you see another way ?

@tadayosi
Copy link
Member

Good catch! Yes, it shouldn't be hardcoded there. Probably the only way to get the designated container name is to get it from the Integration's spec.traits.container.name?

gansheer added a commit to gansheer/camel-k that referenced this issue Dec 21, 2022
* Use `container.name` value if defined, else default to "integration" on condition status monitoring code

Fixes apache#3941
gansheer added a commit to gansheer/camel-k that referenced this issue Dec 21, 2022
* Use `container.name` value if defined, else default to "integration" on condition status monitoring code

Fixes apache#3941
gansheer added a commit to gansheer/camel-k that referenced this issue Dec 21, 2022
* Use `container.name` value if defined, else default to "integration" on condition status monitoring code

Fixes apache#3941
tadayosi pushed a commit that referenced this issue Dec 22, 2022
* Use `container.name` value if defined, else default to "integration" on condition status monitoring code

Fixes #3941
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 a pull request may close this issue.

2 participants