refactor(gateway): make node name explicitly configurable in spec
Some checks failed
E2E Tests / Run on Ubuntu (push) Failing after 25s
Tests / Run on Ubuntu (push) Failing after 3m9s
Lint / Run on Ubuntu (push) Failing after 3m39s

This commit is contained in:
Peter 2025-01-17 15:03:13 +01:00
parent 0b551325b9
commit a5c170a478
Signed by: prskr
GPG key ID: F56BED6903BC5E37
3 changed files with 9 additions and 1 deletions

View file

@ -38,6 +38,10 @@ type ControlPlaneSpec struct {
} }
type EnvoySpec struct { type EnvoySpec struct {
// NodeName - identifies the Envoy cluster within the current namespace
// if not set, the name of the APIGateway resource will be used
// The primary use case is to make the assignment of multiple supabase instances in a single namespace explicit.
NodeName string `json:"nodeName,omitempty"`
// ControlPlane - configure the control plane where Envoy will retrieve its configuration from // ControlPlane - configure the control plane where Envoy will retrieve its configuration from
ControlPlane *ControlPlaneSpec `json:"controlPlane"` ControlPlane *ControlPlaneSpec `json:"controlPlane"`
// WorkloadTemplate - customize the Envoy deployment // WorkloadTemplate - customize the Envoy deployment

View file

@ -191,7 +191,7 @@ func (r *APIGatewayReconciler) reconcileEnvoyConfig(
Port uint16 Port uint16
} }
instance := fmt.Sprintf("%s:%s", gateway.Name, gateway.Namespace) instance := fmt.Sprintf("%s:%s", gateway.Spec.Envoy.NodeName, gateway.Namespace)
tmplData := struct { tmplData := struct {
Node nodeSpec Node nodeSpec

View file

@ -69,6 +69,10 @@ func (d *APIGatewayCustomDefaulter) Default(ctx context.Context, obj runtime.Obj
apiGateway.Spec.Envoy = new(supabasev1alpha1.EnvoySpec) apiGateway.Spec.Envoy = new(supabasev1alpha1.EnvoySpec)
} }
if apiGateway.Spec.Envoy.NodeName == "" {
apiGateway.Spec.Envoy.NodeName = apiGateway.Name
}
if apiGateway.Spec.Envoy.ControlPlane == nil { if apiGateway.Spec.Envoy.ControlPlane == nil {
if d.CurrentNamespace == defaultManagerNamespace { if d.CurrentNamespace == defaultManagerNamespace {
d.Recorder.Event( d.Recorder.Event(