Skip to content

Commit e50a732

Browse files
committed
add more details, reference configmap conditionally in kro
Signed-off-by: Karol Szwaj <karol.szwaj@gmail.com> On-behalf-of: @SAP karol.szwaj@sap.com
1 parent 221bcd5 commit e50a732

1 file changed

Lines changed: 19 additions & 24 deletions

File tree

  • docs/content/usage/integrations

docs/content/usage/integrations/kro.md

Lines changed: 19 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ weight: 30
88
# kro Integration (providing LoadBalancer as a Service)
99

1010
This guide demonstrates how to use [kro](https://kro.run/) and [Envoy Gateway](https://gateway.envoyproxy.io/) to offer a "LoadBalancer as a Service" API.
11-
Consumers create a simple `LoadBalancer` object, and theprovider automatically provisions an Envoy Gateway and HTTPRoute to expose the service between two kind clusters.
11+
Consumers create a simple `LoadBalancer` object, and the provider automatically provisions an Envoy Gateway and HTTPRoute to expose the service between two kind clusters.
1212

13-
This example includes support for **custom configuration** (via ConfigMaps).
13+
This example includes support for syncing **custom configuration (via ConfigMaps or Secrets)** from consumer clusters to the provider.
1414

1515
## Prerequisites
1616

@@ -86,17 +86,17 @@ EOF
8686
2. **Install kro.**
8787
kro allows you to define custom APIs (ResourceGroups) and map them to underlying resources.
8888

89-
```bash
90-
helm install kro oci://registry.k8s.io/kro/charts/kro \
91-
--namespace kro-system \
92-
--create-namespace
93-
```
89+
```bash
90+
helm install kro oci://registry.k8s.io/kro/charts/kro \
91+
--namespace kro-system \
92+
--create-namespace
93+
```
9494

9595
3. **Define the `LoadBalancer` ResourceGroup.**
9696
Create a kro `ResourceGraphDefinition` that defines the API `loadbalancers.networking.kro.run`.
9797

9898
This definition includes:
99-
* **Configuration:** References a ConfigMap for custom routing rules (e.g., adding headers).
99+
* **Configuration:** References a ConfigMap for custom routing rules (e.g., adding headers). The same way user could reference a Secret with Certificate to setup TLS.
100100

101101
```yaml
102102
kubectl apply -f - <<'EOF'
@@ -111,17 +111,14 @@ spec:
111111
group: networking.kro.run
112112
spec:
113113
domain: string
114-
tlsSecretRef: string
115114
configMapRef: string
116115
targetService: string
117-
targetServiceNamespace: string | default=default
116+
targetServiceNamespace: string
118117
targetPort: integer | default=8080
119118
status:
120119
address: string
121120
resources:
122121
- id: configmap
123-
includeWhen:
124-
- ${schema.spec.configMapRef != ""}
125122
template:
126123
apiVersion: v1
127124
kind: ConfigMap
@@ -179,12 +176,7 @@ spec:
179176
requestHeaderModifier:
180177
add:
181178
- name: X-Custom-Message
182-
value: ${configmap.data["custom-header"]}
183-
- type: ResponseHeaderModifier
184-
responseHeaderModifier:
185-
add:
186-
- name: X-Response-Message
187-
value: ${configmap.data["custom-header"]}
179+
value: ${configmap.?data["custom-header"]}
188180
EOF
189181
```
190182

@@ -340,6 +332,7 @@ spec:
340332
domain: "www.example.com"
341333
configMapRef: "my-lb-config"
342334
targetService: "backend"
335+
targetServiceNamespace: "default"
343336
targetPort: 30080
344337
EOF
345338
```
@@ -374,9 +367,15 @@ kube-root-ca.crt 1 3h14m
374367
my-lb-config 1 15s
375368
```
376369

377-
Test the connection with provisioned load balancer and verify that `hello-kube-bind` header was added from the ConfigMap.
370+
5. **Appendix.**
371+
* Test the connection with provisioned load balancer and verify that `hello-kube-bind` header was added from the ConfigMap.
372+
373+
!!! note
374+
For this to work end-to-end, the consumer's service (`backend`) must be reachable from the provider cluster (e.g., via multi-cluster networking) or synced to the provider cluster.
375+
376+
378377
```bash
379-
curl --verbose --header "Host: www.example.com" http://172.18.0.200/headers
378+
curl --verbose --header "Host: www.example.com" http://${PROVIDER_CLUSTER_LB_IP}/headers
380379
```
381380
382381
* Trying 172.18.0.200:80...
@@ -428,7 +427,3 @@ curl --verbose --header "Host: www.example.com" http://172.18.0.200/headers
428427
"pod": "backend-77d4d5968-glxtp"
429428
* Connection #0 to host 172.18.0.200 left intact
430429
}
431-
432-
433-
!!! note
434-
For this to work end-to-end, the consumer's service (`backend`) must be reachable from the provider cluster (e.g., via multi-cluster networking) or synced to the provider cluster.

0 commit comments

Comments
 (0)