Skip to content

Commit a48526c

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

12 files changed

Lines changed: 97 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: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,32 @@
1+
{{- $gwConfig := dict
2+
"service" .Values.envoy.service
3+
"vaultServer" .Values.vaultServer
4+
"frontendTLSSecretRef" (dict "name" (printf "%s-gw-cert" (include "tenant.name" .)) "namespace" .Release.Namespace)
5+
}}
16
apiVersion: gateway.networking.k8s.io/v1beta1
27
kind: GatewayClass
38
metadata:
49
name: {{ include "tenant.name" . }}
10+
annotations:
11+
{{- dict "catalog.appscode.com/gateway-config" (toYaml $gwConfig) | toYaml | nindent 4 }}
12+
{{- with .Values.gatewayClass.annotations }}
13+
{{- toYaml . | nindent 4 }}
14+
{{- end }}
515
spec:
616
controllerName: {{ .Values.gateway.config.envoyGateway.gateway.controllerName }}
17+
{{- with .Values.gatewayClass.description }}
18+
description: {{ . | quote }}
19+
{{- end }}
720
parametersRef:
821
group: gateway.envoyproxy.io
922
kind: EnvoyProxy
10-
name: {{ include "tenant.name" . }}-gw-proxy-config
23+
name: {{ include "tenant.name" . }}
1124
namespace: {{ .Release.Namespace }}
1225
---
1326
apiVersion: gateway.envoyproxy.io/v1alpha1
1427
kind: EnvoyProxy
1528
metadata:
16-
name: {{ include "tenant.name" . }}-gw-proxy-config
29+
name: {{ include "tenant.name" . }}
1730
namespace: {{ .Release.Namespace }}
1831
spec:
1932
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.20241102194539-f9410e0d5d09
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.20241102194539-f9410e0d5d09 h1:F3pGHkzibR6PLPtiSI9yZp13oeS+PYC7ldMGsU1KPQI=
200+
go.bytebuilders.dev/catalog v0.0.9-0.20241102194539-f9410e0d5d09/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: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,13 @@ type GatewaySpec struct {
4444
VaultServer kmapi.ObjectReference `json:"vaultServer"`
4545
}
4646

47+
type GatewayParameter struct {
48+
GatewayClassName string `json:"-"`
49+
Service EnvoyServiceSpec `json:"service"`
50+
VaultServer kmapi.ObjectReference `json:"vaultServer"`
51+
FrontendTLSSecretRef kmapi.ObjectReference `json:"frontendTLSSecretRef"`
52+
}
53+
4754
type ServiceProviderInfra struct {
4855
HostInfo `json:",inline"`
4956
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)