Skip to content

Commit

Permalink
Extend Gslb CRD with additionalPrinterColumns (#425)
Browse files Browse the repository at this point in the history
Use https://book.kubebuilder.io/reference/generating-crd.html#additional-printer-columns
to add `additionalPrinterColumns` exposing strategy and geoTag of Gslb CR

From the user perspective it looks like
```sh
kubectl -n test-gslb get gslb
NAME                 STRATEGY     GEOTAG
test-gslb            roundRobin   eu-west-1
test-gslb-failover   failover     eu-west-1
```

Signed-off-by: Yury Tsarev <yury.tsarev@absa.africa>
  • Loading branch information
ytsarev authored Apr 3, 2021
1 parent aba75e8 commit c105f41
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
2 changes: 2 additions & 0 deletions api/v1beta1/gslb_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ type GslbStatus struct {
// +kubebuilder:subresource:status

// Gslb is the Schema for the gslbs API
// +kubebuilder:printcolumn:name="strategy",type=string,JSONPath=`.spec.strategy.type`
// +kubebuilder:printcolumn:name="geoTag",type=string,JSONPath=`.status.geoTag`
type Gslb struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Expand Down
13 changes: 10 additions & 3 deletions chart/k8gb/templates/crds/k8gb.absa.oss_gslbs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,14 @@ spec:
singular: gslb
scope: Namespaced
versions:
- name: v1beta1
- additionalPrinterColumns:
- jsonPath: .spec.strategy.type
name: strategy
type: string
- jsonPath: .status.geoTag
name: geoTag
type: string
name: v1beta1
schema:
openAPIV3Schema:
description: Gslb is the Schema for the gslbs API
Expand Down Expand Up @@ -98,8 +105,6 @@ spec:
under a specified host to the related backend services. Incoming
requests are first evaluated for a host match, then routed
to the backend associated with the matching IngressRuleValue.
required:
- "http"
properties:
host:
description: "Host is the fully qualified domain name of
Expand Down Expand Up @@ -225,6 +230,8 @@ spec:
required:
- paths
type: object
required:
- http
type: object
type: array
tls:
Expand Down

0 comments on commit c105f41

Please sign in to comment.