From 79a50463ee521dfc67982f0a4dde940b78e40412 Mon Sep 17 00:00:00 2001 From: wallyworld Date: Tue, 17 Sep 2024 13:17:16 +1000 Subject: [PATCH] chore: remove space id from k8s unit args --- domain/application/errors/errors.go | 4 ---- domain/application/service/application.go | 6 +++--- domain/application/types.go | 1 - 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/domain/application/errors/errors.go b/domain/application/errors/errors.go index 7d0fd897159..87d10af2522 100644 --- a/domain/application/errors/errors.go +++ b/domain/application/errors/errors.go @@ -47,10 +47,6 @@ const ( // is not assigned. UnitNotAssigned = errors.ConstError("unit not assigned") - // UnitAlreadyExists describes an error that occurs when the - // unit being created already exists. - UnitAlreadyExists = errors.ConstError("unit already exists") - // UnitHasSubordinates describes an error that occurs when trying to set a unit's life // to Dead but it still has subordinates. UnitHasSubordinates = errors.ConstError("unit has subordinates") diff --git a/domain/application/service/application.go b/domain/application/service/application.go index edeecd57b32..de598ada5b6 100644 --- a/domain/application/service/application.go +++ b/domain/application/service/application.go @@ -302,11 +302,13 @@ func makeUpsertUnitArgs(in AddUnitArg) application.UpsertUnitArg { Ports: in.CloudContainer.Ports, } if in.CloudContainer.Address != nil { + // TODO(units) - handle the in.CloudContainer.Address space ID + // For k8s we'll initially create a /32 subnet off the container address + // and add that to the default space. result.CloudContainer.Address = &application.Address{ Value: in.CloudContainer.Address.Value, AddressType: string(in.CloudContainer.Address.AddressType()), Scope: string(in.CloudContainer.Address.Scope), - SpaceID: in.CloudContainer.Address.SpaceID, Origin: string(network.OriginProvider), } if in.CloudContainer.AddressOrigin != nil { @@ -520,8 +522,6 @@ func (s *ApplicationService) RegisterCAASUnit(ctx context.Context, appName strin } if args.Address != nil { addr := network.NewSpaceAddress(*args.Address, network.WithScope(network.ScopeMachineLocal)) - // k8s doesn't support spaces yet. - addr.SpaceID = network.AlphaSpaceId p.CloudContainer.Address = &addr origin := network.OriginProvider p.CloudContainer.AddressOrigin = &origin diff --git a/domain/application/types.go b/domain/application/types.go index 08b1ed00c4a..857894d8758 100644 --- a/domain/application/types.go +++ b/domain/application/types.go @@ -75,7 +75,6 @@ type Address struct { AddressType string Scope string Origin string - SpaceID string } // UpsertUnitArg contains parameters for adding a unit to state.