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

feat: Render error message condition as json/structured message #3977

Merged
merged 8 commits into from
Jan 24, 2023
5 changes: 3 additions & 2 deletions .github/actions/kamel-prepare-env/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,11 @@ runs:
df -h

- name: Set up JDK 11
uses: AdoptOpenJDK/install-jdk@v1
uses: actions/setup-java@v3
if: ${{ env.ENV_PREPARED != 'true' }}
with:
version: "11"
java-version: '11'
distribution: 'temurin'

- name: Set up Go
uses: actions/setup-go@v2 # Version 2 adds GOBIN to PATH
Expand Down
14 changes: 7 additions & 7 deletions addons/strimzi/duck/client/internalclientset/fake/register.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions addons/strimzi/duck/client/internalclientset/scheme/register.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

60 changes: 60 additions & 0 deletions config/crd/bases/camel.apache.org_integrations.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7388,6 +7388,66 @@ spec:
description: A human-readable message indicating details about
the transition.
type: string
pods:
description: Pods collect health and conditions information
from the owned PODs
items:
properties:
condition:
description: PodCondition contains details for the current
condition of this pod.
properties:
lastProbeTime:
description: Last time we probed the condition.
format: date-time
type: string
lastTransitionTime:
description: Last time the condition transitioned
from one status to another.
format: date-time
type: string
message:
description: Human-readable message indicating details
about last transition.
type: string
reason:
description: Unique, one-word, CamelCase reason for
the condition's last transition.
type: string
status:
description: 'Status is the status of the condition.
Can be True, False, Unknown. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#pod-conditions'
type: string
type:
description: 'Type is the type of the condition. More
info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#pod-conditions'
type: string
required:
- status
- type
type: object
health:
items:
properties:
data:
description: RawMessage is a raw encoded JSON value.
It implements Marshaler and Unmarshaler and can
be used to delay JSON decoding or precompute a
JSON encoding.
type: object
x-kubernetes-preserve-unknown-fields: true
name:
type: string
status:
type: string
type: object
type: array
name:
type: string
required:
- condition
type: object
type: array
reason:
description: The reason for the condition's last transition.
type: string
Expand Down
60 changes: 60 additions & 0 deletions config/crd/bases/camel.apache.org_kameletbindings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8342,6 +8342,66 @@ spec:
description: A human readable message indicating details about
the transition.
type: string
pods:
description: Pods collect health and conditions information
from the owned PODs
items:
properties:
condition:
description: PodCondition contains details for the current
condition of this pod.
properties:
lastProbeTime:
description: Last time we probed the condition.
format: date-time
type: string
lastTransitionTime:
description: Last time the condition transitioned
from one status to another.
format: date-time
type: string
message:
description: Human-readable message indicating details
about last transition.
type: string
reason:
description: Unique, one-word, CamelCase reason for
the condition's last transition.
type: string
status:
description: 'Status is the status of the condition.
Can be True, False, Unknown. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#pod-conditions'
type: string
type:
description: 'Type is the type of the condition. More
info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#pod-conditions'
type: string
required:
- status
- type
type: object
health:
items:
properties:
data:
description: RawMessage is a raw encoded JSON value.
It implements Marshaler and Unmarshaler and can
be used to delay JSON decoding or precompute a
JSON encoding.
type: object
x-kubernetes-preserve-unknown-fields: true
name:
type: string
status:
type: string
type: object
type: array
name:
type: string
required:
- condition
type: object
type: array
reason:
description: The reason for the condition's last transition.
type: string
Expand Down
123 changes: 123 additions & 0 deletions docs/modules/ROOT/partials/apis/camel-k-crds.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -1191,6 +1191,83 @@ Flow is an unstructured object representing a Camel Flow in YAML/JSON DSL

|===

[#_camel_apache_org_v1_HealthCheck]
=== HealthCheck



[cols="2,2a",options="header"]
|===
|Field
|Description

|`status` +
*xref:#_camel_apache_org_v1_HealthCheckStatus[HealthCheckStatus]*
|




|`checks` +
*xref:#_camel_apache_org_v1_HealthCheckResponse[[\]HealthCheckResponse]*
|





|===

[#_camel_apache_org_v1_HealthCheckResponse]
=== HealthCheckResponse

*Appears on:*

* <<#_camel_apache_org_v1_HealthCheck, HealthCheck>>
* <<#_camel_apache_org_v1_PodCondition, PodCondition>>



[cols="2,2a",options="header"]
|===
|Field
|Description

|`name` +
string
|




|`status` +
*xref:#_camel_apache_org_v1_HealthCheckStatus[HealthCheckStatus]*
|




|`data` +
*xref:#_camel_apache_org_v1_RawMessage[RawMessage]*
|





|===

[#_camel_apache_org_v1_HealthCheckStatus]
=== HealthCheckStatus(`string` alias)

*Appears on:*

* <<#_camel_apache_org_v1_HealthCheck, HealthCheck>>
* <<#_camel_apache_org_v1_HealthCheckResponse, HealthCheckResponse>>




[#_camel_apache_org_v1_IntegrationCondition]
=== IntegrationCondition

Expand Down Expand Up @@ -1254,6 +1331,13 @@ string

A human-readable message indicating details about the transition.

|`pods` +
*xref:#_camel_apache_org_v1_PodCondition[[\]PodCondition]*
|


Pods collect health and conditions information from the owned PODs


|===

Expand Down Expand Up @@ -2429,6 +2513,44 @@ See https://maven.apache.org/ref/3.8.4/maven-embedder/cli.html.



[#_camel_apache_org_v1_PodCondition]
=== PodCondition

*Appears on:*

* <<#_camel_apache_org_v1_IntegrationCondition, IntegrationCondition>>



[cols="2,2a",options="header"]
|===
|Field
|Description

|`name` +
string
|




|`condition` +
*https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.20/#podcondition-v1-core[Kubernetes core/v1.PodCondition]*
|




|`health` +
*xref:#_camel_apache_org_v1_HealthCheckResponse[[\]HealthCheckResponse]*
|





|===

[#_camel_apache_org_v1_PodSpec]
=== PodSpec

Expand Down Expand Up @@ -2612,6 +2734,7 @@ where to publish the final image

* <<#_camel_apache_org_v1_AddonTrait, AddonTrait>>
* <<#_camel_apache_org_v1_Flow, Flow>>
* <<#_camel_apache_org_v1_HealthCheckResponse, HealthCheckResponse>>
* <<#_camel_apache_org_v1_TraitConfiguration, TraitConfiguration>>

RawMessage is a raw encoded JSON value.
Expand Down
7 changes: 7 additions & 0 deletions docs/modules/ROOT/partials/apis/kamelets-crds.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -767,6 +767,13 @@ string

A human readable message indicating details about the transition.

|`pods` +
*xref:apis/camel-k.adoc#_camel_apache_org_v1_PodCondition[[\]github.com/apache/camel-k/pkg/apis/camel/v1.PodCondition]*
|


Pods collect health and conditions information from the owned PODs


|===

Expand Down
23 changes: 1 addition & 22 deletions e2e/global/common/kamelet_binding_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func TestKameletBinding(t *testing.T) {
t.Run("test error handler", func(t *testing.T) {
RegisterTestingT(t)
Expect(createErrorProducerKamelet(ns, "my-own-error-producer-source")()).To(Succeed())
Expect(createLogKamelet(ns, "my-own-log-sink")()).To(Succeed())
Expect(CreateLogKamelet(ns, "my-own-log-sink")()).To(Succeed())
from := corev1.ObjectReference{
Kind: "Kamelet",
Name: "my-own-error-producer-source",
Expand Down Expand Up @@ -149,27 +149,6 @@ func TestKameletBinding(t *testing.T) {
})
}

func createLogKamelet(ns string, name string) func() error {
flow := map[string]interface{}{
"from": map[string]interface{}{
"uri": "kamelet:source",
"steps": []map[string]interface{}{
{
"to": "log:{{loggerName}}",
},
},
},
}

props := map[string]v1alpha1.JSONSchemaProp{
"loggerName": {
Type: "string",
},
}

return CreateKamelet(ns, name, flow, props, nil)
}

func createErrorProducerKamelet(ns string, name string) func() error {
props := map[string]v1alpha1.JSONSchemaProp{
"message": {
Expand Down
Loading