From c06dbbd6abc2036c8b1c02791f06efbff3a0f1d0 Mon Sep 17 00:00:00 2001 From: Timo Riski Date: Tue, 19 Dec 2023 12:14:24 +0200 Subject: [PATCH] feat(service): add service technical email support --- api/v1alpha1/common.go | 5 +++++ controllers/generic_service_handler.go | 2 ++ 2 files changed, 7 insertions(+) diff --git a/api/v1alpha1/common.go b/api/v1alpha1/common.go index 9e8216edd..c922e3c3d 100644 --- a/api/v1alpha1/common.go +++ b/api/v1alpha1/common.go @@ -5,6 +5,7 @@ import ( "fmt" "strings" + avnClient "github.com/aiven/aiven-go-client/v2" "github.com/docker/go-units" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime/schema" @@ -87,6 +88,10 @@ type ServiceCommonSpec struct { // +kubebuilder:validation:XValidation:rule="self == oldSelf",message="Value is immutable" // Service integrations to specify when creating a service. Not applied after initial service creation ServiceIntegrations []*ServiceIntegrationItem `json:"serviceIntegrations,omitempty"` + + // +kubebuilder:validation:MaxItems=10 + // Technical contact emails of the service + TechnicalEmails *[]avnClient.ContactEmail `json:"tech_emails,omitempty"` } // Validate runs complex validation on ServiceCommonSpec diff --git a/controllers/generic_service_handler.go b/controllers/generic_service_handler.go index 56d6318bf..3d570c353 100644 --- a/controllers/generic_service_handler.go +++ b/controllers/generic_service_handler.go @@ -68,6 +68,7 @@ func (h *genericServiceHandler) createOrUpdate(ctx context.Context, avn *aiven.C ServiceType: o.getServiceType(), TerminationProtection: fromAnyPointer(spec.TerminationProtection), UserConfig: userConfig, + TechnicalEmails: spec.TechnicalEmails, } for _, s := range spec.ServiceIntegrations { @@ -98,6 +99,7 @@ func (h *genericServiceHandler) createOrUpdate(ctx context.Context, avn *aiven.C ProjectVPCID: toOptionalStringPointer(projectVPCID), TerminationProtection: fromAnyPointer(spec.TerminationProtection), UserConfig: userConfig, + TechnicalEmails: spec.TechnicalEmails, } _, err = avn.Services.Update(ctx, spec.Project, ometa.Name, req) if err != nil {