Skip to content

Commit

Permalink
docs(kgo): add Konnect entities tagging and labeling guide
Browse files Browse the repository at this point in the history
  • Loading branch information
czeslavo committed Oct 25, 2024
1 parent 14edb3c commit 1f00a26
Show file tree
Hide file tree
Showing 3 changed files with 98 additions and 1 deletion.
2 changes: 2 additions & 0 deletions app/_data/docs_nav_kgo_1.4.x.yml
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,8 @@ items:
url: /guides/konnect-entities/key-and-keyset/
- text: Upstream and Targets
url: /guides/konnect-entities/upstream-and-target/
- text: Tagging and Labeling
url: /guides/konnect-entities/tagging-and-labeling/
- title: Reference
icon: /assets/images/icons/icn-magnifying-glass.svg
items:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ At this point, you should see the Consumer in the Gateway Manager UI.
## Associate the Consumer with Credentials

Consumers can have credentials associated with them. You can create one of the supported credential types. Please refer
to the below CRs documentation links to learn all the available fields for each credential type.
to the below Custom Resource's documentation links to learn all the available fields for each credential type.

- [KongCredentialBasicAuth](/gateway-operator/{{ page.release }}/reference/custom-resources/#kongcredentialbasicauth)
- [KongCredentialKeyAuth](/gateway-operator/{{ page.release }}/reference/custom-resources/#kongcredentialkeyauth)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
---
title: Tagging and Labeling
---

Tags and labels are a way to organize and categorize your resources. In this guide, you'll learn how to annotate your
Konnect entities managed by {{site.kgo_product_name}} with tags and labels (depending on particular entity's support for
those).

{% include md/kgo/konnect-entities-prerequisites.md disable_accordian=false version=page.version release=page.release %}

## Labeling

Labels are key-value pairs that you can attach to objects. As of now, the only Konnect entity that supports labeling is
the [KonnectGatewayControlPlane](/gateway-operator/guides/konnect-entities/gatewaycontrolplane). You can add labels to
the `KonnectGatewayControlPlane` object by specifying the `labels` field in the `spec` section.

```yaml
echo '
kind: KonnectGatewayControlPlane
apiVersion: konnect.konghq.com/v1alpha1
metadata:
name: gateway-control-plane
namespace: default
spec:
labels: # Arbitrary key-value pairs
environment: production
team: devops
name: gateway-control-plane
konnect:
authRef:
name: konnect-api-auth # Reference to the KonnectAPIAuthConfiguration object
' | kubectl apply -f -
```
You can verify the Control Plane was reconciled successfully by checking its status.
```shell
kubectl get konnectgatewaycontrolplanes.konnect.konghq.com gateway-control-plane
```
The output should look similar to this:
```console
NAME PROGRAMMED ID ORGID
gateway-control-plane True <konnect-control-plane-id> <your-konnect-ord-id>
```
At this point, labels should be visible in the Gateway Manager UI.
## Tagging
Tags are values that you can attach to objects. All the Konnect entities that can be attached to a
`KonnectGatewayControlPlane` object support tagging. You can add tags to those entities by specifying the `tags` field
in their `spec` section.
For example, to add tags to a `KongService` object, you can apply the following YAML manifest:
```yaml
echo '
kind: KongService
apiVersion: configuration.konghq.com/v1alpha1
metadata:
name: service
namespace: default
spec:
tags: # Arbitrary list of strings
- production
- devops
name: service
host: example.com
controlPlaneRef:
type: konnectNamespacedRef
konnectNamespacedRef:
name: gateway-control-plane
' | 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"
}
```

At this point, tags should be visible in the Gateway Manager UI.

0 comments on commit 1f00a26

Please sign in to comment.