From 0058b19e5bb2fb2a7bf719943e2791995a8f7be2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Grzegorz=20Burzy=C5=84ski?= Date: Tue, 29 Oct 2024 18:17:01 +0100 Subject: [PATCH] add include snippet for checking conditions --- app/_includes/md/kgo/check-condition.md | 24 +++++++ .../certificate-and-cacertificate.md | 66 ++----------------- .../consumer-and-consumergroup.md | 66 ++----------------- .../guides/konnect-entities/dpcertificate.md | 16 +---- .../guides/konnect-entities/key-and-keyset.md | 34 +--------- .../konnect-entities/service-and-route.md | 51 +------------- .../konnect-entities/tagging-and-labeling.md | 17 +---- .../konnect-entities/upstream-and-target.md | 61 ++--------------- 8 files changed, 44 insertions(+), 291 deletions(-) create mode 100644 app/_includes/md/kgo/check-condition.md diff --git a/app/_includes/md/kgo/check-condition.md b/app/_includes/md/kgo/check-condition.md new file mode 100644 index 000000000000..db54ba64a2e0 --- /dev/null +++ b/app/_includes/md/kgo/check-condition.md @@ -0,0 +1,24 @@ +{% assign name = include.name %} +{% assign kind = include.kind %} +{% assign conditionType = include.conditionType | default: "Programmed" %} +{% assign reason = include.reason | default: "Programmed" %} +{% assign generation = include.generation | default: 1 %} + +{% unless include.disableDescription %} +You can verify the `{{ kind }}` was reconciled successfully by checking its `{{ conditionType }}` condition. +{% endunless %} + +```shell +kubectl get {{ kind | downcase }} {{ name }} -o=jsonpath='{.status.conditions[?(@.type=="{{ conditionType }}")]}' | jq +``` + +The output should look similar to this: + +```console +{ + "observedGeneration": {{ generation }}, + "reason": "{{ reason }}", + "status": "True", + "type": "{{ conditionType }}" +} +``` diff --git a/app/_src/gateway-operator/guides/konnect-entities/certificate-and-cacertificate.md b/app/_src/gateway-operator/guides/konnect-entities/certificate-and-cacertificate.md index 42da62907061..a495e7861d2c 100644 --- a/app/_src/gateway-operator/guides/konnect-entities/certificate-and-cacertificate.md +++ b/app/_src/gateway-operator/guides/konnect-entities/certificate-and-cacertificate.md @@ -62,22 +62,7 @@ spec: ' | kubectl apply -f - ``` -You can verify the `KongCertificate` was reconciled successfully by checking its `Programmed` condition. - -```shell -kubectl get kongcertificate cert -o=jsonpath='{.status.conditions}' | jq '.[] | select(.type == "Programmed")' -``` - -The output should look similar to this: - -```console -{ - "observedGeneration": 1, - "reason": "Programmed", - "status": "True", - "type": "Programmed" -} -``` +{% include md/kgo/check-condition.md name='cert' kind='KongCertificate' %} At this point, you should see the Certificate in the Gateway Manager UI. @@ -107,37 +92,9 @@ spec: You can ensure the `KongCertificate` reference is valid by checking the `KongSNI`'s `KongCertificateRefValid` condition. -```shell -kubectl get kongsni example-sni -o=jsonpath='{.status.conditions}' | jq '.[] | select(.type == "KongCertificateRefValid")' -``` - -The output should look similar to this: +{% include md/kgo/check-condition.md name='example-sni' kind='KongSNI' conditionType='KongCertificateRefValid' reason='Valid' disableDescription=true %} -```console -{ - "observedGeneration": 1, - "reason": "Valid", - "status": "True", - "type": "KongCertificateRefValid" -} -``` - -You can verify the `KongSNI` was reconciled successfully by checking its `Programmed` condition. - -```shell -kubectl get kongsni example-sni -o=jsonpath='{.status.conditions}' | jq '.[] | select(.type == "Programmed")' -``` - -The output should look similar to this: - -```console -{ - "observedGeneration": 1, - "reason": "Programmed", - "status": "True", - "type": "Programmed" -} -``` +{% include md/kgo/check-condition.md name='example-sni' kind='KongSNI' %} At this point, you should see the SNI in the Certificate's SNIs in the Gateway Manager UI. @@ -181,21 +138,6 @@ spec: ' | kubectl apply -f - ``` -You can verify the `KongCACertificate` was reconciled successfully by checking its `Programmed` condition. - -```shell -kubectl get kongcacertificate ca-cert -o=jsonpath='{.status.conditions}' | jq '.[] | select(.type == "Programmed")' -``` - -The output should look similar to this: - -```console -{ - "observedGeneration": 1, - "reason": "Programmed", - "status": "True", - "type": "Programmed" -} -``` +{% include md/kgo/check-condition.md name='ca-cert' kind='KongCACertificate' %} At this point, you should see the CA Certificate in the Gateway Manager UI. diff --git a/app/_src/gateway-operator/guides/konnect-entities/consumer-and-consumergroup.md b/app/_src/gateway-operator/guides/konnect-entities/consumer-and-consumergroup.md index c012141a4d37..aa056fdb56a0 100644 --- a/app/_src/gateway-operator/guides/konnect-entities/consumer-and-consumergroup.md +++ b/app/_src/gateway-operator/guides/konnect-entities/consumer-and-consumergroup.md @@ -38,22 +38,7 @@ spec: ' | kubectl apply -f - ``` -You can verify the `KongConsumer` was reconciled successfully by checking its `Programmed` condition. - -```shell -kubectl get kongconsumer consumer -o=jsonpath='{.status.conditions}' | jq '.[] | select(.type == "Programmed")' -``` - -The output should look similar to this: - -```console -{ - "observedGeneration": 1, - "reason": "Programmed", - "status": "True", - "type": "Programmed" -} -``` +{% include md/kgo/check-condition.md name='consumer' kind='KongConsumer' %} At this point, you should see the Consumer in the Gateway Manager UI. @@ -86,22 +71,7 @@ spec: ' | kubectl apply -f - ``` -You can verify the `KongCredentialBasicAuth` was reconciled successfully by checking its `Programmed` condition. - -```shell -kubectl get kongcredentialbasicauth basic-auth-cred -o=jsonpath='{.status.conditions}' | jq '.[] | select(.type == "Programmed")' -``` - -The output should look similar to this: - -```console -{ - "observedGeneration": 1, - "reason": "Programmed", - "status": "True", - "type": "Programmed" -} -``` +{% include md/kgo/check-condition.md name='basic-auth-cred' kind='KongCredentialBasicAuth' %} At this point, you should see the Credential in the Consumer's Credentials in the Gateway Manager UI. @@ -130,22 +100,7 @@ spec: ' | kubectl apply -f - ``` -You can verify the `KongConsumerGroup` was reconciled successfully by checking its `Programmed` condition. - -```shell -kubectl get kongconsumergroup consumer-group -o=jsonpath='{.status.conditions}' | jq '.[] | select(.type == "Programmed")' -``` - -The output should look similar to this: - -```console -{ - "observedGeneration": 1, - "reason": "Programmed", - "status": "True", - "type": "Programmed" -} -``` +{% include md/kgo/check-condition.md name='consumer-group' kind='KongConsumerGroup' %} At this point, you should see the Consumer Group in the Gateway Manager UI. @@ -178,19 +133,6 @@ spec: You can verify the `KongConsumer`'s `consumerGroups` field was reconciled successfully by checking its `KongConsumerGroupRefsValid` condition. -```shell -kubectl get kongconsumer consumer -o=jsonpath='{.status.conditions}' | jq '.[] | select(.type == "KongConsumerGroupRefsValid")' -``` - -The output should look similar to this: - -```console -{ - "observedGeneration": 2, - "reason": "Valid", - "status": "True", - "type": "KongConsumerGroupRefsValid" -} -``` +{% include md/kgo/check-condition.md name='consumer' kind='KongConsumer' conditionType='KongConsumerGroupRefsValid' reason='Valid' disableDescription=true %} At this point, you should see the `consumer` Consumer in the Consumer Group members in the Gateway Manager UI. diff --git a/app/_src/gateway-operator/guides/konnect-entities/dpcertificate.md b/app/_src/gateway-operator/guides/konnect-entities/dpcertificate.md index 487ae76e5fb4..8951705419e7 100644 --- a/app/_src/gateway-operator/guides/konnect-entities/dpcertificate.md +++ b/app/_src/gateway-operator/guides/konnect-entities/dpcertificate.md @@ -48,21 +48,7 @@ spec: ' | kubectl apply -f - ``` -You can verify the `KongDataPlaneClientCertificate` was reconciled successfully by checking its `Programmed` condition. -```shell -kubectl get kongdataplaneclientcertificate dp-cert -o=jsonpath='{.status.conditions}' | jq '.[] | select(.type == "Programmed")' -``` - -The output should look similar to this: - -```console -{ - "observedGeneration": 1, - "reason": "Programmed", - "status": "True", - "type": "Programmed" -} -``` +{% include md/kgo/check-condition.md name='dp-cert' kind='KongDataPlaneClientCertificate' %} At this point, you should see the Data Plane Client Certificate in the Gateway Manager UI. diff --git a/app/_src/gateway-operator/guides/konnect-entities/key-and-keyset.md b/app/_src/gateway-operator/guides/konnect-entities/key-and-keyset.md index e58b302aaaf4..e1db08dddd6f 100644 --- a/app/_src/gateway-operator/guides/konnect-entities/key-and-keyset.md +++ b/app/_src/gateway-operator/guides/konnect-entities/key-and-keyset.md @@ -59,22 +59,7 @@ spec: ' | kubectl apply -f - ``` -You can verify the `KongKey` was reconciled successfully by checking its `Programmed` condition. - -```shell -kubectl get kongkey key -o=jsonpath='{.status.conditions}' | jq '.[] | select(.type == "Programmed")' -``` - -The output should look similar to this: - -```console -{ - "observedGeneration": 1, - "reason": "Programmed", - "status": "True", - "type": "Programmed" -} -``` +{% include md/kgo/check-condition.md name='key' kind='KongKey' %} At this point, you should see the Key in the Gateway Manager UI. @@ -105,22 +90,7 @@ spec: ' | kubectl apply -f - ``` -You can verify the `KongKeySet` was reconciled successfully by checking its `Programmed` condition. - -```shell -kubectl get kongkeyset key-set -o=jsonpath='{.status.conditions}' | jq '.[] | select(.type == "Programmed")' -``` - -The output should look similar to this: - -```console -{ - "observedGeneration": 1, - "reason": "Programmed", - "status": "True", - "type": "Programmed" -} -``` +{% include md/kgo/check-condition.md name='key-set' kind='KongKeySet' %} At this point, you should see the Key Set in the Gateway Manager UI. diff --git a/app/_src/gateway-operator/guides/konnect-entities/service-and-route.md b/app/_src/gateway-operator/guides/konnect-entities/service-and-route.md index fb555114ea65..41e64d4fea85 100644 --- a/app/_src/gateway-operator/guides/konnect-entities/service-and-route.md +++ b/app/_src/gateway-operator/guides/konnect-entities/service-and-route.md @@ -38,22 +38,7 @@ spec: ' | kubectl apply -f - ``` -You can verify the `KongService` was reconciled successfully by checking its `Programmed` condition. - -```shell -kubectl get kongservice service -o=jsonpath='{.status.conditions}' | jq '.[] | select(.type == "Programmed")' -``` - -The output should look similar to this: - -```console -{ - "observedGeneration": 1, - "reason": "Programmed", - "status": "True", - "type": "Programmed" -} -``` +{% include md/kgo/check-condition.md name='service' kind='KongService' %} At this point, you should see the Service in the Gateway Manager UI. @@ -90,22 +75,7 @@ spec: ' | kubectl apply -f - ``` -You can verify the `KongRoute` was reconciled successfully by checking its `Programmed` condition. - -```shell -kubectl get kongroute route-with-service -o=jsonpath='{.status.conditions}' | jq '.[] | select(.type == "Programmed")' -``` - -The output should look similar to this: - -```console -{ - "observedGeneration": 1, - "reason": "Programmed", - "status": "True", - "type": "Programmed" -} -``` +{% include md/kgo/check-condition.md name='route-with-service' kind='KongRoute' %} At this point, you should see the Route in the Gateway Manager UI. @@ -135,21 +105,6 @@ spec: ' | kubectl apply -f - ``` -You can verify the `KongRoute` was reconciled successfully by checking its `Programmed` condition. - -```shell -kubectl get kongroute route-without-service -o=jsonpath='{.status.conditions}' | jq '.[] | select(.type == "Programmed")' -``` - -The output should look similar to this: - -```console -{ - "observedGeneration": 1, - "reason": "Programmed", - "status": "True", - "type": "Programmed" -} -``` +{% include md/kgo/check-condition.md name='route-without-service' kind='KongRoute' %} At this point, you should see the Route in the Gateway Manager UI. diff --git a/app/_src/gateway-operator/guides/konnect-entities/tagging-and-labeling.md b/app/_src/gateway-operator/guides/konnect-entities/tagging-and-labeling.md index 7b8ef633802a..5f00932cf708 100644 --- a/app/_src/gateway-operator/guides/konnect-entities/tagging-and-labeling.md +++ b/app/_src/gateway-operator/guides/konnect-entities/tagging-and-labeling.md @@ -75,21 +75,6 @@ spec: ' | kubectl apply -f - ``` -You can verify the `KongService` was reconciled successfully by checking its `Programmed` condition. - -```shell -kubectl get kongservice service -o=jsonpath='{.status.conditions}' | jq '.[] | select(.type == "Programmed")' -``` - -The output should look similar to this: - -```console -{ - "observedGeneration": 1, - "reason": "Programmed", - "status": "True", - "type": "Programmed" -} -``` +{% include md/kgo/check-condition.md name='service' kind='KongService' %} At this point, tags should be visible in the Gateway Manager UI. diff --git a/app/_src/gateway-operator/guides/konnect-entities/upstream-and-target.md b/app/_src/gateway-operator/guides/konnect-entities/upstream-and-target.md index 32c0c7cfa34c..9ef7a07889eb 100644 --- a/app/_src/gateway-operator/guides/konnect-entities/upstream-and-target.md +++ b/app/_src/gateway-operator/guides/konnect-entities/upstream-and-target.md @@ -37,22 +37,7 @@ spec: ' | kubectl apply -f - ``` -You can verify the `KongUpstream` was reconciled successfully by checking its `Programmed` condition. - -```shell -kubectl get kongkey key -o=jsonpath='{.status.conditions}' | jq '.[] | select(.type == "Programmed")' -``` - -The output should look similar to this: - -```console -{ - "observedGeneration": 1, - "reason": "Programmed", - "status": "True", - "type": "Programmed" -} -``` +{% include md/kgo/check-condition.md name='upstream' kind='KongUpstream' %} At this point, you should see the Upstream in the Gateway Manager UI. @@ -95,50 +80,14 @@ spec: You can verify both `KongTarget`s successfully were associated with the `KongUpstream` by checking their `KongUpstreamRefValid` condition. -```shell -kubectl get kongtarget target-a -o=jsonpath='{.status.conditions}' | jq '.[] | select(.type == "KongUpstreamRefValid")' -kubectl get kongtarget target-b -o=jsonpath='{.status.conditions}' | jq '.[] | select(.type == "KongUpstreamRefValid")' -``` +{% include md/kgo/check-condition.md name='target-a' kind='KongTarget' conditionType='KongUpstreamRefValid' reason='Valid' disableDescription=true %} -The output should look similar to this: - -```console -{ - "observedGeneration": 1, - "reason": "Valid", - "status": "True", - "type": "KongUpstreamRefValid" -} -{ - "observedGeneration": 1, - "reason": "Valid", - "status": "True", - "type": "KongUpstreamRefValid" -} -``` +{% include md/kgo/check-condition.md name='target-b' kind='KongTarget' conditionType='KongUpstreamRefValid' reason='Valid' disableDescription=true %} You can also verify both `KongTarget`s were reconciled successfully by checking their `Programmed` condition. -```shell -kubectl get kongtarget target-a -o=jsonpath='{.status.conditions}' | jq '.[] | select(.type == "Programmed")' -kubectl get kongtarget target-b -o=jsonpath='{.status.conditions}' | jq '.[] | select(.type == "Programmed")' -``` +{% include md/kgo/check-condition.md name='target-a' kind='KongTarget' disableDescription=true %} -The output should look similar to this: - -```console -{ - "observedGeneration": 1, - "reason": "Programmed", - "status": "True", - "type": "Programmed" -} -{ - "observedGeneration": 1, - "reason": "Programmed", - "status": "True", - "type": "Programmed" -} -``` +{% include md/kgo/check-condition.md name='target-b' kind='KongTarget' disableDescription=true %} At this point, you should see both Targets in the `upstream` Upstream in the Gateway Manager UI.