Skip to content

Commit 0f841eb

Browse files
committed
Pass gateway config to GatewayClass via annotation
Signed-off-by: Tamal Saha <tamal@appscode.com>
1 parent b923268 commit 0f841eb

12 files changed

Lines changed: 89 additions & 8 deletions

File tree

apis/installer/v1alpha1/service_gateway_types.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,15 @@ type ServiceGatewaySpec struct {
4747
NameOverride string `json:"nameOverride"`
4848
FullnameOverride string `json:"fullnameOverride"`
4949
ClusterMetadata StashClusterMetadata `json:"clusterMetadata"`
50+
GatewayClass GatewayClassSpec `json:"gatewayClass"`
5051
catgwapi.GatewaySpec `json:",inline,omitempty"`
5152
}
5253

54+
type GatewayClassSpec struct {
55+
Annotations map[string]string `json:"annotations"`
56+
Description string `json:"description"`
57+
}
58+
5359
// +kubebuilder:validation:Enum=ca
5460
type ClusterTLSIssuerType string
5561

apis/installer/v1alpha1/zz_generated.deepcopy.go

Lines changed: 23 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

charts/service-gateway/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ The following table lists the configurable parameters of the `service-gateway` c
5151
| fullnameOverride | Overrides fullname template | <code>""</code> |
5252
| clusterMetadata.uid | | <code>tbd</code> |
5353
| clusterMetadata.name | | <code>tbd</code> |
54+
| gatewayClass.annotations | | <code>{}</code> |
55+
| gatewayClass.description | catalog.appscode.com/is-default-gatewayclass: "true" | <code>""</code> |
5456
| infra.host | | <code>chart-example.local</code> |
5557
| infra.hostType | | <code>domain</code> |
5658
| infra.tls.issuer | | <code>"ca" # ca,letsencrypt,letsencrypt-staging,external</code> |

charts/service-gateway/templates/gateway/gwclass.yaml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,26 @@ apiVersion: gateway.networking.k8s.io/v1beta1
22
kind: GatewayClass
33
metadata:
44
name: {{ include "tenant.name" . }}
5+
annotations:
6+
{{- dict "catalog.appscode.com/gateway-config" (dict "service" .Values.envoy.service "vaultServer" .Values.vaultServer | toYaml) | toYaml | nindent 4 }}
7+
{{- with .Values.gatewayClass.annotations }}
8+
{{- toYaml . | nindent 4 }}
9+
{{- end }}
510
spec:
611
controllerName: {{ .Values.gateway.config.envoyGateway.gateway.controllerName }}
12+
{{- with .Values.gatewayClass.description }}
13+
description: {{ . | quote }}
14+
{{- end }}
715
parametersRef:
816
group: gateway.envoyproxy.io
917
kind: EnvoyProxy
10-
name: {{ include "tenant.name" . }}-gw-proxy-config
18+
name: {{ include "tenant.name" . }}
1119
namespace: {{ .Release.Namespace }}
1220
---
1321
apiVersion: gateway.envoyproxy.io/v1alpha1
1422
kind: EnvoyProxy
1523
metadata:
16-
name: {{ include "tenant.name" . }}-gw-proxy-config
24+
name: {{ include "tenant.name" . }}
1725
namespace: {{ .Release.Namespace }}
1826
spec:
1927
mergeGateways: true

charts/service-gateway/values.openapiv3_schema.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2083,6 +2083,18 @@ properties:
20832083
required:
20842084
- enabled
20852085
type: object
2086+
gatewayClass:
2087+
properties:
2088+
annotations:
2089+
additionalProperties:
2090+
type: string
2091+
type: object
2092+
description:
2093+
type: string
2094+
required:
2095+
- annotations
2096+
- description
2097+
type: object
20862098
infra:
20872099
properties:
20882100
dns:
@@ -2243,6 +2255,7 @@ required:
22432255
- fullnameOverride
22442256
- gateway
22452257
- gateway-dns
2258+
- gatewayClass
22462259
- infra
22472260
- nameOverride
22482261
type: object

charts/service-gateway/values.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ clusterMetadata:
1111
uid: tbd
1212
name: tbd
1313

14+
gatewayClass:
15+
annotations: {}
16+
# catalog.appscode.com/is-default-gatewayclass: "true"
17+
description: ""
18+
1419
infra:
1520
host: chart-example.local
1621
hostType: domain

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ go 1.22.1
55
toolchain go1.22.4
66

77
require (
8-
go.bytebuilders.dev/catalog v0.0.9-0.20241102061613-1c89539f6b42
8+
go.bytebuilders.dev/catalog v0.0.9-0.20241102180925-c8d288e03c97
99
go.bytebuilders.dev/resource-model v0.1.1-0.20241023004602-2c43ef3bb37b
1010
go.bytebuilders.dev/ui-wizards v0.8.0
1111
go.openviz.dev/installer v0.0.0-20240731074805-a62b13eaedb0

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,8 +196,8 @@ github.com/zeebo/xxh3 v1.0.2 h1:xZmwmqxHZA8AI603jOQ0tMqmBr9lPeFwGg6d+xy9DC0=
196196
github.com/zeebo/xxh3 v1.0.2/go.mod h1:5NWz9Sef7zIDm2JHfFlcQvNekmcEl9ekUZQQKCYaDcA=
197197
go.appscode.dev/alerts v0.2.1-0.20240604101218-3069fbd7c6b8 h1:7FP18GEp6Jm0OUt5lsS9HjVitmiU9zZ5wVQwgU+Y23g=
198198
go.appscode.dev/alerts v0.2.1-0.20240604101218-3069fbd7c6b8/go.mod h1:5+qwuxF78YiFg/CEGfgfXREj7KEJYLgQeFhke4+lQ8k=
199-
go.bytebuilders.dev/catalog v0.0.9-0.20241102061613-1c89539f6b42 h1:a9X00liJzSXBAbfpp6GheHg50otTT9v2kHroWq+7hb8=
200-
go.bytebuilders.dev/catalog v0.0.9-0.20241102061613-1c89539f6b42/go.mod h1:WqLOKoupzJGe/8VWrWw/YhTkobCHi6WSQmjGeG61xeI=
199+
go.bytebuilders.dev/catalog v0.0.9-0.20241102180925-c8d288e03c97 h1:KiLl8cfNcPzDz3QAMOQTVpDa7qz48OCQOHwBDO04mrU=
200+
go.bytebuilders.dev/catalog v0.0.9-0.20241102180925-c8d288e03c97/go.mod h1:WqLOKoupzJGe/8VWrWw/YhTkobCHi6WSQmjGeG61xeI=
201201
go.bytebuilders.dev/resource-model v0.1.1-0.20241023004602-2c43ef3bb37b h1:loq3wv7NQY9givjW8djFMqe/1d+8j2wE4k5hueDIWC0=
202202
go.bytebuilders.dev/resource-model v0.1.1-0.20241023004602-2c43ef3bb37b/go.mod h1:/uMIfxqPIrDmiYWA28OW3xzogijxpwkicR4kK7jam9g=
203203
go.bytebuilders.dev/ui-wizards v0.8.0 h1:7hute2GVoidjP6wcI78kyUV/x2Lhpw4VodFCZpFE6Lc=

vendor/go.bytebuilders.dev/catalog/api/gateway/v1alpha1/gatewayconfig_types.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,11 @@ type GatewaySpec struct {
4444
VaultServer kmapi.ObjectReference `json:"vaultServer"`
4545
}
4646

47+
type GatewayParameter struct {
48+
Service EnvoyServiceSpec `json:"service"`
49+
VaultServer kmapi.ObjectReference `json:"vaultServer"`
50+
}
51+
4752
type ServiceProviderInfra struct {
4853
HostInfo `json:",inline"`
4954
TLS InfraTLS `json:"tls"`

vendor/go.bytebuilders.dev/catalog/api/gateway/v1alpha1/gatewaypreset_types.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,10 @@ import (
2323
)
2424

2525
const (
26-
DefaultConfigKey = "catalog.appscode.com/is-default-gateway-config"
27-
DefaultPresetKey = "catalog.appscode.com/is-default-gateway-preset"
26+
GatewayConfigKey = "catalog.appscode.com/gateway-config"
27+
DefaultGatewayClassKey = "catalog.appscode.com/is-default-gatewayclass"
28+
DefaultConfigKey = "catalog.appscode.com/is-default-gateway-config"
29+
DefaultPresetKey = "catalog.appscode.com/is-default-gateway-preset"
2830
)
2931

3032
// GatewayPresetSpec defines the desired state of GatewayPreset.

0 commit comments

Comments
 (0)