Skip to content
This repository has been archived by the owner on Dec 16, 2024. It is now read-only.

Commit

Permalink
update kuadrant-operator version
Browse files Browse the repository at this point in the history
  • Loading branch information
mikenairn committed Feb 7, 2024
1 parent 0d0cc94 commit 0503a3a
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 266 deletions.
7 changes: 5 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ require (
github.com/goombaio/namegenerator v0.0.0-20181006234301-989e774b106e
github.com/jetstack/cert-manager v1.7.1
github.com/kuadrant/kuadrant-dns-operator v0.0.0-20240202223525-b889335b228f
github.com/kuadrant/kuadrant-operator v0.1.1-0.20231114121136-3136ed961c70
github.com/kuadrant/kuadrant-operator v0.1.1-0.20240207215948-fd569587ff6f
github.com/onsi/ginkgo/v2 v2.13.2
github.com/onsi/gomega v1.30.0
github.com/operator-framework/api v0.17.5
Expand Down Expand Up @@ -59,17 +59,20 @@ require (
github.com/kuadrant/authorino-operator v0.9.0 // indirect
github.com/kuadrant/limitador-operator v0.7.0 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/martinlindhe/base36 v1.1.1 // indirect
github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0 // indirect
github.com/mitchellh/copystructure v1.2.0 // indirect
github.com/mitchellh/reflectwalk v1.0.2 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/prometheus/client_golang v1.17.0 // indirect
github.com/prometheus/client_model v0.5.0 // indirect
github.com/prometheus/common v0.45.0 // indirect
github.com/prometheus/procfs v0.12.0 // indirect
github.com/rogpeppe/go-internal v1.11.0 // indirect
github.com/shopspring/decimal v1.3.1 // indirect
github.com/sirupsen/logrus v1.9.3 // indirect
github.com/spf13/cast v1.6.0 // indirect
Expand Down Expand Up @@ -116,4 +119,4 @@ replace maistra.io/istio-operator => github.com/maistra/istio-operator v0.0.0-20

replace github.com/imdario/mergo => dario.cat/mergo v0.3.5

replace github.com/kuadrant/kuadrant-operator => /home/mnairn/go/src/github.com/kuadrant/kuadrant-operator
//replace github.com/kuadrant/kuadrant-operator => /home/mnairn/go/src/github.com/kuadrant/kuadrant-operator
11 changes: 8 additions & 3 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,14 @@ github.com/kuadrant/authorino-operator v0.9.0 h1:EV7zrYBNcd53HPQMivvTwe/+DIATTK7
github.com/kuadrant/authorino-operator v0.9.0/go.mod h1:VkUqS4CHNiaHMrjSFQ5V71DN829kPnqT3FQxqlOntEI=
github.com/kuadrant/kuadrant-dns-operator v0.0.0-20240202223525-b889335b228f h1:kRhKt1sW8ZqZlEasTGb1aX6xrEutBU1Ef+P4stf3bhY=
github.com/kuadrant/kuadrant-dns-operator v0.0.0-20240202223525-b889335b228f/go.mod h1:OyP8aXe7uOCP8PKMhd6JXPSUyzcNkztriNDeyearp4M=
github.com/kuadrant/kuadrant-operator v0.1.1-0.20240207215948-fd569587ff6f h1:90NpS2LHPiwuQdn3GecDXQ5/FD+hd6XJn/5ilp2vKqQ=
github.com/kuadrant/kuadrant-operator v0.1.1-0.20240207215948-fd569587ff6f/go.mod h1:TzNfN5kVB2XLIHvDu7Pk2f2/WImTYEd7CBdkfB47yMQ=
github.com/kuadrant/limitador-operator v0.7.0 h1:pLIpM6vUxAY/Jn6ny61IGpqS7Oti786duBzJ67DJOuA=
github.com/kuadrant/limitador-operator v0.7.0/go.mod h1:tg+G+3eTzUUfvUmdbiqH3FnScEPSWZ3DmorD1ZAx1bo=
github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0=
github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc=
github.com/martinlindhe/base36 v1.1.1 h1:1F1MZ5MGghBXDZ2KJ3QfxmiydlWOGB8HCEtkap5NkVg=
github.com/martinlindhe/base36 v1.1.1/go.mod h1:vMS8PaZ5e/jV9LwFKlm0YLnXl/hpOihiBxKkIoc3g08=
github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0 h1:jWpvCLoY8Z/e3VKvlsiIGKtc+UG6U5vzxaoagmhXfyg=
github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0/go.mod h1:QUyp042oQthUoa9bqDv0ER0wrtXnBruoNd7aNjkbP+k=
github.com/mitchellh/copystructure v1.0.0/go.mod h1:SNtv71yrdKgLRyLFxmLdkAbkKEFWgYaq1OVrnRcwhnw=
Expand Down Expand Up @@ -137,8 +141,9 @@ github.com/operator-framework/api v0.17.5/go.mod h1:l/cuwtPxkVUY7fzYgdust2m9tlmb
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U=
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/prometheus/client_golang v1.17.0 h1:rl2sfwZMtSthVU752MqfjQozy7blglC+1SOtjMAMh+Q=
github.com/prometheus/client_golang v1.17.0/go.mod h1:VeL+gMmOAxkS2IqfCq0ZmHSL+LjWfWDUmp1mBz9JgUY=
github.com/prometheus/client_model v0.5.0 h1:VQw1hfvPvk3Uv6Qf29VrPF32JB6rtbgI6cYPYQjL0Qw=
Expand All @@ -147,8 +152,8 @@ github.com/prometheus/common v0.45.0 h1:2BGz0eBc2hdMDLnO/8n0jeB3oPrt2D08CekT0lne
github.com/prometheus/common v0.45.0/go.mod h1:YJmSTw9BoKxJplESWWxlbyttQR4uaEcGyv9MZjVOJsY=
github.com/prometheus/procfs v0.12.0 h1:jluTpSng7V9hY0O2R9DzzJHYb2xULk9VTR1V1R/k6Bo=
github.com/prometheus/procfs v0.12.0/go.mod h1:pcuDEFsWDnvcgNzo4EEweacyhjeA9Zk3cnaOZAZEfOo=
github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ=
github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog=
github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M=
github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA=
github.com/shopspring/decimal v1.2.0/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o=
github.com/shopspring/decimal v1.3.1 h1:2Usl1nmF/WZucqkFZhnfFYxxxu8LG21F6nPQBE5gKV8=
github.com/shopspring/decimal v1.3.1/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o=
Expand Down
38 changes: 5 additions & 33 deletions pkg/controllers/gateway/gateway_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ import (
"sigs.k8s.io/controller-runtime/pkg/reconcile"
gatewayapiv1 "sigs.k8s.io/gateway-api/apis/v1"

"github.com/kuadrant/kuadrant-operator/pkg/multicluster"

"github.com/Kuadrant/multicluster-gateway-controller/pkg/_internal/gracePeriod"
"github.com/Kuadrant/multicluster-gateway-controller/pkg/_internal/metadata"
"github.com/Kuadrant/multicluster-gateway-controller/pkg/_internal/slice"
Expand Down Expand Up @@ -219,7 +221,7 @@ func (r *GatewayReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ct
}
for _, address := range addresses {
log.V(3).Info("checking address type for mapping", "address.Type", address.Type)
addressType, supported := AddressTypeToMultiCluster(address)
addressType, supported := multicluster.AddressTypeToMultiCluster(address)
if !supported {
continue // ignore address type gatewayapiv1.NamedAddressType. Unsupported for multi cluster gateway
}
Expand Down Expand Up @@ -276,7 +278,7 @@ func (r *GatewayReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ct
func (r *GatewayReconciler) reconcileClusterLabels(ctx context.Context, gateway *gatewayapiv1.Gateway, clusters []string) error {
//Remove all existing clusters.kuadrant.io labels
for key := range gateway.Labels {
if strings.HasPrefix(key, ClustersLabelPrefix) {
if strings.HasPrefix(key, multicluster.ClustersLabelPrefix) {
delete(gateway.Labels, key)
}
}
Expand All @@ -293,7 +295,7 @@ func (r *GatewayReconciler) reconcileClusterLabels(ctx context.Context, gateway
if !found {
continue
}
gateway.Labels[ClustersLabelPrefix+cluster+"_"+attribute] = value
gateway.Labels[multicluster.ClustersLabelPrefix+cluster+"_"+attribute] = value
}
}
return nil
Expand Down Expand Up @@ -567,33 +569,3 @@ func (r *GatewayReconciler) SetupWithManager(mgr ctrl.Manager, ctx context.Conte
})).
Complete(r)
}

//ToDo These need to be exposed by the kuadrant operator DNSPolicy APIs

const (
ClustersLabelPrefix = "clusters." + LabelPrefix
MultiClusterIPAddressType gatewayapiv1.AddressType = LabelPrefix + "MultiClusterIPAddress"
MultiClusterHostnameAddressType gatewayapiv1.AddressType = LabelPrefix + "MultiClusterHostnameAddress"
)

// AddressTypeToMultiCluster returns a multi cluster version of the address type
// and a bool to indicate that provided address type was converted. If not - original type is returned
func AddressTypeToMultiCluster(address gatewayapiv1.GatewayAddress) (gatewayapiv1.AddressType, bool) {
if *address.Type == gatewayapiv1.IPAddressType {
return MultiClusterIPAddressType, true
} else if *address.Type == gatewayapiv1.HostnameAddressType {
return MultiClusterHostnameAddressType, true
}
return *address.Type, false
}

// AddressTypeToSingleCluster converts provided multicluster address to single cluster version
// the bool indicates a successful conversion
func AddressTypeToSingleCluster(address gatewayapiv1.GatewayAddress) (gatewayapiv1.AddressType, bool) {
if *address.Type == MultiClusterIPAddressType {
return gatewayapiv1.IPAddressType, true
} else if *address.Type == MultiClusterHostnameAddressType {
return gatewayapiv1.HostnameAddressType, true
}
return *address.Type, false
}
44 changes: 8 additions & 36 deletions test/util/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,14 @@ import (
)

const (
Domain = "thecat.com"
ValidTestHostname = "boop." + Domain
ValidTestWildcard = "*." + Domain
FailFetchDANSSubdomain = "failfetch"
FailCreateDNSSubdomain = "failcreate"
FailEnsureCertHost = "failCreateCert" + "." + Domain
FailGetCertSecretName = "fail-fail"
FailEndpointsHostname = "failEndpoints" + "." + Domain
FailPlacementHostname = "failPlacement" + "." + Domain
Cluster = "test_cluster_one"
Namespace = "boop-namespace"
DummyCRName = "boop"
Placement = "placement"
TLSSecretName = "test-tls-cert"
Domain = "thecat.com"
ValidTestHostname = "boop." + Domain
FailPlacementHostname = "failPlacement" + "." + Domain
Cluster = "test_cluster_one"
Namespace = "boop-namespace"
DummyCRName = "boop"
Placement = "placement"
TLSSecretName = "test-tls-cert"
)

func BuildValidTestRequest(name, ns string) ctrl.Request {
Expand Down Expand Up @@ -87,28 +81,6 @@ func AssertNoErrorReconciliation() func(res ctrl.Result, err error, t *testing.T
}
}

func AssertErrorReconciliation(expectedError string) func(res ctrl.Result, err error, t *testing.T) {
return func(res ctrl.Result, err error, t *testing.T) {
if (expectedError == "") != (err == nil) {
t.Errorf("expected error %s but got %s", expectedError, err)
}
if err != nil && !strings.Contains(err.Error(), expectedError) {
t.Errorf("expected error to be %s but got %s", expectedError, err)
}
}
}

func AssertError(expectedError string) func(t *testing.T, err error) {
return func(t *testing.T, err error) {
if (expectedError == "") != (err == nil) {
t.Errorf("expected error %s but got %s", expectedError, err)
}
if err != nil && !strings.Contains(err.Error(), expectedError) {
t.Errorf("expected error to be %s but got %s", expectedError, err)
}
}
}

func GetValidTestClient(initLists ...client.ObjectList) client.WithWatch {
return fake.NewClientBuilder().
WithStatusSubresource(&gatewayapiv1.Gateway{}, &gatewayapiv1.GatewayClass{}).
Expand Down
131 changes: 0 additions & 131 deletions test/util/test_dnspolicy_types.go

This file was deleted.

Loading

0 comments on commit 0503a3a

Please sign in to comment.