diff --git a/api/v1/externalservice_types.go b/api/v1/externalservice_types.go index 9b85c1d7..121c61cb 100644 --- a/api/v1/externalservice_types.go +++ b/api/v1/externalservice_types.go @@ -90,12 +90,9 @@ type ExternalServiceSpec struct { // +optional JsonClusterAccessLogs bool `json:"envoyJsonClusterAccessLogs,omitempty"` - // TopologySpreadSkews is a struct that allows overriding the topology spread skews for the service + // TopologySpreadSkews allows overriding the topology spread skews for the service // +optional - TopologySpreadSkews struct { - Zone int `json:"zone,omitempty"` - Hostname int `json:"hostname,omitempty"` - } `json:"topologySpreadSkews,omitempty"` + TopologySpreadSkews TopologySpreadSkews `json:"topologySpreadSkews,omitempty"` // ServiceTrafficDistribution allows configuration of the service traffic distribution mode // if it's not set the field won't be set at all @@ -114,6 +111,17 @@ type ExternalServicePort struct { Port int32 `json:"port,omitempty"` } +// TopologySpreadSkews allows per-service overrides of topology spread constraint max skew values. +type TopologySpreadSkews struct { + // Zone is the max skew for the zone topology key. If unset, falls back to the global env var or default. + // +optional + Zone int `json:"zone,omitempty"` + + // Hostname is the max skew for the hostname topology key. If unset, falls back to the global env var or default. + // +optional + Hostname int `json:"hostname,omitempty"` +} + // ExternalServiceStatus defines the observed state of ExternalService type ExternalServiceStatus struct { // INSERT ADDITIONAL STATUS FIELD - define observed state of cluster diff --git a/api/v1/zz_generated.deepcopy.go b/api/v1/zz_generated.deepcopy.go index 80c83656..1c075700 100644 --- a/api/v1/zz_generated.deepcopy.go +++ b/api/v1/zz_generated.deepcopy.go @@ -170,3 +170,18 @@ func (in *ExternalServiceStatus) DeepCopy() *ExternalServiceStatus { in.DeepCopyInto(out) return out } + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TopologySpreadSkews) DeepCopyInto(out *TopologySpreadSkews) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TopologySpreadSkews. +func (in *TopologySpreadSkews) DeepCopy() *TopologySpreadSkews { + if in == nil { + return nil + } + out := new(TopologySpreadSkews) + in.DeepCopyInto(out) + return out +} diff --git a/config/crd/bases/egress.monzo.com_externalservices.yaml b/config/crd/bases/egress.monzo.com_externalservices.yaml index 23770824..719e591d 100644 --- a/config/crd/bases/egress.monzo.com_externalservices.yaml +++ b/config/crd/bases/egress.monzo.com_externalservices.yaml @@ -171,11 +171,30 @@ spec: serviceTopologyMode: description: Provides a way to override the global default type: string + serviceTrafficDistribution: + description: |- + ServiceTrafficDistribution allows configuration of the service traffic distribution mode + if it's not set the field won't be set at all + https://kubernetes.io/docs/concepts/services-networking/service/#traffic-distribution + type: string targetCPUUtilizationPercentage: description: Target average CPU utilization (represented as a percentage of requested CPU) over all the pods. Defaults to 50 format: int32 type: integer + topologySpreadSkews: + description: TopologySpreadSkews allows overriding the topology spread + skews for the service + properties: + hostname: + description: Hostname is the max skew for the hostname topology + key. If unset, falls back to the global env var or default. + type: integer + zone: + description: Zone is the max skew for the zone topology key. If + unset, falls back to the global env var or default. + type: integer + type: object type: object status: description: ExternalServiceStatus defines the observed state of ExternalService