Skip to content

Commit

Permalink
feat(service): add service technical email support
Browse files Browse the repository at this point in the history
  • Loading branch information
rriski committed Dec 19, 2023
1 parent 5cc56e2 commit c06dbbd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
5 changes: 5 additions & 0 deletions api/v1alpha1/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions controllers/generic_service_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit c06dbbd

Please sign in to comment.