diff --git a/modules/certmanager/go.mod b/modules/certmanager/go.mod index d0b8b636..80273cc1 100644 --- a/modules/certmanager/go.mod +++ b/modules/certmanager/go.mod @@ -34,7 +34,6 @@ require ( github.com/google/gnostic v0.6.9 // indirect github.com/google/go-cmp v0.5.9 // indirect github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1 // indirect - github.com/gophercloud/gophercloud v1.6.0 // indirect github.com/imdario/mergo v0.3.16 // indirect github.com/josharian/intern v1.0.0 // indirect github.com/k8snetworkplumbingwg/network-attachment-definition-client v1.4.0 // indirect @@ -43,8 +42,6 @@ require ( github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/openshift/api v3.9.0+incompatible // indirect github.com/openstack-k8s-operators/infra-operator/apis v0.1.1-0.20230914145253-116f307c7875 // indirect - github.com/openstack-k8s-operators/keystone-operator/api v0.1.1-0.20230914163026-da9aa9de960a // indirect - github.com/openstack-k8s-operators/lib-common/modules/openstack v0.1.1-0.20230913075424-2680ce4b6ad2 // indirect github.com/openstack-k8s-operators/mariadb-operator/api v0.1.1-0.20230913081601-9e4fc8aadad5 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/prometheus/client_golang v1.14.0 // indirect @@ -53,7 +50,6 @@ require ( github.com/prometheus/procfs v0.8.0 // indirect github.com/spf13/pflag v1.0.5 // indirect go.uber.org/multierr v1.10.0 // indirect - golang.org/x/exp v0.0.0-20230905200255-921286631fa9 // indirect golang.org/x/oauth2 v0.4.0 // indirect golang.org/x/sys v0.12.0 // indirect golang.org/x/term v0.12.0 // indirect diff --git a/modules/certmanager/go.sum b/modules/certmanager/go.sum index b337a108..3ff47064 100644 --- a/modules/certmanager/go.sum +++ b/modules/certmanager/go.sum @@ -177,8 +177,6 @@ github.com/google/uuid v1.3.1 h1:KjJaJ9iWZ3jOFZIf1Lqf4laDRCasjl0BCmnEGxkdLb4= github.com/google/uuid v1.3.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= -github.com/gophercloud/gophercloud v1.6.0 h1:JwJN1bauRnWPba5ueWs9IluONHteXPWjjK+MvfM4krY= -github.com/gophercloud/gophercloud v1.6.0/go.mod h1:aAVqcocTSXh2vYFZ1JTvx4EQmfgzxRcNupUfxZbBNDM= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= @@ -238,8 +236,6 @@ github.com/openshift/api v0.0.0-20230414143018-3367bc7e6ac7 h1:rncLxJBpFGqBztyxC github.com/openshift/api v0.0.0-20230414143018-3367bc7e6ac7/go.mod h1:ctXNyWanKEjGj8sss1KjjHQ3ENKFm33FFnS5BKaIPh4= github.com/openstack-k8s-operators/infra-operator/apis v0.1.1-0.20230914145253-116f307c7875 h1:DUlCjbi3XxH66oL97MFZF5wgL28HdU+r8TkBZVw7WIc= github.com/openstack-k8s-operators/infra-operator/apis v0.1.1-0.20230914145253-116f307c7875/go.mod h1:NgrvT3CKMu6fE8Nt1H79qHx11L3I7Bb2eItniM7c9ow= -github.com/openstack-k8s-operators/keystone-operator/api v0.1.1-0.20230914163026-da9aa9de960a h1:MFYwi2Xk9r3OMPToCSbvqYVNrm7P+aFzGDN0eVNpgu8= -github.com/openstack-k8s-operators/keystone-operator/api v0.1.1-0.20230914163026-da9aa9de960a/go.mod h1:nxrbUOIGMJ1h2pNlawhURdt/XJ95dW2wZGedmOVo2aw= github.com/openstack-k8s-operators/mariadb-operator/api v0.1.1-0.20230913081601-9e4fc8aadad5 h1:dQcSQuXfgzgOhc4v+zD0jE6WWhn6FHr5nALOjJBPxyI= github.com/openstack-k8s-operators/mariadb-operator/api v0.1.1-0.20230913081601-9e4fc8aadad5/go.mod h1:mJyhm/YiQZaYhLvOuLng/ITpwx8HvsYVht+VotS1Ed8= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= @@ -326,7 +322,6 @@ golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8U golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20220829220503-c86fa9a7ed90/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -337,8 +332,6 @@ golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u0 golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= -golang.org/x/exp v0.0.0-20230905200255-921286631fa9 h1:GoHiUyI/Tp2nVkLI2mCxVkOjsbSXD66ic0XW0js0R9g= -golang.org/x/exp v0.0.0-20230905200255-921286631fa9/go.mod h1:S2oDrQGGwySpoQPVqRShND87VCbxmc6bL1Yd2oYrm6k= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= @@ -392,7 +385,6 @@ golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwY golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.15.0 h1:ugBLEUaxABaB5AJqW9enI0ACdci2RUd4eP51NTBvuJ8= diff --git a/modules/test/go.mod b/modules/test/go.mod index a1a06546..8b8c2f34 100644 --- a/modules/test/go.mod +++ b/modules/test/go.mod @@ -9,7 +9,6 @@ require ( github.com/gophercloud/gophercloud v1.6.0 github.com/onsi/gomega v1.27.10 github.com/openstack-k8s-operators/infra-operator/apis v0.1.1-0.20230914145253-116f307c7875 - github.com/openstack-k8s-operators/keystone-operator/api v0.1.1-0.20230914163026-da9aa9de960a github.com/openstack-k8s-operators/lib-common/modules/common v0.1.1-0.20230913075424-2680ce4b6ad2 github.com/openstack-k8s-operators/mariadb-operator/api v0.1.1-0.20230913081601-9e4fc8aadad5 golang.org/x/exp v0.0.0-20230905200255-921286631fa9 @@ -49,7 +48,6 @@ require ( github.com/modern-go/reflect2 v1.0.2 // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/openshift/api v3.9.0+incompatible // indirect - github.com/openstack-k8s-operators/lib-common/modules/openstack v0.1.1-0.20230824094610-976b18ca2875 // indirect; indirect // indirect // indirect github.com/pkg/errors v0.9.1 // indirect github.com/prometheus/client_golang v1.14.0 // indirect github.com/prometheus/client_model v0.3.0 // indirect diff --git a/modules/test/go.sum b/modules/test/go.sum index 1435ca3a..0b16882b 100644 --- a/modules/test/go.sum +++ b/modules/test/go.sum @@ -232,8 +232,6 @@ github.com/openshift/api v0.0.0-20230414143018-3367bc7e6ac7 h1:rncLxJBpFGqBztyxC github.com/openshift/api v0.0.0-20230414143018-3367bc7e6ac7/go.mod h1:ctXNyWanKEjGj8sss1KjjHQ3ENKFm33FFnS5BKaIPh4= github.com/openstack-k8s-operators/infra-operator/apis v0.1.1-0.20230914145253-116f307c7875 h1:DUlCjbi3XxH66oL97MFZF5wgL28HdU+r8TkBZVw7WIc= github.com/openstack-k8s-operators/infra-operator/apis v0.1.1-0.20230914145253-116f307c7875/go.mod h1:NgrvT3CKMu6fE8Nt1H79qHx11L3I7Bb2eItniM7c9ow= -github.com/openstack-k8s-operators/keystone-operator/api v0.1.1-0.20230914163026-da9aa9de960a h1:MFYwi2Xk9r3OMPToCSbvqYVNrm7P+aFzGDN0eVNpgu8= -github.com/openstack-k8s-operators/keystone-operator/api v0.1.1-0.20230914163026-da9aa9de960a/go.mod h1:nxrbUOIGMJ1h2pNlawhURdt/XJ95dW2wZGedmOVo2aw= github.com/openstack-k8s-operators/mariadb-operator/api v0.1.1-0.20230913081601-9e4fc8aadad5 h1:dQcSQuXfgzgOhc4v+zD0jE6WWhn6FHr5nALOjJBPxyI= github.com/openstack-k8s-operators/mariadb-operator/api v0.1.1-0.20230913081601-9e4fc8aadad5/go.mod h1:mJyhm/YiQZaYhLvOuLng/ITpwx8HvsYVht+VotS1Ed8= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= diff --git a/modules/test/helpers/keystone.go b/modules/test/helpers/keystone.go deleted file mode 100644 index bdbe3a3d..00000000 --- a/modules/test/helpers/keystone.go +++ /dev/null @@ -1,226 +0,0 @@ -/* -Copyright 2023 Red Hat -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package helpers - -import ( - "github.com/google/uuid" - "github.com/onsi/gomega" - keystonev1 "github.com/openstack-k8s-operators/keystone-operator/api/v1beta1" - "github.com/openstack-k8s-operators/lib-common/modules/common/condition" - "github.com/openstack-k8s-operators/lib-common/modules/test/apis" - k8s_errors "k8s.io/apimachinery/pkg/api/errors" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/types" -) - -// CreateKeystoneAPI creates a new KeystoneAPI instance with the specified namespace in the Kubernetes cluster. -// -// Example usage: -// -// keystoneAPI := th.CreateKeystoneAPI(namespace) -// DeferCleanup(th.DeleteKeystoneAPI, keystoneAPI) -func (tc *TestHelper) CreateKeystoneAPI(namespace string) types.NamespacedName { - keystone := &keystonev1.KeystoneAPI{ - TypeMeta: metav1.TypeMeta{ - APIVersion: "keystone.openstack.org/v1beta1", - Kind: "KeystoneAPI", - }, - ObjectMeta: metav1.ObjectMeta{ - Name: "keystone-" + uuid.New().String(), - Namespace: namespace, - }, - Spec: keystonev1.KeystoneAPISpec{}, - } - - gomega.Expect(tc.K8sClient.Create(tc.Ctx, keystone.DeepCopy())).Should(gomega.Succeed()) - name := types.NamespacedName{Namespace: namespace, Name: keystone.Name} - - // the Status field needs to be written via a separate client - keystone = tc.GetKeystoneAPI(name) - keystone.Status = keystonev1.KeystoneAPIStatus{ - APIEndpoints: map[string]string{ - "public": "http://keystone-public-openstack.testing", - "internal": "http://keystone-internal.openstack.svc:5000", - }, - } - gomega.Expect(tc.K8sClient.Status().Update(tc.Ctx, keystone.DeepCopy())).Should(gomega.Succeed()) - - tc.Logger.Info("KeystoneAPI created", "KeystoneAPI", name) - return name -} - -// CreateKeystoneAPIWithFixture creates a KeystoneAPI CR and configures -// its endpoints to point to the KeystoneAPIFixture that simulate the -// keystone-api behavior. -func (tc *TestHelper) CreateKeystoneAPIWithFixture( - namespace string, fixture *apis.KeystoneAPIFixture, -) types.NamespacedName { - n := "keystone-" + uuid.New().String() - - tc.CreateSecret( - types.NamespacedName{Namespace: namespace, Name: n + "-secret"}, - map[string][]byte{ - "admin-password": []byte("admin-password"), - }, - ) - - keystone := &keystonev1.KeystoneAPI{ - TypeMeta: metav1.TypeMeta{ - APIVersion: "keystone.openstack.org/v1beta1", - Kind: "KeystoneAPI", - }, - ObjectMeta: metav1.ObjectMeta{ - Name: n, - Namespace: namespace, - }, - Spec: keystonev1.KeystoneAPISpec{ - Secret: n + "-secret", - AdminUser: "admin", - PasswordSelectors: keystonev1.PasswordSelector{ - Admin: "admin-password", - }, - }, - } - - gomega.Expect(tc.K8sClient.Create(tc.Ctx, keystone.DeepCopy())).Should(gomega.Succeed()) - name := types.NamespacedName{Namespace: namespace, Name: keystone.Name} - - // the Status field needs to be written via a separate client - keystone = tc.GetKeystoneAPI(name) - keystone.Status = keystonev1.KeystoneAPIStatus{ - APIEndpoints: map[string]string{ - "public": fixture.Endpoint(), - "internal": "http://keystone-internal.openstack.svc:5000", - }, - } - gomega.Expect(tc.K8sClient.Status().Update(tc.Ctx, keystone.DeepCopy())).Should(gomega.Succeed()) - - tc.Logger.Info("KeystoneAPI created", "KeystoneAPI", name) - return name -} - -// DeleteKeystoneAPI deletes a KeystoneAPI resource from the Kubernetes cluster. -// -// # After the deletion, the function checks again if the KeystoneAPI is successfully deleted -// -// Example usage: -// -// keystoneAPI := th.CreateKeystoneAPI(namespace) -// DeferCleanup(th.DeleteKeystoneAPI, keystoneAPI) -func (tc *TestHelper) DeleteKeystoneAPI(name types.NamespacedName) { - gomega.Eventually(func(g gomega.Gomega) { - keystone := &keystonev1.KeystoneAPI{} - err := tc.K8sClient.Get(tc.Ctx, name, keystone) - // if it is already gone that is OK - if k8s_errors.IsNotFound(err) { - return - } - g.Expect(err).NotTo(gomega.HaveOccurred()) - - g.Expect(tc.K8sClient.Delete(tc.Ctx, keystone)).Should(gomega.Succeed()) - - err = tc.K8sClient.Get(tc.Ctx, name, keystone) - g.Expect(k8s_errors.IsNotFound(err)).To(gomega.BeTrue()) - }, tc.Timeout, tc.Interval).Should(gomega.Succeed()) -} - -// GetKeystoneAPI retrieves a KeystoneAPI resource. -// -// The function returns a pointer to the retrieved KeystoneAPI resource. -// example usage: -// -// keystoneAPIName := th.CreateKeystoneAPI(novaNames.NovaName.Namespace) -// DeferCleanup(th.DeleteKeystoneAPI, keystoneAPIName) -// keystoneAPI := th.GetKeystoneAPI(keystoneAPIName) -func (tc *TestHelper) GetKeystoneAPI(name types.NamespacedName) *keystonev1.KeystoneAPI { - instance := &keystonev1.KeystoneAPI{} - gomega.Eventually(func(g gomega.Gomega) { - g.Expect(tc.K8sClient.Get(tc.Ctx, name, instance)).Should(gomega.Succeed()) - }, tc.Timeout, tc.Interval).Should(gomega.Succeed()) - return instance -} - -// GetKeystoneService function retrieves and returns the KeystoneService resource -// -// Example usage: -// -// keystoneServiceName := th.CreateKeystoneService(namespace) -func (tc *TestHelper) GetKeystoneService(name types.NamespacedName) *keystonev1.KeystoneService { - instance := &keystonev1.KeystoneService{} - gomega.Eventually(func(g gomega.Gomega) { - g.Expect(tc.K8sClient.Get(tc.Ctx, name, instance)).Should(gomega.Succeed()) - }, tc.Timeout, tc.Interval).Should(gomega.Succeed()) - return instance -} - -// SimulateKeystoneServiceReady simulates the readiness of a KeystoneService -// resource by seting the Ready condition of the KeystoneService to true -// -// Example usage: -// keystoneServiceName := th.CreateKeystoneService(namespace) -func (tc *TestHelper) SimulateKeystoneServiceReady(name types.NamespacedName) { - gomega.Eventually(func(g gomega.Gomega) { - service := tc.GetKeystoneService(name) - service.Status.Conditions.MarkTrue(condition.ReadyCondition, "Ready") - g.Expect(tc.K8sClient.Status().Update(tc.Ctx, service)).To(gomega.Succeed()) - }, tc.Timeout, tc.Interval).Should(gomega.Succeed()) - tc.Logger.Info("Simulated KeystoneService ready", "on", name) -} - -// AssertKeystoneServiceDoesNotExist ensures the KeystoneService resource does not exist in a k8s cluster. -func (tc *TestHelper) AssertKeystoneServiceDoesNotExist(name types.NamespacedName) { - instance := &keystonev1.KeystoneService{} - gomega.Eventually(func(g gomega.Gomega) { - err := tc.K8sClient.Get(tc.Ctx, name, instance) - g.Expect(k8s_errors.IsNotFound(err)).To(gomega.BeTrue()) - }, tc.Timeout, tc.Interval).Should(gomega.Succeed()) -} - -// GetKeystoneEndpoint retrieves a KeystoneEndpoint resource from the Kubernetes cluster. -// -// Example usage: -// -// keystoneEndpointName := th.CreateKeystoneEndpoint(namespace) -func (tc *TestHelper) GetKeystoneEndpoint(name types.NamespacedName) *keystonev1.KeystoneEndpoint { - instance := &keystonev1.KeystoneEndpoint{} - gomega.Eventually(func(g gomega.Gomega) { - g.Expect(tc.K8sClient.Get(tc.Ctx, name, instance)).Should(gomega.Succeed()) - }, tc.Timeout, tc.Interval).Should(gomega.Succeed()) - return instance -} - -// SimulateKeystoneEndpointReady function retrieves the KeystoneEndpoint resource and -// simulates a KeystoneEndpoint resource being marked as ready. -// -// Example usage: -// -// keystoneEndpointName := th.CreateKeystoneEndpoint(namespace) -// th.SimulateKeystoneEndpointReady(keystoneEndpointName) -func (tc *TestHelper) SimulateKeystoneEndpointReady(name types.NamespacedName) { - gomega.Eventually(func(g gomega.Gomega) { - endpoint := tc.GetKeystoneEndpoint(name) - endpoint.Status.Conditions.MarkTrue(condition.ReadyCondition, "Ready") - g.Expect(tc.K8sClient.Status().Update(tc.Ctx, endpoint)).To(gomega.Succeed()) - }, tc.Timeout, tc.Interval).Should(gomega.Succeed()) - tc.Logger.Info("Simulated KeystoneEndpoint ready", "on", name) -} - -// AssertKeystoneEndpointDoesNotExist ensures the KeystoneEndpoint resource does not exist in a k8s cluster. -func (tc *TestHelper) AssertKeystoneEndpointDoesNotExist(name types.NamespacedName) { - instance := &keystonev1.KeystoneEndpoint{} - gomega.Eventually(func(g gomega.Gomega) { - err := tc.K8sClient.Get(tc.Ctx, name, instance) - g.Expect(k8s_errors.IsNotFound(err)).To(gomega.BeTrue()) - }, tc.Timeout, tc.Interval).Should(gomega.Succeed()) -}