From 56b6b8a3189f7df7fd2bb6d88c2064731861180f Mon Sep 17 00:00:00 2001 From: marbarta Date: Wed, 14 Jun 2023 17:21:03 +0200 Subject: [PATCH] Refactor after Pregnor PR merge --- tests/e2e/cert_manager_test.go | 115 ------ tests/e2e/const.go | 8 +- tests/e2e/go.mod | 35 +- tests/e2e/go.sum | 151 ++------ tests/e2e/helm.go | 65 ++++ tests/e2e/helm_test.go | 229 ----------- tests/e2e/install_test.go | 52 --- tests/e2e/k8s.go | 155 ++++++++ tests/e2e/k8s_test.go | 358 ------------------ tests/e2e/koperator_test.go | 256 ------------- ...prod_consum_test.go => produce_consume.go} | 41 +- tests/e2e/produce_consume_test.go | 27 ++ tests/e2e/prometheus_test.go | 106 ------ tests/e2e/test_install.go | 4 +- tests/e2e/test_test.go | 27 ++ tests/e2e/test_uninstall.go | 55 +++ tests/e2e/uninstall.go | 194 ++++++++++ tests/e2e/uninstall_cluster.go | 77 ++++ tests/e2e/uninstall_cluster_test.go | 52 +++ tests/e2e/utils.go | 5 + tests/e2e/zookeeper_test.go | 117 ------ 21 files changed, 714 insertions(+), 1415 deletions(-) delete mode 100644 tests/e2e/cert_manager_test.go delete mode 100644 tests/e2e/helm_test.go delete mode 100644 tests/e2e/install_test.go delete mode 100644 tests/e2e/k8s_test.go delete mode 100644 tests/e2e/koperator_test.go rename tests/e2e/{kafka_prod_consum_test.go => produce_consume.go} (69%) create mode 100644 tests/e2e/produce_consume_test.go delete mode 100644 tests/e2e/prometheus_test.go create mode 100644 tests/e2e/test_test.go create mode 100644 tests/e2e/test_uninstall.go create mode 100644 tests/e2e/uninstall.go create mode 100644 tests/e2e/uninstall_cluster.go create mode 100644 tests/e2e/uninstall_cluster_test.go delete mode 100644 tests/e2e/zookeeper_test.go diff --git a/tests/e2e/cert_manager_test.go b/tests/e2e/cert_manager_test.go deleted file mode 100644 index c483d16aaf..0000000000 --- a/tests/e2e/cert_manager_test.go +++ /dev/null @@ -1,115 +0,0 @@ -// Copyright © 2023 Cisco Systems, Inc. and/or its affiliates -// -// 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 e2e - -import ( - "fmt" - - "github.com/gruntwork-io/terratest/modules/k8s" - . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" -) - -// requireApplyingCertManagerCRDs deploys the cert-manager CRDs and checks -// their existence afterwards. -func requireApplyingCertManagerCRDs(kubectlOptions *k8s.KubectlOptions, certManagerVersion Version) { - It("Applying cert-manager CRDs", func() { - By("Applying cert-manager CRDs with version " + certManagerVersion) - applyK8sResourceManifest( - kubectlOptions, - "https://github.com/jetstack/cert-manager/releases/download/"+certManagerVersion+"/cert-manager.crds.yaml", - ) - - By("Verifying cert-manager CRDs") - requireExistingCRDs( - kubectlOptions, - "certificaterequests.cert-manager.io", - "certificates.cert-manager.io", - "challenges.acme.cert-manager.io", - "clusterissuers.cert-manager.io", - "issuers.cert-manager.io", - "orders.acme.cert-manager.io", - ) - }) -} - -// requireInstallingCertManager deploys cert-manager CRDs and Helm chart and -// checks the success of those operations. -func requireInstallingCertManager(kubectlOptions *k8s.KubectlOptions, certManagerVersion Version) { - When("Installing cert-manager", func() { - requireApplyingCertManagerCRDs(kubectlOptions, certManagerVersion) - requireInstallingCertManagerHelmChartIfDoesNotExist(kubectlOptions, certManagerVersion) - }) -} - -// requireInstallingCertManagerHelmChartIfDoesNotExist checks the existence of the cert-manager -// Helm release and installs it if it's not present. -func requireInstallingCertManagerHelmChartIfDoesNotExist( - kubectlOptions *k8s.KubectlOptions, - certManagerVersion string, -) { - It("Installing cert-manager Helm chart", func() { - installHelmChartIfDoesNotExist( - kubectlOptions, - "https://charts.jetstack.io", - "cert-manager", - certManagerVersion, - "cert-manager", - nil, - ) - - By("Verifying cert-manager pods") - requireRunningPods(kubectlOptions, "app.kubernetes.io/name", "cert-manager", "cainjector", "webhook") - }) -} - -// requireUninstallingCertManager uninstall Cert-manager Helm chart and -// remove CRDs. -func requireUninstallingCertManager(kubectlOptions *k8s.KubectlOptions) { - When("Uninstalling zookeeper-operator", func() { - requireUninstallingCertManagerHelmChart(kubectlOptions) - requireRemoveCertManagerCRDs(kubectlOptions) - }) -} - -// requireUninstallingCertManagerHelmChart uninstalls cert-manager helm chart -// and checks the success of that operation. -func requireUninstallingCertManagerHelmChart(kubectlOptions *k8s.KubectlOptions) { - It("Uninstalling Cert-manager Helm chart", func() { - uninstallHelmChartIfExists(kubectlOptions, "cert-manager", true) - By("Verifying Cert-manager helm chart resources cleanup") - - certManagerK8sResources := basicK8sCRDs() - certManagerK8sResources = append(certManagerK8sResources, certManagerCRDs()...) - - remainedResources := getK8sResources(kubectlOptions, - certManagerK8sResources, - fmt.Sprintf(managedByHelmLabelTemplate, "cert-manager"), - "", - kubectlArgGoTemplateKindNameNamespace, - "--all-namespaces") - Expect(remainedResources).Should(BeEmpty()) - }) - -} - -// requireRemoveKoperatorCRDs deletes the cert-manager CRDs -func requireRemoveCertManagerCRDs(kubectlOptions *k8s.KubectlOptions) { - It("Removing cert-manager CRDs", func() { - for _, crd := range certManagerCRDs() { - deleteK8sResourceGlobalNoErrNotFound(kubectlOptions, defaultDeletionTimeout, "crds", crd) - } - }) -} diff --git a/tests/e2e/const.go b/tests/e2e/const.go index 5f9c529dd0..79d570f067 100644 --- a/tests/e2e/const.go +++ b/tests/e2e/const.go @@ -109,8 +109,6 @@ const ( // LocalVersion means using the files in the local repository snapshot. LocalVersion Version = "local" - kubectlNotFoundErrorMsg = "NotFound" - kubectlArgGoTemplateName = `-o=go-template='{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}'` kubectlArgGoTemplateKindNameNamespace = `-o=go-template='{{range .items}}{{.kind}}{{"/"}}{{.metadata.name}}{{if .metadata.namespace}}{{"."}}{{.metadata.namespace}}{{end}}{{"\n"}}{{end}}'` kubectlArgGoTemplateInternalListenersName = `-o=go-template='{{range $key,$value := .status.listenerStatuses.internalListeners}}{{$key}}{{"\n"}}{{end}}` @@ -118,9 +116,11 @@ const ( // kubectlArgGoTemplateExternalListenersName = `-o=go-template='{{range $key,$value := .status.listenerStatuses.externallListeners}}{{$key}}{{"\n"}}{{end}}` // kubectlArgGoTemplateExternalListenerAddressesTemplate = `-o=go-template='{{range .status.listenerStatuses.externalListeners.%s}}{{.address}}{{"\n"}}{{end}}` + crdKind = "customresourcedefinitions.apiextensions.k8s.io" kafkaKind = "kafkaclusters.kafka.banzaicloud.io" + kafkaTopicKind = "kafkatopics.kafka.banzaicloud.io" kafkaClusterName = "kafka" - testTopicName = "topic-icp" + testTopicName = "topic-test" kcatPodName = "kcat" zookeeperKind = "zookeeperclusters.zookeeper.pravega.io" zookeeperClusterName = "zookeeper-server" @@ -138,7 +138,7 @@ const ( kafkaTopicTemplate = "templates/topic.yaml.tmpl" ) -func basicK8sCRDs() []string { +func basicK8sResourceKinds() []string { return []string{ "pods", "services", diff --git a/tests/e2e/go.mod b/tests/e2e/go.mod index 52753ef6b1..00dd8e12d3 100644 --- a/tests/e2e/go.mod +++ b/tests/e2e/go.mod @@ -4,8 +4,7 @@ go 1.20 require ( emperror.dev/errors v0.8.1 - github.com/Masterminds/sprig/v3 v3.2.3 - github.com/banzaicloud/koperator/api v0.28.0 + github.com/cisco-open/k8s-objectmatcher v1.9.0 github.com/gruntwork-io/terratest v0.41.24 github.com/onsi/ginkgo/v2 v2.9.5 github.com/onsi/gomega v1.27.6 @@ -14,22 +13,16 @@ require ( sigs.k8s.io/yaml v1.3.0 ) -require ( - github.com/klauspost/compress v1.16.3 // indirect - github.com/pierrec/lz4/v4 v4.1.17 // indirect - github.com/twmb/franz-go/pkg/kmsg v1.4.0 // indirect -) - require ( github.com/Masterminds/goutils v1.1.1 // indirect - github.com/Masterminds/semver/v3 v3.2.0 // indirect + github.com/Masterminds/semver v1.5.0 // indirect + github.com/Masterminds/sprig v2.22.0+incompatible // indirect github.com/aws/aws-sdk-go v1.44.122 // indirect - github.com/banzaicloud/istio-client-go v0.0.17 // indirect github.com/boombuler/barcode v1.0.1-0.20190219062509-6c824513bacc // indirect - github.com/cert-manager/cert-manager v1.9.1 // indirect - github.com/cpuguy83/go-md2man/v2 v2.0.1 // indirect + github.com/cpuguy83/go-md2man/v2 v2.0.0 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/emicklei/go-restful/v3 v3.9.0 // indirect + github.com/evanphx/json-patch v5.6.0+incompatible // indirect github.com/ghodss/yaml v1.0.0 // indirect github.com/go-errors/errors v1.4.2 // indirect github.com/go-logr/logr v1.2.4 // indirect @@ -40,16 +33,16 @@ require ( github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 // indirect github.com/gogo/protobuf v1.3.2 // indirect github.com/golang/protobuf v1.5.3 // indirect - github.com/google/gnostic v0.6.9 // indirect + github.com/google/gnostic v0.5.7-v3refs // indirect github.com/google/go-cmp v0.5.9 // indirect - github.com/google/gofuzz v1.2.0 // indirect + github.com/google/gofuzz v1.1.0 // indirect github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1 // indirect github.com/google/uuid v1.3.0 // indirect github.com/gruntwork-io/go-commons v0.8.0 // indirect - github.com/hashicorp/errwrap v1.1.0 // indirect - github.com/hashicorp/go-multierror v1.1.1 // indirect - github.com/huandu/xstrings v1.3.3 // indirect - github.com/imdario/mergo v0.3.13 // indirect + github.com/hashicorp/errwrap v1.0.0 // indirect + github.com/hashicorp/go-multierror v1.1.0 // indirect + github.com/huandu/xstrings v1.4.0 // indirect + github.com/imdario/mergo v0.3.11 // indirect github.com/jmespath/go-jmespath v0.4.0 // indirect github.com/josharian/intern v1.0.0 // indirect github.com/json-iterator/go v1.1.12 // indirect @@ -66,15 +59,12 @@ require ( github.com/pmezard/go-difflib v1.0.0 // indirect github.com/pquerna/otp v1.2.0 // indirect github.com/russross/blackfriday/v2 v2.1.0 // indirect - github.com/shopspring/decimal v1.2.0 // indirect - github.com/spf13/cast v1.4.1 // indirect github.com/spf13/pflag v1.0.5 // indirect github.com/stretchr/testify v1.8.1 // indirect - github.com/twmb/franz-go v1.13.4 github.com/urfave/cli v1.22.2 // indirect go.uber.org/atomic v1.7.0 // indirect go.uber.org/multierr v1.6.0 // indirect - golang.org/x/crypto v0.7.0 // indirect + golang.org/x/crypto v0.1.0 // indirect golang.org/x/net v0.10.0 // indirect golang.org/x/oauth2 v0.1.0 // indirect golang.org/x/sys v0.8.0 // indirect @@ -92,7 +82,6 @@ require ( k8s.io/klog/v2 v2.90.1 // indirect k8s.io/kube-openapi v0.0.0-20230501164219-8b0f38b5fd1f // indirect k8s.io/utils v0.0.0-20230209194617-a36077c30491 // indirect - sigs.k8s.io/controller-runtime v0.13.0 // indirect sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect ) diff --git a/tests/e2e/go.sum b/tests/e2e/go.sum index c1e6fa1c71..8db5daf55e 100644 --- a/tests/e2e/go.sum +++ b/tests/e2e/go.sum @@ -1,41 +1,29 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= emperror.dev/errors v0.8.1 h1:UavXZ5cSX/4u9iyvH6aDcuGkVjeexUGJ7Ij7G4VfQT0= emperror.dev/errors v0.8.1/go.mod h1:YcRvLPh626Ubn2xqtoprejnA5nFha+TJ+2vew48kWuE= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/Masterminds/goutils v1.1.1 h1:5nUrii3FMTL5diU80unEVvNevw1nH4+ZV4DSLVJLSYI= github.com/Masterminds/goutils v1.1.1/go.mod h1:8cTjp+g8YejhMuvIA5y2vz3BpJxksy863GQaJW2MFNU= -github.com/Masterminds/semver/v3 v3.2.0 h1:3MEsd0SM6jqZojhjLWWeBY+Kcjy9i6MQAeY7YgDP83g= -github.com/Masterminds/semver/v3 v3.2.0/go.mod h1:qvl/7zhW3nngYb5+80sSMF+FG2BjYrf8m9wsX0PNOMQ= -github.com/Masterminds/sprig/v3 v3.2.3 h1:eL2fZNezLomi0uOLqjQoN6BfsDD+fyLtgbJMAj9n6YA= -github.com/Masterminds/sprig/v3 v3.2.3/go.mod h1:rXcFaZ2zZbLRJv/xSysmlgIM1u11eBaRMhvYXJNkGuM= -github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= -github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= +github.com/Masterminds/semver v1.5.0 h1:H65muMkzWKEuNDnfl9d70GUjFniHKHRbFPGBuZ3QEww= +github.com/Masterminds/semver v1.5.0/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF078ddwwvV3Y= +github.com/Masterminds/sprig v2.22.0+incompatible h1:z4yfnGrZ7netVz+0EDJ0Wi+5VZCSYp4Z0m2dk6cEM60= +github.com/Masterminds/sprig v2.22.0+incompatible/go.mod h1:y6hNFY5UBTIWBxnzTeuNhlNS5hqE0NB0E6fgfo2Br3o= github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPdPJAN/hZIm0C4OItdklCFmMRWYpio= github.com/aws/aws-sdk-go v1.44.122 h1:p6mw01WBaNpbdP2xrisz5tIkcNwzj/HysobNoaAHjgo= github.com/aws/aws-sdk-go v1.44.122/go.mod h1:y4AeaBuwd2Lk+GepC1E9v0qOiTws0MIWAX4oIKwKHZo= -github.com/banzaicloud/istio-client-go v0.0.17 h1:wiplbM7FDiIHopujInAnin3zuovtVcphtKy9En39q5I= -github.com/banzaicloud/istio-client-go v0.0.17/go.mod h1:rpnEYYGHzisx8nARl2d30Oq38EeCX0/PPaxMaREfE9I= -github.com/banzaicloud/koperator/api v0.28.0 h1:JV7J28PWNGb9JSsimqAQLsZVacPWh5DkF0oalygi6eU= -github.com/banzaicloud/koperator/api v0.28.0/go.mod h1:qvpewvjdELAnfO70vg9397CXZ4K4uHxpiWtf5fhKSrQ= github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= github.com/boombuler/barcode v1.0.1-0.20190219062509-6c824513bacc h1:biVzkmvwrH8WK8raXaxBx6fRVTlJILwEwQGL1I/ByEI= github.com/boombuler/barcode v1.0.1-0.20190219062509-6c824513bacc/go.mod h1:paBWMcWSl3LHKBqUq+rly7CNSldXjb2rDl3JlRe0mD8= -github.com/buger/jsonparser v1.1.1/go.mod h1:6RYKKt7H4d4+iWqouImQ9R2FZql3VbhNgx27UK13J/0= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= -github.com/cert-manager/cert-manager v1.9.1 h1:bNIsQyfWdIMSEwxgO4sVUEyAn6xuSgNwdt9m92OBACc= -github.com/cert-manager/cert-manager v1.9.1/go.mod h1:Bs3WsNX1LPKTs3boh//p7jLOn6ZRGEPz99ITeZU0g3c= -github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= +github.com/cisco-open/k8s-objectmatcher v1.9.0 h1:/sfuO0BD09fpynZjXsqeZrh28Juc4VEwc2P6Ov/Q6fM= +github.com/cisco-open/k8s-objectmatcher v1.9.0/go.mod h1:CH4E6qAK+q+JwKFJn0DaTNqxrbmWCaDQzGthKLK4nZ0= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= -github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= -github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= -github.com/cncf/xds/go v0.0.0-20210312221358-fbca930ec8ed/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= -github.com/cpuguy83/go-md2man/v2 v2.0.1 h1:r/myEWzV9lfsM1tFLgDyu0atFtJ1fXn261LKYj/3DxU= -github.com/cpuguy83/go-md2man/v2 v2.0.1/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= +github.com/cpuguy83/go-md2man/v2 v2.0.0 h1:EoUDS0afbrsXAZ9YQ9jdu/mZ2sXgT1/2yyNng4PGlyM= +github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= @@ -43,21 +31,16 @@ github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815/go.mod h1:WwZ+bS3ebgob9U8Nd0kOddGdZWjyMGR8Wziv+TBNwSE= github.com/emicklei/go-restful/v3 v3.9.0 h1:XwGDlfxEnQZzuopoqxwSEllNcCOM9DhhFyhFIIGKwxE= github.com/emicklei/go-restful/v3 v3.9.0/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc= -github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= -github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= -github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= -github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.mod h1:hliV/p42l8fGbc6Y9bQ70uLwIvmJyVE5k4iMKlh8wCQ= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= +github.com/evanphx/json-patch v5.6.0+incompatible h1:jBYDEEiFBPxA0v50tFdvOzQQTCvpL6mnFh5mB2/l16U= +github.com/evanphx/json-patch v5.6.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU= -github.com/flowstack/go-jsonschema v0.1.1/go.mod h1:yL7fNggx1o8rm9RlgXv7hTBWxdBM0rVwpMwimd3F3N0= -github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY= github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/go-errors/errors v1.0.1/go.mod h1:f4zRHt4oKfwPJE5k8C9vpYG+aDHdBFUsgrm6/TyX73Q= github.com/go-errors/errors v1.4.2 h1:J6MZopCL4uSllY1OfXM374weqZFFItUbrImctkmUxIA= github.com/go-errors/errors v1.4.2/go.mod h1:sIVyrIiJhuEF+Pj9Ebtd6P/rEYROXFi3BopGUQ5a5Og= -github.com/go-logr/logr v0.1.0/go.mod h1:ixOQHD9gLJUVQQ2ZOR7zLEifBX6tGkNJF4QyIY7sIas= github.com/go-logr/logr v1.2.0/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= @@ -71,7 +54,6 @@ github.com/go-sql-driver/mysql v1.4.1 h1:g24URVg0OFbNUTx9qqY1IRZ9D9z3iPyi5zKhQZp github.com/go-sql-driver/mysql v1.4.1/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI= github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572/go.mod h1:9Pwr4B2jHnOSGXyyzV8ROjYa2ojvAY6HCGYYfMoC3Ls= -github.com/gogo/protobuf v1.3.0/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= @@ -79,71 +61,57 @@ github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfb github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= -github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= -github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -github.com/google/gnostic v0.6.9 h1:ZK/5VhkoX835RikCHpSUJV9a+S3e1zLh59YnyWeBW+0= -github.com/google/gnostic v0.6.9/go.mod h1:Nm8234We1lq6iB9OmlgNv3nH91XLLVZHCDayfA3xq+E= +github.com/google/gnostic v0.5.7-v3refs h1:FhTMOKj2VhjpouxvWJAV1TL304uMlb9zcDqkl6cEI54= +github.com/google/gnostic v0.5.7-v3refs/go.mod h1:73MKFl6jIHelAJNaBGFzt3SPtZULs9dYrGFt8OiIsHQ= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= -github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0= -github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/google/gofuzz v1.1.0 h1:Hsa8mG0dQ46ij8Sl2AYJDUv1oA9/d6Vk+3LG99Oe02g= +github.com/google/gofuzz v1.1.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1 h1:K6RDEckDVWvDI9JAJYCmNdQXq6neHJOYx3V6jnqNEec= github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= -github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= github.com/gruntwork-io/go-commons v0.8.0 h1:k/yypwrPqSeYHevLlEDmvmgQzcyTwrlZGRaxEM6G0ro= github.com/gruntwork-io/go-commons v0.8.0/go.mod h1:gtp0yTtIBExIZp7vyIV9I0XQkVwiQZze678hvDXof78= github.com/gruntwork-io/terratest v0.41.24 h1:j6T6qe4deVvynTG2UmnjGwZy83he6xKgTaYWiSdFv/w= github.com/gruntwork-io/terratest v0.41.24/go.mod h1:O6gajNBjO1wvc7Wl9WtbO+ORcdnhAV2GQiBE71ycwIk= +github.com/hashicorp/errwrap v1.0.0 h1:hLrqtEDnRye3+sgx6z4qVLNuviH3MR5aQ0ykNJa/UYA= github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= -github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I= -github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= -github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo= -github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM= -github.com/huandu/xstrings v1.3.3 h1:/Gcsuc1x8JVbJ9/rlye4xZnVAbEkGauT8lbebqcQws4= -github.com/huandu/xstrings v1.3.3/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE= +github.com/hashicorp/go-multierror v1.1.0 h1:B9UzwGQJehnUY1yNrnwREHc3fGbC2xefo8g4TbElacI= +github.com/hashicorp/go-multierror v1.1.0/go.mod h1:spPvp8C1qA32ftKqdAHm4hHTbPw+vmowP0z+KUhOZdA= +github.com/huandu/xstrings v1.4.0 h1:D17IlohoQq4UcpqD7fDk80P7l+lwAmlFaBHgOipl2FU= +github.com/huandu/xstrings v1.4.0/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE= github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= +github.com/imdario/mergo v0.3.11 h1:3tnifQM4i+fbajXKBHXWEH+KvNHqojZ778UH75j3bGA= github.com/imdario/mergo v0.3.11/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA= -github.com/imdario/mergo v0.3.13 h1:lFzP57bqS/wsqKssCGmtLAb8A0wKjLGrve2q3PPVcBk= -github.com/imdario/mergo v0.3.13/go.mod h1:4lJ1jqUDcsbIECGy0RUJAXNIhg+6ocWgb1ALK2O4oXg= github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg= github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo= github.com/jmespath/go-jmespath/internal/testify v1.5.1 h1:shLQSRRSCCPj3f2gpwzGwWFoC7ycTf1rcQZHOlsJ6N8= github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U= github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= -github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= -github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/klauspost/compress v1.16.3 h1:XuJt9zzcnaz6a16/OU53ZjWp/v7/42WcR5t2a0PcNQY= -github.com/klauspost/compress v1.16.3/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0= @@ -159,12 +127,10 @@ github.com/mattn/go-isatty v0.0.11/go.mod h1:PhnuNfih5lzO57/f3n+odYbM4JtupLOxQOA github.com/mattn/go-zglob v0.0.1/go.mod h1:9fxibJccNxU2cnpIKLRRFA7zX7qhkJIQWBb449FYHOo= github.com/mattn/go-zglob v0.0.2-0.20190814121620-e3c945676326 h1:ofNAzWCcyTALn2Zv40+8XitdzCgXY6e9qvXwN9W0YXg= github.com/mattn/go-zglob v0.0.2-0.20190814121620-e3c945676326/go.mod h1:9fxibJccNxU2cnpIKLRRFA7zX7qhkJIQWBb449FYHOo= -github.com/mitchellh/copystructure v1.0.0/go.mod h1:SNtv71yrdKgLRyLFxmLdkAbkKEFWgYaq1OVrnRcwhnw= github.com/mitchellh/copystructure v1.2.0 h1:vpKXTN4ewci03Vljg/q9QvCGUDttBOGBIa15WveJJGw= github.com/mitchellh/copystructure v1.2.0/go.mod h1:qLl+cE2AmVv+CoeAwDPye/v+N2HKCj9FbZEVFJRxO9s= github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= -github.com/mitchellh/reflectwalk v1.0.0/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= github.com/mitchellh/reflectwalk v1.0.2 h1:G2LzWKi524PWgd3mLHV8Y5k7s6XUvT0Gef6zxSIeXaQ= github.com/mitchellh/reflectwalk v1.0.2/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= github.com/moby/spdystream v0.2.0 h1:cjW1zVyyoiM0T7b6UoySUFqzXMoqRckQtXwGPiBhOM8= @@ -172,20 +138,14 @@ github.com/moby/spdystream v0.2.0/go.mod h1:f7i0iNDQJ059oMTcWxx8MA/zKFIuD/lY+0Gq github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= -github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= -github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= -github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE= github.com/onsi/ginkgo/v2 v2.9.5 h1:+6Hr4uxzP4XIUyAkg61dWBw8lb/gc4/X5luuxN/EC+Q= github.com/onsi/ginkgo/v2 v2.9.5/go.mod h1:tvAoo1QUJwNEU2ITftXTpR7R1RbCzoZUOs3RonqW57k= github.com/onsi/gomega v1.27.6 h1:ENqfyGeS5AX/rlXDd/ETokDz93u0YufY1Pgxuy/PvWE= github.com/onsi/gomega v1.27.6/go.mod h1:PIQNjfQwkP3aQAH7lf7j87O/5FiNr+ZR8+ipb+qQlhg= -github.com/pierrec/lz4 v2.5.2+incompatible h1:WCjObylUIOlKy/+7Abdn34TLIkXiA4UWUMhxq9m9ZXI= -github.com/pierrec/lz4/v4 v4.1.17 h1:kV4Ip+/hUBC+8T6+2EgburRtkE9ef4nbY3f4dFhGjMc= -github.com/pierrec/lz4/v4 v4.1.17/go.mod h1:gZWDp/Ze/IJXGXf23ltt2EXimqmTUXEy0GFuRQyBid4= 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= @@ -193,20 +153,12 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN github.com/pquerna/otp v1.2.0 h1:/A3+Jn+cagqayeR3iHs/L62m5ue7710D35zl1zJ1kok= github.com/pquerna/otp v1.2.0/go.mod h1:dkJfzwRKNiegxyNb54X/3fLwhCynbMspSyWKnvi1AEg= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/shopspring/decimal v1.2.0 h1:abSATXmQEYyShuxI4/vyW3tV1MrKAJzCZ/0zLUXYbsQ= -github.com/shopspring/decimal v1.2.0/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= -github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= -github.com/spf13/cast v1.3.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= -github.com/spf13/cast v1.4.1 h1:s0hze+J0196ZfEMTs80N7UlFt0BDuQ7Q+JDnHiMWKdA= -github.com/spf13/cast v1.4.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= -github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/stoewer/go-strcase v1.2.0/go.mod h1:IBiWB2sKIp3wVVQ3Y035++gc+knqhUQag1KpM8ahLw8= @@ -223,19 +175,10 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -github.com/twmb/franz-go v1.13.4 h1:xu+lTAJChFqDh6u+Edr1IR2sq81nS+XGtk6OETTxFbc= -github.com/twmb/franz-go v1.13.4/go.mod h1:jm/FtYxmhxDTN0gNSb26XaJY0irdSVcsckLiR5tQNMk= -github.com/twmb/franz-go/pkg/kmsg v1.4.0 h1:tbp9hxU6m8qZhQTlpGiaIJOm4BXix5lsuEZ7K00dF0s= -github.com/twmb/franz-go/pkg/kmsg v1.4.0/go.mod h1:SxG/xJKhgPu25SamAq0rrucfp7lbzCpEXOC+vH/ELrY= github.com/urfave/cli v1.22.2 h1:gsqYFH8bb9ekPA12kRo0hfjngWQjkJPlN9R0N78BoUo= github.com/urfave/cli v1.22.2/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= -github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU= -github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415/go.mod h1:GwrjFmJcFw6At/Gs6z4yjiIwzuJ1/+UwLxMQDVQXShQ= -github.com/xeipuuv/gojsonschema v1.2.0/go.mod h1:anYRn/JVcOK2ZgGU+IjEV4nwlhoK5sQluxsYJ78Id3Y= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= -go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= go.uber.org/atomic v1.7.0 h1:ADUqmZGgLDDfbSL9ZmPxKTybcoEYHgpYfELNoN+7hsw= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/multierr v1.6.0 h1:y6IPFStTAIT5Ytl7/XYmHvzXQ7S3g/IeZW9hyZ5thw4= @@ -243,49 +186,35 @@ go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9i golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= 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-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.3.0/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4= -golang.org/x/crypto v0.7.0 h1:AvwMYaRytfdeVt3u6mLaxYtErKYjxA2OXjJ1HHq6t3A= -golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU= +golang.org/x/crypto v0.1.0 h1:MDRAIl0xIo9Io2xV565hzXHw3zVseKrJKodhohM5CjU= +golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.10.0 h1:lFO9qtOdlre5W1jxS3r/4szv2/6iXxScdzjoBMXNhYk= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20191002035440-2ec189313ef0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= -golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= -golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.1.0 h1:isLCZuhj4v+tYv7eskaN4v/TM+A1begWWgyVJDdl1+Y= golang.org/x/oauth2 v0.1.0/go.mod h1:G9FE4dLTsbXUu90h/Pf85g4w1D+SSAgR+q46nJZ8M4A= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -293,37 +222,23 @@ golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= golang.org/x/term v0.8.0 h1:n5xxQn2i3PC0yLAbjTpNT85q/Kgzcr2gIoX9OrJUols= golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE= golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/time v0.3.0 h1:rg5rLMjNzMS1RkNLzCG38eapWhnYLFYXDXj2gOlr8j4= golang.org/x/time v0.3.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= @@ -331,7 +246,6 @@ golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBn golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/tools v0.9.1 h1:8WMNJAz3zrtPmnYC7ISf5dEn3MT0gY7jBJfw27yrrLo= golang.org/x/tools v0.9.1/go.mod h1:owI94Op576fPu3cIGQeHs3joujW/2Oc6MtlxbF5dfNc= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -344,74 +258,57 @@ google.golang.org/appengine v1.6.7 h1:FZR1q0exgwxzPzp/aF+VccGrSfxfPpkBqjIIEq3ru6 google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= -google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= -google.golang.org/genproto v0.0.0-20220107163113-42d7afdf6368/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20201019141844-1ed22bb0c154/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= -google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= -google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= -google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= +google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.28.1 h1:d0NfwRgPtno5B1Wa6L2DAG+KivqkdutMf1UhdNx175w= google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc= gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= -gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gotest.tools v2.2.0+incompatible h1:VsBPFP1AI068pPrMxtb/S8Zkgf9xEmTLJjfM+P5UIEo= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= k8s.io/api v0.27.2 h1:+H17AJpUMvl+clT+BPnKf0E3ksMAzoBBg7CntpSuADo= k8s.io/api v0.27.2/go.mod h1:ENmbocXfBT2ADujUXcBhHV55RIT31IIEvkntP6vZKS4= k8s.io/apiextensions-apiserver v0.27.2 h1:iwhyoeS4xj9Y7v8YExhUwbVuBhMr3Q4bd/laClBV6Bo= k8s.io/apiextensions-apiserver v0.27.2/go.mod h1:Oz9UdvGguL3ULgRdY9QMUzL2RZImotgxvGjdWRq6ZXQ= -k8s.io/apimachinery v0.0.0-20190704094733-8f6ac2502e51/go.mod h1:ccL7Eh7zubPUSh9A3USN90/OzHNSVN6zxzde07TDCL0= k8s.io/apimachinery v0.27.2 h1:vBjGaKKieaIreI+oQwELalVG4d8f3YAMNpWLzDXkxeg= k8s.io/apimachinery v0.27.2/go.mod h1:XNfZ6xklnMCOGGFNqXG7bUrQCoR04dh/E7FprV6pb+E= k8s.io/client-go v0.27.2 h1:vDLSeuYvCHKeoQRhCXjxXO45nHVv2Ip4Fe0MfioMrhE= k8s.io/client-go v0.27.2/go.mod h1:tY0gVmUsHrAmjzHX9zs7eCjxcBsf8IiNe7KQ52biTcQ= -k8s.io/klog v1.0.0/go.mod h1:4Bi6QPql/J/LkTDqv7R/cd3hPo4k2DG6Ptcz060Ez5I= k8s.io/klog/v2 v2.90.1 h1:m4bYOKall2MmOiRaR1J+We67Do7vm9KiQVlT96lnHUw= k8s.io/klog/v2 v2.90.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0= k8s.io/kube-openapi v0.0.0-20230501164219-8b0f38b5fd1f h1:2kWPakN3i/k81b0gvD5C5FJ2kxm1WrQFanWchyKuqGg= k8s.io/kube-openapi v0.0.0-20230501164219-8b0f38b5fd1f/go.mod h1:byini6yhqGC14c3ebc/QwanvYwhuMWF6yz2F8uwW8eg= k8s.io/utils v0.0.0-20230209194617-a36077c30491 h1:r0BAOLElQnnFhE/ApUsg3iHdVYYPBjNSSOMowRZxxsY= k8s.io/utils v0.0.0-20230209194617-a36077c30491/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= -sigs.k8s.io/controller-runtime v0.13.0 h1:iqa5RNciy7ADWnIc8QxCbOX5FEKVR3uxVxKHRMc2WIQ= -sigs.k8s.io/controller-runtime v0.13.0/go.mod h1:Zbz+el8Yg31jubvAEyglRZGdLAjplZl+PgtYNI6WNTI= sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd h1:EDPBXCAspyGV4jQlpZSudPeMmr1bNJefnuqLsRAsHZo= sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd/go.mod h1:B8JuhiUyNFVKdsE8h686QcCxMaH6HrOAZj4vswFpcB0= sigs.k8s.io/structured-merge-diff/v4 v4.2.3 h1:PRbqxJClWWYMNV1dhaG4NsibJbArud9kFxnAMREiWFE= sigs.k8s.io/structured-merge-diff/v4 v4.2.3/go.mod h1:qjx8mGObPmV2aSZepjQjbmb2ihdVs8cGKBraizNC69E= -sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o= sigs.k8s.io/yaml v1.3.0 h1:a2VclLzOGrwOHDiV8EfBGhvjHvP46CtW5j6POvhYGGo= sigs.k8s.io/yaml v1.3.0/go.mod h1:GeOyir5tyXNByN85N/dRIT9es5UQNerPYEKK56eTBm8= diff --git a/tests/e2e/helm.go b/tests/e2e/helm.go index 8a39173e06..f97c0c4f73 100644 --- a/tests/e2e/helm.go +++ b/tests/e2e/helm.go @@ -292,3 +292,68 @@ func lookUpInstalledHelmReleaseByName( return nil, false, nil } + +// uninstallHelmChart uninstall Helm chart from the specified kubectl context and +// namespace using the specified helm release name. When purge is true, it removes records +// and make that name free to be reused for another installation. +// Extra arguments can be any of the helm CLI uninstall flag arguments. +func uninstallHelmChart( + kubectlOptions k8s.KubectlOptions, + helmReleaseName string, + purge bool, + extraArgs ...string, +) error { + By( + fmt.Sprintf( + "uninstalling Helm chart by name %s", + helmReleaseName, + ), + ) + + fixedArguments := []string{ + "--debug", + } + + extraArgs = append(extraArgs, fixedArguments...) + + return helm.DeleteE( + GinkgoT(), + &helm.Options{ + KubectlOptions: &kubectlOptions, + ExtraArgs: map[string][]string{ + "delete": extraArgs, + }, + }, + helmReleaseName, + purge, + ) +} + +// uninstallHelmChartIfExists checks whether the specified named Helm release exists in +// the provided kubectl context and namespace, logs it if it does and returns or +// alternatively uninstall the Helm chart from the specified kubectl context and +// namespace using the release name, extra arguments can be any of the helm +// CLI install flag arguments. +func uninstallHelmChartIfExists( + kubectlOptions k8s.KubectlOptions, + helmReleaseName string, + purge bool, + extraArgs ...string, +) error { + By(fmt.Sprintf("Checking for existing Helm release names %s", helmReleaseName)) + _, isInstalled, err := lookUpInstalledHelmReleaseByName(kubectlOptions, helmReleaseName) + if err != nil { + return err + } + + if !isInstalled { + By(fmt.Sprintf( + "skipping the uninstallation of %s, because the Helm release is not present.", + helmReleaseName, + )) + + return nil + } + + return uninstallHelmChart(kubectlOptions, helmReleaseName, purge, extraArgs...) +} diff --git a/tests/e2e/helm_test.go b/tests/e2e/helm_test.go deleted file mode 100644 index bb8e3c67d6..0000000000 --- a/tests/e2e/helm_test.go +++ /dev/null @@ -1,229 +0,0 @@ -// Copyright © 2023 Cisco Systems, Inc. and/or its affiliates -// -// 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 e2e - -import ( - "encoding/json" - "fmt" - - "github.com/gruntwork-io/terratest/modules/helm" - "github.com/gruntwork-io/terratest/modules/k8s" - . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" -) - -// HelmReleaseStatus describes the possible states of a Helm release. -type HelmReleaseStatus string - -const ( - // HelmReleaseDeployed is the Helm release state where the deployment is - // successfully applied to the cluster. - HelmReleaseDeployed HelmReleaseStatus = "deployed" - - // HelmReleaseFailed is the Helm release state where the deployment - // encountered an error and couldn't be applied successfully to the cluster. - HelmReleaseFailed HelmReleaseStatus = "failed" -) - -// HelmRelease describes a Helm -type HelmRelease struct { - ReleaseName string `json:"name" yaml:"name"` - Namespace string `json:"namespace" yaml:"namespace"` - Revision string `json:"revision" yaml:"revision"` - UpdatedTime string `json:"updated" yaml:"updated"` // Note: not parsable implicitly. - Status HelmReleaseStatus `json:"status" yaml:"status"` - Chart string `json:"chart" yaml:"chart"` - AppVersion string `json:"app_version" yaml:"app_version"` -} - -// installHelmChart deploys a Helm chart to the specified kubectl context and -// namespace using the specified infos, extra arguments can be any of the helm -// CLI install flag arguments, flag keys and values must be provided separately. -func installHelmChart( - kubectlOptions *k8s.KubectlOptions, - helmRepository string, - helmChartNameOrLocalPath string, - helmChartVersion string, - helmReleaseName string, - setValues map[string]string, -) { - By( - fmt.Sprintf( - "Installing Helm chart %s from %s with version %s by name %s", - helmChartNameOrLocalPath, helmRepository, helmChartVersion, helmReleaseName, - ), - ) - - fixedArguments := []string{ - "--create-namespace", - "--atomic", - "--debug", - } - - if helmRepository != "" { - fixedArguments = append([]string{"--repo", helmRepository}, fixedArguments...) - } - - helm.Install( - GinkgoT(), - &helm.Options{ - SetValues: setValues, - KubectlOptions: kubectlOptions, - Version: helmChartVersion, - ExtraArgs: map[string][]string{ - "install": fixedArguments, - }, - }, - helmChartNameOrLocalPath, - helmReleaseName, - ) -} - -// installHelmChart checks whether the specified named Helm release exists in -// the provided kubectl context and namespace, logs it if it does and returns or -// alternatively deploys the Helm chart to the specified kubectl context and -// namespace using the specified infos, extra arguments can be any of the helm -// CLI install flag arguments, flag keys and values must be provided separately. -func installHelmChartIfDoesNotExist( - kubectlOptions *k8s.KubectlOptions, - helmRepository string, - helmChartNameOrLocalPath string, - helmChartVersion string, - helmReleaseName string, - setValues map[string]string, -) { - By(fmt.Sprintf("Checking for existing Helm release named %s", helmReleaseName)) - helmRelease, isInstalled := lookUpInstalledHelmReleaseByName(kubectlOptions, helmReleaseName) - - if isInstalled { - By(fmt.Sprintf( - "Skipping the installation of %s, because the Helm release is already present: %+v", - helmReleaseName, helmRelease, - )) - - return - } - - installHelmChart( - kubectlOptions, - helmRepository, - helmChartNameOrLocalPath, - helmChartVersion, - helmReleaseName, - setValues, - ) -} - -// listHelmReleases returns a slice of Helm releases retrieved from the cluster -// using the specified kubectl context and namespace. -func listHelmReleases(kubectlOptions *k8s.KubectlOptions) []*HelmRelease { - By("Listing Helm releases") - output, err := helm.RunHelmCommandAndGetOutputE( - GinkgoT(), - &helm.Options{ - KubectlOptions: kubectlOptions, - }, - "list", - "--output", "json", - ) - - Expect(err).NotTo(HaveOccurred()) - - var releases []*HelmRelease - err = json.Unmarshal([]byte(output), &releases) - - Expect(err).NotTo(HaveOccurred()) - - return releases -} - -// lookUpInstalledHelmReleaseByName returns a Helm release and an indicator -// whether the Helm release is installed to the specified kubectl context -// and namespace by the provided Helm release name. -func lookUpInstalledHelmReleaseByName(kubectlOptions *k8s.KubectlOptions, helmReleaseName string) (*HelmRelease, bool) { - releases := listHelmReleases(kubectlOptions) - - for _, release := range releases { - if release.ReleaseName == helmReleaseName { - Expect(release.Status).To(BeEquivalentTo(HelmReleaseDeployed)) - - return release, true - } - } - - return nil, false -} - -// uninstallHelmChart uninstall Helm chart from the specified kubectl context and -// namespace using the specified helm release name. When purge is true, it removes records -// and make that name free to be reused for another installation. -// Extra arguments can be any of the helm CLI uninstall flag arguments. -func uninstallHelmChart( - kubectlOptions *k8s.KubectlOptions, - helmReleaseName string, - purge bool, - extraArgs ...string, -) { - By( - fmt.Sprintf( - "uninstalling Helm chart by name %s", - helmReleaseName, - ), - ) - - fixedArguments := []string{ - "--debug", - } - - extraArgs = append(extraArgs, fixedArguments...) - - helm.Delete( - GinkgoT(), - &helm.Options{ - KubectlOptions: kubectlOptions, - ExtraArgs: map[string][]string{ - "delete": extraArgs, - }, - }, - helmReleaseName, - purge, - ) -} - -// uninstallHelmChartIfExists checks whether the specified named Helm release exists in -// the provided kubectl context and namespace, logs it if it does and returns or -// alternatively uninstall the Helm chart from the specified kubectl context and -// namespace using the release name, extra arguments can be any of the helm -// CLI install flag arguments. -func uninstallHelmChartIfExists( - kubectlOptions *k8s.KubectlOptions, - helmReleaseName string, - purge bool, - extraArgs ...string, -) { - By(fmt.Sprintf("Checking for existing Helm release names %s", helmReleaseName)) - _, isInstalled := lookUpInstalledHelmReleaseByName(kubectlOptions, helmReleaseName) - - if !isInstalled { - By(fmt.Sprintf( - "skipping the uninstallation of %s, because the Helm release is not present.", - helmReleaseName, - )) - - return - } - - uninstallHelmChart(kubectlOptions, helmReleaseName, purge, extraArgs...) -} diff --git a/tests/e2e/install_test.go b/tests/e2e/install_test.go deleted file mode 100644 index cdf6b89035..0000000000 --- a/tests/e2e/install_test.go +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright © 2023 Cisco Systems, Inc. and/or its affiliates -// -// 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 e2e - -import ( - "github.com/gruntwork-io/terratest/modules/k8s" - . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" -) - -var _ = When("Installing Koperator", Ordered, func() { - var kubeconfigPath string - var kubecontextName string - - It("Acquiring K8s config and context", func() { - var err error - kubeconfigPath, kubecontextName, err = currentEnvK8sContext() - - Expect(err).NotTo(HaveOccurred()) - }) - - // requireInstallingCertManager(k8s.NewKubectlOptions(kubecontextName, kubeconfigPath, "cert-manager"), "v1.11.0") - // requireInstallingZookeeperOperator(k8s.NewKubectlOptions(kubecontextName, kubeconfigPath, "zookeeper"), "0.2.14") - // requireInstallingPrometheusOperator(k8s.NewKubectlOptions(kubecontextName, kubeconfigPath, "prometheus"), "42.0.1") - // requireInstallingKoperator(k8s.NewKubectlOptions(kubecontextName, kubeconfigPath, "kafka"), LocalVersion) - // ----------------------------------------------------------------------------------------------------------- - // requireCreatingZookeeperCluster(k8s.NewKubectlOptions(kubecontextName, kubeconfigPath, "zookeeper"), "../../config/samples/zookeeper_sample.yaml") - // requireCreatingKafkaCluster(k8s.NewKubectlOptions(kubecontextName, kubeconfigPath, "kafka"), "local", "simplekafkacluster_ssl.yaml") - // // ----------------------------------------------------------------------------------------------------------- - requireInternalProducerConsumer(k8s.NewKubectlOptions(kubecontextName, kubeconfigPath, "kafka")) - // // ----------------------------------------------------------------------------------------------------------- - // requireUninstallKafkaCluster(k8s.NewKubectlOptions(kubecontextName, kubeconfigPath, "kafka"), "kafka") - // requireUninstallZookeeperCluster(k8s.NewKubectlOptions(kubecontextName, kubeconfigPath, "zookeeper"), "zookeeper-server") - // // ----------------------------------------------------------------------------------------------------------- - // requireUninstallingKoperator(k8s.NewKubectlOptions(kubecontextName, kubeconfigPath, "kafka")) - // requireUninstallingPrometheusOperator(k8s.NewKubectlOptions(kubecontextName, kubeconfigPath, "prometheus")) - // requireUninstallingZookeeperOperator(k8s.NewKubectlOptions(kubecontextName, kubeconfigPath, "zookeeper")) - // requireUninstallingCertManager(k8s.NewKubectlOptions(kubecontextName, kubeconfigPath, "cert-manager")) - //requireExternalProducerConsumer(k8s.NewKubectlOptions(kubecontextName, kubeconfigPath, "kafka")) -}) diff --git a/tests/e2e/k8s.go b/tests/e2e/k8s.go index 2b2f807a93..4dd00febcf 100644 --- a/tests/e2e/k8s.go +++ b/tests/e2e/k8s.go @@ -22,9 +22,11 @@ import ( "os" "path" "strings" + "text/template" "time" "emperror.dev/errors" + "github.com/Masterminds/sprig" "github.com/cisco-open/k8s-objectmatcher/patch" "github.com/gruntwork-io/terratest/modules/k8s" . "github.com/onsi/ginkgo/v2" @@ -392,3 +394,156 @@ func listK8sCRDs(kubectlOptions k8s.KubectlOptions, crdNames ...string) ([]strin return strings.Split(output, "\n"), nil } + +// deleteK8sResourceOpts deletes K8s resources based on the kind and name or kind and selector. +// When noErrNotFound is true then the deletion is passed in case when the resource is not found. +// timeout parameter specifies the timeout for the deletion. +// extraArgs can be any of the kubectl arguments. +func deleteK8sResource( + kubectlOptions k8s.KubectlOptions, + timeout time.Duration, + kind string, + selector string, + name string, + extraArgs ...string) error { + + args := []string{"delete", kind} + + args = append(args, fmt.Sprintf("--timeout=%s", timeout)) + + logMsg := fmt.Sprintf("Deleting k8s resource: kind: '%s' ", kind) + logMsg, args = _kubectlArgExtender(args, logMsg, selector, name, kubectlOptions.Namespace, extraArgs) + By(logMsg) + + _, err := k8s.RunKubectlAndGetOutputE( + GinkgoT(), + &kubectlOptions, + args..., + ) + + return err +} + +// deleteK8sResourceNoErrNotFound deletes K8s resources based on the kind and name or kind and selector. +// Deletion is passed in case the resource is not found. +// timeout parameter specifies the timeout for the deletion. +// extraArgs can be any of the kubectl arguments. +func deleteK8sResourceNoErrNotFound(kubectlOptions k8s.KubectlOptions, timeout time.Duration, kind string, name string, extraArgs ...string) error { + err := deleteK8sResource(kubectlOptions, timeout, kind, "", name, extraArgs...) + if _isNotFoundError(err) { + By("Resource not found") + return nil + } + return err +} + +// applyK8sResourceManifestFromString applies the specified manifest in string format to the provided +// kubectl context and namespace. +func applyK8sResourceManifestFromString(kubectlOptions k8s.KubectlOptions, manifest string) error { + By(fmt.Sprintf("Applying k8s manifest\n%s", manifest)) + return k8s.KubectlApplyFromStringE(GinkgoT(), &kubectlOptions, manifest) +} + +// applyK8sResourceFromTemplate generates manifest from the specified go-template based on values +// and applies the specified manifest to the provided kubectl context and namespace. +func applyK8sResourceFromTemplate(kubectlOptions k8s.KubectlOptions, templateFile string, values map[string]interface{}) error { + By(fmt.Sprintf("Generating K8s manifest from template %s", templateFile)) + var manifest bytes.Buffer + rawTemplate, err := os.ReadFile(templateFile) + if err != nil { + return err + } + t := template.Must(template.New("template").Funcs(sprig.TxtFuncMap()).Parse(string(rawTemplate))) + err = t.Execute(&manifest, values) + if err != nil { + return err + } + return applyK8sResourceManifestFromString(kubectlOptions, manifest.String()) +} + +// checkExistenceOfK8sResource queries a Resource by it's kind, namespace and name and +// returns the output of stderr +func checkExistenceOfK8sResource( + kubectlOptions *k8s.KubectlOptions, + resourceKind string, + resourceName string, +) error { + By(fmt.Sprintf("Checking the existence of resource %s", resourceName)) + return k8s.RunKubectlE(GinkgoT(), kubectlOptions, "get", resourceKind, resourceName) +} + +// listK8sAllResourceKind lists all of the available resource type on the K8s cluster +func listK8sAllResourceKind(kubectlOptions k8s.KubectlOptions) ([]string, error) { + By("Listing available K8s resource kind") + + args := []string{"api-resources", "--verbs=list", "-o", "name"} + output, err := k8s.RunKubectlAndGetOutputE( + GinkgoT(), + &kubectlOptions, + args..., + ) + + if err != nil { + return nil, err + } + + return _kubectlRemoveWarnings(strings.Split(output, "\n")), nil +} + +// getK8sResources gets the specified K8S resources from the specified kubectl context and +// namespace optionally. Extra arguments can be any of the kubectl get flag arguments. +// Returns a slice of the returned elements. Separator between elements must be newline. +func getK8sResources(kubectlOptions k8s.KubectlOptions, resourceKind []string, selector string, names string, extraArgs ...string) ([]string, error) { + logMsg := fmt.Sprintf("Get K8S resources: '%s'", resourceKind) + + args := []string{"get", strings.Join(resourceKind, ",")} + logMsg, args = _kubectlArgExtender(args, logMsg, selector, names, kubectlOptions.Namespace, extraArgs) + By(logMsg) + + output, err := k8s.RunKubectlAndGetOutputE( + GinkgoT(), + &kubectlOptions, + args..., + ) + + if err != nil { + return nil, err + } + + output = strings.Trim(output, "'") + // Empty output + if output == "" { + return nil, nil + } + + output = strings.TrimRight(output, "\n") + outputSlice := strings.Split(output, "\n") + + // Remove warning message pollution from the output + + return _kubectlRemoveWarnings(outputSlice), nil +} + +// waitK8sResourceCondition waits until the condition is met or the timeout is elapsed for the selected K8s resource(s) +// extraArgs can be any of the kubectl arguments +func waitK8sResourceCondition(kubectlOptions k8s.KubectlOptions, resourceKind, waitFor string, timeout time.Duration, selector string, names string, extraArgs ...string) error { + logMsg := fmt.Sprintf("Waiting K8s resource(s)' condition: '%s' to fulfil", waitFor) + + args := []string{ + "wait", + resourceKind, + fmt.Sprintf("--for=%s", waitFor), + fmt.Sprintf("--timeout=%s", timeout), + } + + logMsg, args = _kubectlArgExtender(args, logMsg, selector, names, kubectlOptions.Namespace, extraArgs) + By(logMsg) + + _, err := k8s.RunKubectlAndGetOutputE( + GinkgoT(), + &kubectlOptions, + args..., + ) + + return err +} diff --git a/tests/e2e/k8s_test.go b/tests/e2e/k8s_test.go deleted file mode 100644 index d707228d59..0000000000 --- a/tests/e2e/k8s_test.go +++ /dev/null @@ -1,358 +0,0 @@ -// Copyright © 2023 Cisco Systems, Inc. and/or its affiliates -// -// 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 e2e - -import ( - "bytes" - "fmt" - "os" - "path" - "strings" - "text/template" - "time" - - "emperror.dev/errors" - "github.com/Masterminds/sprig/v3" - "github.com/gruntwork-io/terratest/modules/k8s" - . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "sigs.k8s.io/yaml" -) - -// deleteK8sResourceOpts deletes K8s resources based on the kind and name or kind and selector. -// When noErrNotFound is true then the deletion is passed in case when the resource is not found. -// timeout parameter specifies the timeout for the deletion. -// globalResource parameter indicates that the resource is global, -// extraArgs can be any of the kubectl arguments. -func deleteK8sResourceOpts( - kubectlOptions *k8s.KubectlOptions, - globalResource, - noErrNotFound bool, - timeout time.Duration, - kind string, - selector string, - name string, - extraArgs ...string) { - - args := []string{"delete", kind} - - args = append(args, fmt.Sprintf("--timeout=%s", timeout)) - kubectlNamespace := kubectlOptions.Namespace - - if globalResource { - kubectlOptions.Namespace = "" - } - - logMsg := fmt.Sprintf("Deleting k8s resource: kind: '%s' ", kind) - logMsg, args = _kubectlArgExtender(args, logMsg, selector, name, kubectlOptions.Namespace, extraArgs) - By(logMsg) - - args = append(args, extraArgs...) - - _, err := k8s.RunKubectlAndGetOutputE( - GinkgoT(), - kubectlOptions, - args..., - ) - - kubectlOptions.Namespace = kubectlNamespace - - if _isNotFoundError(err) && noErrNotFound { - By("Resource not found") - } else { - Expect(err).NotTo(HaveOccurred()) - } -} - -// deleteK8sResourceGlobalNoErrNotFound deletes K8s global resources based on the kind and name or kind and selector. -// Deletion is passed in case the resource is not found. -// timeout parameter specifies the timeout for the deletion. -// extraArgs can be any of the kubectl arguments. -func deleteK8sResourceGlobalNoErrNotFound(kubectlOptions *k8s.KubectlOptions, timeout time.Duration, kind string, name string, extraArgs ...string) { - deleteK8sResourceOpts(kubectlOptions, true, true, timeout, kind, "", name, extraArgs...) -} - -// deleteK8sResourceGlobal deletes K8s resources based on the kind and name or kind and selector. -// timeout parameter specifies the timeout for the deletion. -// extraArgs can be any of the kubectl arguments. -func deleteK8sResourceGlobal(kubectlOptions *k8s.KubectlOptions, timeout time.Duration, kind string, name string, extraArgs ...string) { - deleteK8sResourceOpts(kubectlOptions, true, false, timeout, kind, "", name, extraArgs...) -} - -// deleteK8sResource deletes K8s resources based on the kind and name or kind and selector. -// timeout parameter specifies the timeout for the deletion. -// extraArgs can be any of the kubectl arguments. -func deleteK8sResource(kubectlOptions *k8s.KubectlOptions, timeout time.Duration, kind string, name string, extraArgs ...string) { - deleteK8sResourceOpts(kubectlOptions, false, false, timeout, kind, "", name, extraArgs...) -} - -// deleteK8sResourceNoErrNotFound deletes K8s resources based on the kind and name or kind and selector. -// Deletion is passed in case the resource is not found. -// timeout parameter specifies the timeout for the deletion. -// extraArgs can be any of the kubectl arguments. -func deleteK8sResourceNoErrNotFound(kubectlOptions *k8s.KubectlOptions, timeout time.Duration, kind string, name string, extraArgs ...string) { - deleteK8sResourceOpts(kubectlOptions, false, true, timeout, kind, "", name, extraArgs...) -} - -// applyK8sResourceManifests applies the specified manifest to the provided -// kubectl context and namespace. -func applyK8sResourceManifest(kubectlOptions *k8s.KubectlOptions, manifestPath string) { - By(fmt.Sprintf("Applying k8s manifest %s", manifestPath)) - k8s.KubectlApply(GinkgoT(), kubectlOptions, manifestPath) -} - -// applyK8sResourceManifestFromString applies the specified manifest in string format to the provided -// kubectl context and namespace. -func applyK8sResourceManifestFromString(kubectlOptions *k8s.KubectlOptions, manifest string) { - By(fmt.Sprintf("Applying k8s manifest\n%s", manifest)) - k8s.KubectlApplyFromString(GinkgoT(), kubectlOptions, manifest) -} - -// applyK8sResourceFromTemplate generates manifest from the specified go-template based on values -// and applies the specified manifest to the provided kubectl context and namespace. -func applyK8sResourceFromTemplate(kubectlOptions *k8s.KubectlOptions, templateFile string, values map[string]interface{}) { - By(fmt.Sprintf("Generating K8s manifest from template %s", templateFile)) - var manifest bytes.Buffer - rawTemplate, err := os.ReadFile(templateFile) - Expect(err).NotTo(HaveOccurred()) - t := template.Must(template.New("template").Funcs(sprig.TxtFuncMap()).Parse(string(rawTemplate))) - err = t.Execute(&manifest, values) - Expect(err).NotTo(HaveOccurred()) - applyK8sResourceManifestFromString(kubectlOptions, manifest.String()) -} - -// checkExistenceOfK8sResource queries a Resource by it's kind, namespace and name and -// returns the output of stderr -func checkExistenceOfK8sResource( - kubectlOptions *k8s.KubectlOptions, - resourceKind string, - resourceName string, -) error { - By(fmt.Sprintf("Checking the existence of resource %s", resourceName)) - return k8s.RunKubectlE(GinkgoT(), kubectlOptions, "get", resourceKind, resourceName) -} - -// createK8sResourcesFromManifest creates Kubernetes resources from the -// specified manifest to the provided kubectl context and namespace. -func createK8sResourcesFromManifest(kubectlOptions *k8s.KubectlOptions, manifestPath string, shouldBeValidated bool) { - By(fmt.Sprintf("Creating k8s resources from manifest %s", manifestPath)) - k8s.RunKubectl( - GinkgoT(), - kubectlOptions, - "create", - fmt.Sprintf("--validate=%t", shouldBeValidated), - "--filename", manifestPath, - ) -} - -// createOrReplaceK8sResourcesFromManifest creates non-existent Kubernetes -// resources or replaces existing ones from the specified manifest to the -// provided kubectl context and namespace. -func createOrReplaceK8sResourcesFromManifest( - kubectlOptions *k8s.KubectlOptions, - resourceKind string, - resourceName string, - resourceManifest string, - shouldBeValidated bool, -) { - By(fmt.Sprintf("Checking the existence of resource %s", resourceName)) - err := k8s.RunKubectlE(GinkgoT(), kubectlOptions, "get", resourceKind, resourceName) - - if err == nil { - replaceK8sResourcesFromManifest(kubectlOptions, resourceManifest, shouldBeValidated) - } else { - createK8sResourcesFromManifest(kubectlOptions, resourceManifest, shouldBeValidated) - } -} - -// currentKubernetesContext returns the currently set Kubernetes context based -// on the the environment variables and the KUBECONFIG file. -func currentEnvK8sContext() (kubeconfigPath string, kubecontextName string, err error) { - kubeconfigPath, isExisting := os.LookupEnv("KUBECONFIG") - if !isExisting { - homePath, err := os.UserHomeDir() - if err != nil { - return "", "", errors.WrapIf(err, "retrieving user home directory failed") - } - - kubeconfigPath = path.Join(homePath, ".kube", "config") - } - - kubeconfigBytes, err := os.ReadFile(kubeconfigPath) - if err != nil { - return "", "", errors.WrapIfWithDetails(err, "reading KUBECONFIG file failed", "path", kubeconfigPath) - } - - structuredKubeconfig := make(map[string]interface{}) - err = yaml.Unmarshal(kubeconfigBytes, &structuredKubeconfig) - if err != nil { - return "", "", errors.WrapIfWithDetails( - err, - "parsing kubeconfig failed", - "kubeconfig", string(kubeconfigBytes), - ) - } - - kubecontext, isOk := structuredKubeconfig["current-context"].(string) - if !isOk { - return "", "", errors.WrapIfWithDetails( - err, - "kubeconfig current-context is not string", - "current-context", structuredKubeconfig["current-context"], - ) - } - - return kubeconfigPath, kubecontext, nil -} - -// listK8sCRDs lists the available CRDs from the specified kubectl context and -// namespace optionally filtering for the specified CRD names. -func listK8sCRDs(kubectlOptions *k8s.KubectlOptions, crdNames ...string) []string { - if len(crdNames) == 0 { - By("Listing CRDs") - } else { - By(fmt.Sprintf("Listing CRDs filtered for CRD names %+v", crdNames)) - } - - args := append([]string{"get", "crd", "-o", "name"}, crdNames...) - output, err := k8s.RunKubectlAndGetOutputE( - GinkgoT(), - kubectlOptions, - args..., - ) - - Expect(err).NotTo(HaveOccurred()) - - return strings.Split(output, "\n") -} - -// listK8sAllResourceType lists all of the available resource type on the K8s cluster -func listK8sAllResourceType(kubectlOptions *k8s.KubectlOptions) []string { - By("Listing available K8s resource types") - - args := []string{"api-resources", "--verbs=list", "-o", "name"} - output, err := k8s.RunKubectlAndGetOutputE( - GinkgoT(), - kubectlOptions, - args..., - ) - - Expect(err).NotTo(HaveOccurred()) - - return strings.Split(output, "\n") -} - -// replaceK8sResourcesFromManifest replaces existing Kubernetes resources from -// the specified manifest to the provided kubectl context and namespace. -func replaceK8sResourcesFromManifest(kubectlOptions *k8s.KubectlOptions, manifestPath string, shouldBeValidated bool) { - By(fmt.Sprintf("Replacing k8s resources from manifest %s", manifestPath)) - k8s.RunKubectl( - GinkgoT(), - kubectlOptions, - "replace", - fmt.Sprintf("--validate=%t", shouldBeValidated), - "--filename", manifestPath, - ) -} - -// requireExistingCRDs checks whether the specified CRDs are existing on -// the provided kubectl context. -func requireExistingCRDs(kubectlOptions *k8s.KubectlOptions, crdNames ...string) { - crds := listK8sCRDs(kubectlOptions, crdNames...) - - crdFullNames := make([]string, 0, len(crds)) - for _, crdName := range crdNames { - crdFullNames = append(crdFullNames, "customresourcedefinition.apiextensions.k8s.io/"+crdName) - } - - Expect(crds).To(ContainElements(crdFullNames)) -} - -// requireRunningPods checks whether the specified pod names are existing in the -// namespace and have a running status. -func requireRunningPods(kubectlOptions *k8s.KubectlOptions, matchingLabelKey string, podNames ...string) { - By(fmt.Sprintf("Verifying running pods for pod names %+v", podNames)) - pods := k8s.ListPods(GinkgoT(), kubectlOptions, v1.ListOptions{}) - - podNamesAsInterfaces := make([]interface{}, 0, len(podNames)) - for _, podName := range podNames { - podNamesAsInterfaces = append(podNamesAsInterfaces, podName) - } - - Expect(pods).To(HaveLen(len(podNames))) - for _, pod := range pods { - Expect(pod.GetLabels()[matchingLabelKey]).To(BeElementOf(podNamesAsInterfaces...)) - Expect(pod.Status.Phase).To(BeEquivalentTo("Running")) - } -} - -// getK8sResources gets the specified K8S resources from the specified kubectl context and -// namespace optionally. Extra arguments can be any of the kubectl get flag arguments. -// Returns a slice of the returned elements. Separator between elements must be newline. -func getK8sResources(kubectlOptions *k8s.KubectlOptions, resourceKind []string, selector string, names string, extraArgs ...string) []string { - logMsg := fmt.Sprintf("Get K8S resources: '%s'", resourceKind) - - args := []string{"get", strings.Join(resourceKind, ",")} - logMsg, args = _kubectlArgExtender(args, logMsg, selector, names, kubectlOptions.Namespace, extraArgs) - - By(logMsg) - - args = append(args, extraArgs...) - - output, err := k8s.RunKubectlAndGetOutputE( - GinkgoT(), - kubectlOptions, - args..., - ) - - Expect(err).NotTo(HaveOccurred()) - - output = strings.Trim(output, "'") - if output == "" { - return nil - } - - output = strings.TrimRight(output, "\n") - outputSlice := strings.Split(output, "\n") - - // Remove warning message pollution from the output - - return _kubectlRemoveWarnings(outputSlice) -} - -// waitK8sResourceCondition waits until the condition is met or the timeout is elapsed for the selected K8s resource(s) -// extraArgs can be any of the kubectl arguments -func waitK8sResourceCondition(kubectlOptions *k8s.KubectlOptions, resourceKind, waitFor string, timeout time.Duration, selector string, names string, extraArgs ...string) { - logMsg := fmt.Sprintf("Waiting K8s resource(s)' condition: '%s' to fulfil", waitFor) - - args := []string{ - "wait", - resourceKind, - fmt.Sprintf("--for=%s", waitFor), - fmt.Sprintf("--timeout=%s", timeout), - } - - logMsg, args = _kubectlArgExtender(args, logMsg, selector, names, kubectlOptions.Namespace, extraArgs) - By(logMsg) - - _, err := k8s.RunKubectlAndGetOutputE( - GinkgoT(), - kubectlOptions, - args..., - ) - - Expect(err).NotTo(HaveOccurred()) -} diff --git a/tests/e2e/koperator_test.go b/tests/e2e/koperator_test.go deleted file mode 100644 index 0723d17d84..0000000000 --- a/tests/e2e/koperator_test.go +++ /dev/null @@ -1,256 +0,0 @@ -// Copyright © 2023 Cisco Systems, Inc. and/or its affiliates -// -// 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 e2e - -import ( - "bytes" - "context" - "fmt" - "io" - "net/http" - "os" - "path" - "strings" - "time" - - koperator_v1beta1 "github.com/banzaicloud/koperator/api/v1beta1" - apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" - - "github.com/gruntwork-io/terratest/modules/helm" - "github.com/gruntwork-io/terratest/modules/k8s" - . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" - "sigs.k8s.io/yaml" -) - -// requireApplyingKoperatorSampleResource deploys the specified sample resource (config/samples). -// The full path of the manifest also can be specified. -// It supports different versions that can be specified with the koperatorVersion parameter. -func requireApplyingKoperatorSampleResource(kubectlOptions *k8s.KubectlOptions, koperatorVersion Version, sampleFile string) { - It("Applying Koperator sample resource", func() { - By(fmt.Sprintf("Retrieving Koperator sample resource: '%s' with version: '%s' ", sampleFile, koperatorVersion)) - - sampleFileSplit := strings.Split(sampleFile, "/") - Expect(sampleFileSplit).ShouldNot(BeEmpty()) - - var err error - var rawKoperatorSampleResource []byte - - switch koperatorVersion { - case LocalVersion: - if len(sampleFileSplit) == 1 { - sampleFile = fmt.Sprintf("../../config/samples/%s", sampleFile) - } - - rawKoperatorSampleResource, err = os.ReadFile(sampleFile) - Expect(err).NotTo(HaveOccurred()) - default: - httpClient := new(http.Client) - httpClient.Timeout = 5 * time.Second - - Expect(sampleFileSplit).Should(HaveLen(1)) - - response, err := httpClient.Get("https://raw.githubusercontent.com/banzaicloud/koperator/" + koperatorVersion + "/config/samples/" + sampleFile) - if response != nil { - defer func() { _ = response.Body.Close() }() - } - - Expect(err).NotTo(HaveOccurred()) - - rawKoperatorSampleResource, err = io.ReadAll(response.Body) - - Expect(err).NotTo(HaveOccurred()) - } - - By(fmt.Sprintf("Applying K8s manifest %s", sampleFile)) - k8s.KubectlApplyFromString(GinkgoT(), kubectlOptions, string(rawKoperatorSampleResource)) - - }) -} - -// requireRemoveKoperatorCRDs deletes the koperator CRDs -func requireRemoveKoperatorCRDs(kubectlOptions *k8s.KubectlOptions) { - It("Removing koperator CRDs", func() { - for _, crd := range koperatorCRDs() { - deleteK8sResourceGlobalNoErrNotFound(kubectlOptions, defaultDeletionTimeout, "crds", crd) - } - }) -} - -// requireApplyingKoperatorCRDs deploys the koperator CRDs and checks their -// existence afterwards. -func requireApplyingKoperatorCRDs(kubectlOptions *k8s.KubectlOptions, koperatorVersion Version) { - It("Applying koperator CRDs", func() { - By(fmt.Sprintf("Retrieving Koperator CRDs (to work around too long CRD) with version %s ", koperatorVersion)) - // Note: had to go lower because none of apply, create, replace works - // properly with the KafkaCluster CRD due to the size (apply cannot - // handle the size, create is not idempotent, replace is only idempotent - // if the resources are existing already). Tried dropping the - // descriptions in the CRDs, but still too large - var rawKoperatorCRDsManifest []byte - var err error - - switch koperatorVersion { - case LocalVersion: - rawKoperatorCRDsManifest = []byte(helm.RenderTemplate( - GinkgoT(), - &helm.Options{ - SetValues: map[string]string{ - "crd.enabled": "true", - }, - }, - "../../charts/kafka-operator", - "dummy", - []string{"templates/crds.yaml"}, - )) - default: - httpClient := new(http.Client) - httpClient.Timeout = 5 * time.Second - - response, err := httpClient.Get("https://github.com/banzaicloud/koperator/releases/download/" + koperatorVersion + "/kafka-operator.crds.yaml") - if response != nil { - defer func() { _ = response.Body.Close() }() - } - - Expect(err).NotTo(HaveOccurred()) - - rawKoperatorCRDsManifest, err = io.ReadAll(response.Body) - - Expect(err).NotTo(HaveOccurred()) - } - - rawKoperatorCRDs := bytes.Split(rawKoperatorCRDsManifest, []byte("\n---\n")) - for rawKoperatorCRDIndex, rawKoperatorCRD := range rawKoperatorCRDs { - rawKoperatorCRDs[rawKoperatorCRDIndex] = bytes.Trim(rawKoperatorCRD, "\n-") - } - - allowedCRDByteCount := 262144 - tempDir := os.TempDir() - tempFile := path.Join(tempDir, "manifest.yaml") - for _, rawKoperatorCRD := range rawKoperatorCRDs { - err = os.WriteFile(tempFile, rawKoperatorCRD, 0o777) - - Expect(err).NotTo(HaveOccurred()) - - if len(rawKoperatorCRD) > allowedCRDByteCount { // Note: too long CRDs cannot be applied, only created or replaced. - var koperatorCRD apiextensionsv1.CustomResourceDefinition - err := yaml.Unmarshal(rawKoperatorCRD, &koperatorCRD) - - Expect(err).NotTo(HaveOccurred()) - - createOrReplaceK8sResourcesFromManifest(kubectlOptions, "crd", koperatorCRD.GetName(), tempFile, false) - } else { - By("Applying koperator CRDs with version " + koperatorVersion) - applyK8sResourceManifest(kubectlOptions, tempFile) - } - } - - By("Verifying koperator CRDs") - requireExistingCRDs( - kubectlOptions, - koperatorCRDs()..., - ) - }) -} - -// requireInstallingKoperator deploys koperator CRDs and Helm chart and checks -// the success of those operations. -func requireInstallingKoperator(kubectlOptions *k8s.KubectlOptions, koperatorVersion Version) { - When("Installing koperator", func() { - requireApplyingKoperatorCRDs(kubectlOptions, koperatorVersion) - requireInstallingKoperatorHelmChartIfDoesNotExist(kubectlOptions, koperatorVersion) - }) -} - -// requireDeployingKoperatorHelmChart checks the existence of the koperator Helm -// release and installs it if it's not present. -func requireInstallingKoperatorHelmChartIfDoesNotExist( - kubectlOptions *k8s.KubectlOptions, - koperatorVersion Version, -) { - It("Installing koperator Helm chart", func() { - switch koperatorVersion { - case LocalVersion: - installHelmChartIfDoesNotExist(kubectlOptions, "", "../../charts/kafka-operator", "", "kafka-operator", nil) - default: - installHelmChartIfDoesNotExist( - kubectlOptions, - "https://kubernetes-charts.banzaicloud.com", - "kafka-operator", - koperatorVersion, - "kafka-operator", - nil, - ) - } - - By("Verifying koperator pods") - //requireRunningPods(kubectlOptions, "app.kubernetes.io/name", "kafka-operator") - }) -} - -// requireUninstallingKoperator uninstall koperator Helm chart and removes Koperator's CRDs. -func requireUninstallingKoperator(kubectlOptions *k8s.KubectlOptions) { - When("Uninstalling Koperator", func() { - requireUninstallingKoperatorHelmChart(kubectlOptions) - requireRemoveKoperatorCRDs(kubectlOptions) - }) -} - -// requireUninstallingKoperatorHelmChart uninstall Koperator Helm chart -// and checks the success of that operation. -func requireUninstallingKoperatorHelmChart(kubectlOptions *k8s.KubectlOptions) { - It("Uninstalling Koperator Helm chart", func() { - uninstallHelmChartIfExists(kubectlOptions, "kafka-operator", true) - By("Verifying Koperator helm chart resources cleanup") - k8sCRDs := listK8sAllResourceType(kubectlOptions) - remainedResources := getK8sResources(kubectlOptions, - k8sCRDs, - fmt.Sprintf(managedByHelmLabelTemplate, "kafka-operator"), - "", - kubectlArgGoTemplateKindNameNamespace, - "--all-namespaces") - Expect(remainedResources).Should(BeEmpty()) - }) -} - -// requireUninstallKafkaCluster uninstall the Kafka cluster -func requireUninstallKafkaCluster(kubectlOptions *k8s.KubectlOptions, name string) { - When("Uninstalling Kafka cluster", func() { - requireDeleteKafkaCluster(kubectlOptions, name) - - }) -} - -// requireDeleteKafkaCluster deletes KafkaCluster resource and -// checks the removal of the Kafka cluster related resources -func requireDeleteKafkaCluster(kubectlOptions *k8s.KubectlOptions, name string) { - It("Delete KafkaCluster custom resource", func() { - deleteK8sResourceGlobalNoErrNotFound(kubectlOptions, defaultDeletionTimeout, "kafkacluster", "kafka") - Eventually(context.Background(), func() []string { - By("Verifying the Kafka cluster resource cleanup") - - // Check only those Koperator related resource types we have in K8s (istio usecase) - k8sCRDs := listK8sAllResourceType(kubectlOptions) - koperatorCRDsSelected := _stringSlicesUnion(getKoperatorRelatedResourceKinds(), k8sCRDs) - koperatorCRDsSelected = append(koperatorCRDsSelected, basicK8sCRDs()...) - - return getK8sResources(kubectlOptions, - koperatorCRDsSelected, - fmt.Sprintf("%s=%s", koperator_v1beta1.KafkaCRLabelKey, name), - "", - "--all-namespaces", kubectlArgGoTemplateKindNameNamespace) - }, kafkaClusterResourceCleanupTimeout, 3*time.Millisecond).Should(BeEmpty()) - }) -} diff --git a/tests/e2e/kafka_prod_consum_test.go b/tests/e2e/produce_consume.go similarity index 69% rename from tests/e2e/kafka_prod_consum_test.go rename to tests/e2e/produce_consume.go index 16b10b676d..c04767335e 100644 --- a/tests/e2e/kafka_prod_consum_test.go +++ b/tests/e2e/produce_consume.go @@ -23,21 +23,8 @@ import ( . "github.com/onsi/gomega" ) -// requireInternalProducerConsumer deploys a kcat pod and a kafkaTopic into the K8s cluster -// and produces, consumes messages and makes comparisons between them. -// After deletes the kafkaTopic and kcat pod. -func requireInternalProducerConsumer(kubectlOptions *k8s.KubectlOptions) { - When("Internally produce and consume message to Kafka cluster", func() { - requireDeployingKcatPod(kubectlOptions, kcatPodName) - requireDeployingKafkaTopic(kubectlOptions, testTopicName) - requireInternalProducingConsumingMessage(kubectlOptions, "", kcatPodName, testTopicName) - requireDeleteKafkaTopic(kubectlOptions, testTopicName) - requireDeleteKcatPod(kubectlOptions, kcatPodName) - }) -} - // requireDeployingKcatPod deploys kcat pod form a template and checks the pod readiness -func requireDeployingKcatPod(kubectlOptions *k8s.KubectlOptions, podName string) { +func requireDeployingKcatPod(kubectlOptions k8s.KubectlOptions, podName string) { It("Deploying Kcat Pod", func() { applyK8sResourceFromTemplate(kubectlOptions, kcatPodTemplate, @@ -52,7 +39,7 @@ func requireDeployingKcatPod(kubectlOptions *k8s.KubectlOptions, podName string) } // requireDeployingKafkaTopic deploys a kafkaTopic resource from a template -func requireDeployingKafkaTopic(kubectlOptions *k8s.KubectlOptions, topicName string) { +func requireDeployingKafkaTopic(kubectlOptions k8s.KubectlOptions, topicName string) { It("Deploying KafkaTopic CR", func() { applyK8sResourceFromTemplate(kubectlOptions, kafkaTopicTemplate, @@ -62,46 +49,50 @@ func requireDeployingKafkaTopic(kubectlOptions *k8s.KubectlOptions, topicName st "Namespace": kubectlOptions.Namespace, }, ) - waitK8sResourceCondition(kubectlOptions, "kafkatopic", "jsonpath={.status.state}=created", defaultTopicCreationWaitTime, "", topicName) + waitK8sResourceCondition(kubectlOptions, kafkaTopicKind, "jsonpath={.status.state}=created", defaultTopicCreationWaitTime, "", topicName) }) } // requireDeleteKafkaTopic deletes kafkaTopic resource. -func requireDeleteKafkaTopic(kubectlOptions *k8s.KubectlOptions, topicName string) { +func requireDeleteKafkaTopic(kubectlOptions k8s.KubectlOptions, topicName string) { It("Deleting KafkaTopic CR", func() { - deleteK8sResource(kubectlOptions, defaultDeletionTimeout, "kafkatopic", topicName) + deleteK8sResource(kubectlOptions, defaultDeletionTimeout, kafkaTopicKind, "", topicName) }) } // requireDeleteKcatPod deletes kcat pod. -func requireDeleteKcatPod(kubectlOptions *k8s.KubectlOptions, podName string) { +func requireDeleteKcatPod(kubectlOptions k8s.KubectlOptions, podName string) { It("Deleting Kcat pod", func() { - deleteK8sResource(kubectlOptions, defaultDeletionTimeout, "pods", podName) + deleteK8sResource(kubectlOptions, defaultDeletionTimeout, "pods", "", podName) }) } // requireInternalProducingConsumingMessage produces and consumes messages internally through a kcat pod // and makes comparisons between the produced and consumed messages. // When internalAddress parameter is empty, it gets the internal address from the kafkaCluster CR status -func requireInternalProducingConsumingMessage(kubectlOptions *k8s.KubectlOptions, internalAddress, kcatPodName, topicName string) { +func requireInternalProducingConsumingMessage(kubectlOptions k8s.KubectlOptions, internalAddress, kcatPodName, topicName string) { It(fmt.Sprintf("Producing and consuming messages to/from topicName: '%s", topicName), func() { if internalAddress == "" { By("Getting Kafka cluster internal addresses") - internalListenerNames := getK8sResources(kubectlOptions, - []string{"kafkacluster"}, + internalListenerNames, err := getK8sResources(kubectlOptions, + []string{kafkaKind}, "", kafkaClusterName, kubectlArgGoTemplateInternalListenersName, ) + + Expect(err).ShouldNot(HaveOccurred()) Expect(internalListenerNames).ShouldNot(BeEmpty()) - internalListenerAddresses := getK8sResources(kubectlOptions, - []string{"kafkacluster"}, + internalListenerAddresses, err := getK8sResources(kubectlOptions, + []string{kafkaKind}, "", kafkaClusterName, fmt.Sprintf(kubectlArgGoTemplateInternalListenerAddressesTemplate, internalListenerNames[0]), ) + Expect(err).ShouldNot(HaveOccurred()) + Expect(internalListenerAddresses).ShouldNot(BeEmpty()) internalAddress = internalListenerAddresses[0] diff --git a/tests/e2e/produce_consume_test.go b/tests/e2e/produce_consume_test.go new file mode 100644 index 0000000000..b2ba7c73e6 --- /dev/null +++ b/tests/e2e/produce_consume_test.go @@ -0,0 +1,27 @@ +package e2e + +import ( + "github.com/gruntwork-io/terratest/modules/k8s" + . "github.com/onsi/ginkgo/v2" + . "github.com/onsi/gomega" +) + +func testProduceConsumeInternal() bool { + return When("Internally produce and consume message to/from Kafka cluster", func() { + var kubectlOptions k8s.KubectlOptions + var err error + + It("Acquiring K8s config and context", func() { + kubectlOptions, err = kubectlOptionsForCurrentContext() + Expect(err).NotTo(HaveOccurred()) + }) + + kubectlOptions.Namespace = koperatorLocalHelmDescriptor.Namespace + + requireDeployingKcatPod(kubectlOptions, kcatPodName) + requireDeployingKafkaTopic(kubectlOptions, testTopicName) + requireInternalProducingConsumingMessage(kubectlOptions, "", kcatPodName, testTopicName) + requireDeleteKafkaTopic(kubectlOptions, testTopicName) + requireDeleteKcatPod(kubectlOptions, kcatPodName) + }) +} diff --git a/tests/e2e/prometheus_test.go b/tests/e2e/prometheus_test.go deleted file mode 100644 index 584ad97a24..0000000000 --- a/tests/e2e/prometheus_test.go +++ /dev/null @@ -1,106 +0,0 @@ -// Copyright © 2023 Cisco Systems, Inc. and/or its affiliates -// -// 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 e2e - -import ( - "fmt" - - "github.com/gruntwork-io/terratest/modules/k8s" - - . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" -) - -// requireInstallingPrometheusOperator deploys prometheus-operator Helm chart -// and checks the success of that operation. -func requireInstallingPrometheusOperator(kubectlOptions *k8s.KubectlOptions, prometheusOperatorVersion Version) { - When("Installing prometheus-operator", func() { - requireInstallingPrometheusOperatorHelmChartIfDoesNotExist(kubectlOptions, prometheusOperatorVersion) - }) -} - -// requireDeployingCertManagerHelmChart checks the existence of the cert-manager -// Helm release and installs it if it's not present. -func requireInstallingPrometheusOperatorHelmChartIfDoesNotExist( - kubectlOptions *k8s.KubectlOptions, - prometheusOperatorVersion Version, -) { - It("Installing prometheus-operator Helm chart", func() { - installHelmChartIfDoesNotExist( - kubectlOptions, - "https://prometheus-community.github.io/helm-charts", - "kube-prometheus-stack", - prometheusOperatorVersion, - "prometheus-operator", - map[string]string{ - "prometheusOperator.createCustomResource": "true", - "defaultRules.enabled": "false", - "alertmanager.enabled": "false", - "grafana.enabled": "false", - "kubeApiServer.enabled": "false", - "kubelet.enabled": "false", - "kubeControllerManager.enabled": "false", - "coreDNS.enabled": "false", - "kubeEtcd.enabled": "false", - "kubeScheduler.enabled": "false", - "kubeProxy.enabled": "false", - "kubeStateMetrics.enabled": "false", - "nodeExporter.enabled": "false", - "prometheus.enabled": "false", - }, - ) - - By("Verifying prometheus-operator pods") - requireRunningPods(kubectlOptions, "app", "kube-prometheus-stack-operator") - }) -} - -// requireUninstallingPrometheusOperator uninstall prometheus-operator Helm chart and -// remove CRDs. -func requireUninstallingPrometheusOperator(kubectlOptions *k8s.KubectlOptions) { - When("Uninstalling prometheus-operator", func() { - requireUninstallingPrometheusOperatorHelmChart(kubectlOptions) - requireRemovePrometheusOperatorCRDs(kubectlOptions) - }) -} - -// requireUninstallingPrometheusOperatorHelmChart uninstall prometheus-operator Helm chart -// and checks the success of that operation. -func requireUninstallingPrometheusOperatorHelmChart(kubectlOptions *k8s.KubectlOptions) { - It("Uninstalling Prometheus-operator Helm chart", func() { - uninstallHelmChartIfExists(kubectlOptions, "prometheus-operator", true) - By("Verifying Prometheus-operator helm chart resources cleanup") - - prometheusK8sResources := basicK8sCRDs() - prometheusK8sResources = append(prometheusK8sResources, prometheusCRDs()...) - - remainedResources := getK8sResources(kubectlOptions, - prometheusK8sResources, - fmt.Sprintf(managedByHelmLabelTemplate, "prometheus-operator"), - "", - kubectlArgGoTemplateKindNameNamespace, - "--all-namespaces") - Expect(remainedResources).Should(BeEmpty()) - }) -} - -// requireRemovePrometheusOperatorCRDs deletes the Prometheus-operator CRDs -func requireRemovePrometheusOperatorCRDs(kubectlOptions *k8s.KubectlOptions) { - It("Removing prometheus-operator CRDs", func() { - for _, crd := range prometheusCRDs() { - deleteK8sResourceGlobalNoErrNotFound(kubectlOptions, defaultDeletionTimeout, "crds", crd) - } - }) -} diff --git a/tests/e2e/test_install.go b/tests/e2e/test_install.go index d19f5d3cb5..1850656445 100644 --- a/tests/e2e/test_install.go +++ b/tests/e2e/test_install.go @@ -20,10 +20,8 @@ import ( . "github.com/onsi/gomega" ) -var _ = testInstall() - func testInstall() bool { - return When("Installing Koperator", Ordered, func() { + return When("Installing Koperator and dependencies", Ordered, func() { var kubectlOptions k8s.KubectlOptions var err error diff --git a/tests/e2e/test_test.go b/tests/e2e/test_test.go new file mode 100644 index 0000000000..6e73c1547d --- /dev/null +++ b/tests/e2e/test_test.go @@ -0,0 +1,27 @@ +// Copyright © 2023 Cisco Systems, Inc. and/or its affiliates +// +// 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 e2e + +import ( + . "github.com/onsi/ginkgo/v2" +) + +var _ = When("Testing e2e", Ordered, func() { + //testInstall() + testProduceConsumeInternal() + testUninstallZookeeperCluster() + testUninstallKafkaCluster() + // testUninstall() +}) diff --git a/tests/e2e/test_uninstall.go b/tests/e2e/test_uninstall.go new file mode 100644 index 0000000000..0066669e02 --- /dev/null +++ b/tests/e2e/test_uninstall.go @@ -0,0 +1,55 @@ +// Copyright © 2023 Cisco Systems, Inc. and/or its affiliates +// +// 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 e2e + +import ( + "github.com/gruntwork-io/terratest/modules/k8s" + . "github.com/onsi/ginkgo/v2" + . "github.com/onsi/gomega" +) + +func testUninstall() bool { + return When("Uninstalling Koperator and dependencies", Ordered, func() { + var kubectlOptions k8s.KubectlOptions + var err error + + It("Acquiring K8s config and context", func() { + kubectlOptions, err = kubectlOptionsForCurrentContext() + Expect(err).NotTo(HaveOccurred()) + }) + + requireUninstallingKoperator(k8s.KubectlOptions{ + ContextName: kubectlOptions.ContextName, + ConfigPath: kubectlOptions.ConfigPath, + Namespace: koperatorLocalHelmDescriptor.Namespace, + }) + requireUninstallingZookeeperOperator(k8s.KubectlOptions{ + ContextName: kubectlOptions.ContextName, + ConfigPath: kubectlOptions.ConfigPath, + Namespace: zookeeperOperatorHelmDescriptor.Namespace, + }) + requireUninstallingPrometheusOperator(k8s.KubectlOptions{ + ContextName: kubectlOptions.ContextName, + ConfigPath: kubectlOptions.ConfigPath, + Namespace: prometheusOperatorHelmDescriptor.Namespace, + }) + requireUninstallingCertManager(k8s.KubectlOptions{ + ContextName: kubectlOptions.ContextName, + ConfigPath: kubectlOptions.ConfigPath, + Namespace: certManagerHelmDescriptor.Namespace, + }) + + }) +} diff --git a/tests/e2e/uninstall.go b/tests/e2e/uninstall.go new file mode 100644 index 0000000000..1a398b02f2 --- /dev/null +++ b/tests/e2e/uninstall.go @@ -0,0 +1,194 @@ +// Copyright © 2023 Cisco Systems, Inc. and/or its affiliates +// +// 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 e2e + +import ( + "fmt" + + "github.com/gruntwork-io/terratest/modules/k8s" + . "github.com/onsi/ginkgo/v2" + . "github.com/onsi/gomega" +) + +// requireRemoveKoperatorCRDs deletes the koperator CRDs +func requireRemoveKoperatorCRDs(kubectlOptions k8s.KubectlOptions) { + It("Removing koperator CRDs", func() { + for _, crd := range koperatorCRDs() { + deleteK8sResourceNoErrNotFound(kubectlOptions, defaultDeletionTimeout, crdKind, crd) + } + }) +} + +// requireUninstallingKoperator uninstall koperator Helm chart and removes Koperator's CRDs. +func requireUninstallingKoperator(kubectlOptions k8s.KubectlOptions) { + When("Uninstalling Koperator", func() { + requireUninstallingKoperatorHelmChart(kubectlOptions) + requireRemoveKoperatorCRDs(kubectlOptions) + }) +} + +// requireUninstallingKoperatorHelmChart uninstall Koperator Helm chart +// and checks the success of that operation. +func requireUninstallingKoperatorHelmChart(kubectlOptions k8s.KubectlOptions) { + It("Uninstalling Koperator Helm chart", func() { + uninstallHelmChartIfExists(kubectlOptions, koperatorLocalHelmDescriptor.ReleaseName, true) + By("Verifying Koperator helm chart resources cleanup") + k8sResourceKinds, err := listK8sAllResourceKind(kubectlOptions) + Expect(err).ShouldNot(HaveOccurred()) + + koperatorAvailableResourceKinds := _stringSlicesUnion(koperatorCRDs(), k8sResourceKinds) + koperatorAvailableResourceKinds = append(koperatorAvailableResourceKinds, basicK8sResourceKinds()...) + + remainedResources, err := getK8sResources(kubectlOptions, + koperatorAvailableResourceKinds, + fmt.Sprintf(managedByHelmLabelTemplate, koperatorLocalHelmDescriptor.ReleaseName), + "", + kubectlArgGoTemplateKindNameNamespace, + "--all-namespaces") + + Expect(err).ShouldNot(HaveOccurred()) + Expect(remainedResources).Should(BeEmpty()) + }) +} + +// requireUninstallingZookeeperOperator uninstall Zookeeper-operator Helm chart +// and remove CRDs. +func requireUninstallingZookeeperOperator(kubectlOptions k8s.KubectlOptions) { + When("Uninstalling zookeeper-operator", func() { + requireUninstallingZookeeperOperatorHelmChart(kubectlOptions) + requireRemoveZookeeperOperatorCRDs(kubectlOptions) + }) +} + +// requireUninstallingZookeeperOperatorHelmChart uninstall Zookeeper-operator Helm chart +// and checks the success of that operation. +func requireUninstallingZookeeperOperatorHelmChart(kubectlOptions k8s.KubectlOptions) { + It("Uninstalling zookeeper-operator Helm chart", func() { + uninstallHelmChartIfExists(kubectlOptions, zookeeperOperatorHelmDescriptor.ReleaseName, true) + By("Verifying Zookeeper-operator helm chart resources cleanup") + + k8sResourceKinds, err := listK8sAllResourceKind(kubectlOptions) + Expect(err).ShouldNot(HaveOccurred()) + + zookeeperAvailableResourceKinds := _stringSlicesUnion(zookeeperCRDs(), k8sResourceKinds) + zookeeperAvailableResourceKinds = append(zookeeperAvailableResourceKinds, basicK8sResourceKinds()...) + + remainedResources, err := getK8sResources(kubectlOptions, + zookeeperAvailableResourceKinds, + fmt.Sprintf(managedByHelmLabelTemplate, zookeeperOperatorHelmDescriptor.ReleaseName), + "", + kubectlArgGoTemplateKindNameNamespace, + "--all-namespaces") + Expect(err).ShouldNot(HaveOccurred()) + + Expect(remainedResources).Should(BeEmpty()) + }) +} + +// requireRemoveZookeeperOperatorCRDs deletes the zookeeper-operator CRDs +func requireRemoveZookeeperOperatorCRDs(kubectlOptions k8s.KubectlOptions) { + It("Removing zookeeper-operator CRDs", func() { + for _, crd := range zookeeperCRDs() { + deleteK8sResourceNoErrNotFound(kubectlOptions, defaultDeletionTimeout, crdKind, crd) + } + }) +} + +// requireUninstallingPrometheusOperator uninstall prometheus-operator Helm chart and +// remove CRDs. +func requireUninstallingPrometheusOperator(kubectlOptions k8s.KubectlOptions) { + When("Uninstalling prometheus-operator", func() { + requireUninstallingPrometheusOperatorHelmChart(kubectlOptions) + requireRemovePrometheusOperatorCRDs(kubectlOptions) + }) +} + +// requireUninstallingPrometheusOperatorHelmChart uninstall prometheus-operator Helm chart +// and checks the success of that operation. +func requireUninstallingPrometheusOperatorHelmChart(kubectlOptions k8s.KubectlOptions) { + It("Uninstalling Prometheus-operator Helm chart", func() { + uninstallHelmChartIfExists(kubectlOptions, "prometheus-operator", true) + By("Verifying Prometheus-operator helm chart resources cleanup") + + k8sResourceKinds, err := listK8sAllResourceKind(kubectlOptions) + Expect(err).ShouldNot(HaveOccurred()) + + prometheusAvailableResourceKinds := _stringSlicesUnion(prometheusCRDs(), k8sResourceKinds) + prometheusAvailableResourceKinds = append(prometheusAvailableResourceKinds, basicK8sResourceKinds()...) + + remainedResources, err := getK8sResources(kubectlOptions, + prometheusAvailableResourceKinds, + fmt.Sprintf(managedByHelmLabelTemplate, prometheusOperatorHelmDescriptor.ReleaseName), + "", + kubectlArgGoTemplateKindNameNamespace, + "--all-namespaces") + Expect(err).ShouldNot(HaveOccurred()) + + Expect(remainedResources).Should(BeEmpty()) + }) +} + +// requireRemovePrometheusOperatorCRDs deletes the Prometheus-operator CRDs +func requireRemovePrometheusOperatorCRDs(kubectlOptions k8s.KubectlOptions) { + It("Removing prometheus-operator CRDs", func() { + for _, crd := range prometheusCRDs() { + deleteK8sResourceNoErrNotFound(kubectlOptions, defaultDeletionTimeout, crdKind, crd) + } + }) +} + +// requireUninstallingCertManager uninstall Cert-manager Helm chart and +// remove CRDs. +func requireUninstallingCertManager(kubectlOptions k8s.KubectlOptions) { + When("Uninstalling zookeeper-operator", func() { + requireUninstallingCertManagerHelmChart(kubectlOptions) + requireRemoveCertManagerCRDs(kubectlOptions) + }) +} + +// requireUninstallingCertManagerHelmChart uninstalls cert-manager helm chart +// and checks the success of that operation. +func requireUninstallingCertManagerHelmChart(kubectlOptions k8s.KubectlOptions) { + It("Uninstalling Cert-manager Helm chart", func() { + uninstallHelmChartIfExists(kubectlOptions, certManagerHelmDescriptor.ReleaseName, true) + By("Verifying Cert-manager helm chart resources cleanup") + + k8sResourceKinds, err := listK8sAllResourceKind(kubectlOptions) + Expect(err).ShouldNot(HaveOccurred()) + + certManagerAvailableResourceKinds := _stringSlicesUnion(certManagerCRDs(), k8sResourceKinds) + certManagerAvailableResourceKinds = append(certManagerAvailableResourceKinds, basicK8sResourceKinds()...) + + remainedResources, err := getK8sResources(kubectlOptions, + certManagerAvailableResourceKinds, + fmt.Sprintf(managedByHelmLabelTemplate, certManagerHelmDescriptor.ReleaseName), + "", + kubectlArgGoTemplateKindNameNamespace, + "--all-namespaces") + Expect(err).ShouldNot(HaveOccurred()) + + Expect(remainedResources).Should(BeEmpty()) + }) + +} + +// requireRemoveKoperatorCRDs deletes the cert-manager CRDs +func requireRemoveCertManagerCRDs(kubectlOptions k8s.KubectlOptions) { + It("Removing cert-manager CRDs", func() { + for _, crd := range certManagerCRDs() { + deleteK8sResourceNoErrNotFound(kubectlOptions, defaultDeletionTimeout, crdKind, crd) + } + }) +} diff --git a/tests/e2e/uninstall_cluster.go b/tests/e2e/uninstall_cluster.go new file mode 100644 index 0000000000..e88eecc3d0 --- /dev/null +++ b/tests/e2e/uninstall_cluster.go @@ -0,0 +1,77 @@ +// Copyright © 2023 Cisco Systems, Inc. and/or its affiliates +// +// 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 e2e + +import ( + "context" + "fmt" + "time" + + koperator_v1beta1 "github.com/banzaicloud/koperator/api/v1beta1" + + "github.com/gruntwork-io/terratest/modules/k8s" + . "github.com/onsi/ginkgo/v2" + . "github.com/onsi/gomega" +) + +// requireDeleteKafkaCluster deletes KafkaCluster resource and +// checks the removal of the Kafka cluster related resources +func requireDeleteKafkaCluster(kubectlOptions k8s.KubectlOptions, name string) { + It("Delete KafkaCluster custom resource", func() { + err := deleteK8sResourceNoErrNotFound(kubectlOptions, defaultDeletionTimeout, kafkaKind, koperatorLocalHelmDescriptor.Namespace) + Expect(err).ShouldNot(HaveOccurred()) + Eventually(context.Background(), func() []string { + By("Verifying the Kafka cluster resource cleanup") + + // Check only those Koperator related resource types we have in K8s (istio usecase) + k8sResourceKinds, err := listK8sAllResourceKind(kubectlOptions) + Expect(err).ShouldNot(HaveOccurred()) + + koperatorAvailableResourceKinds := _stringSlicesUnion(getKoperatorRelatedResourceKinds(), k8sResourceKinds) + koperatorAvailableResourceKinds = append(koperatorAvailableResourceKinds, basicK8sResourceKinds()...) + + resources, err := getK8sResources(kubectlOptions, + koperatorAvailableResourceKinds, + fmt.Sprintf("%s=%s", koperator_v1beta1.KafkaCRLabelKey, name), + "", + "--all-namespaces", kubectlArgGoTemplateKindNameNamespace) + Expect(err).ShouldNot(HaveOccurred()) + + return resources + }, kafkaClusterResourceCleanupTimeout, 1*time.Second).Should(BeEmpty()) + }) +} + +// requireDeleteZookeeperCluster deletes the ZookeeperCluster CR and verify the corresponding resources cleanup +func requireDeleteZookeeperCluster(kubectlOptions k8s.KubectlOptions, name string) { + It("Delete ZookeeperCluster custom resource", func() { + deleteK8sResourceNoErrNotFound(kubectlOptions, defaultDeletionTimeout, zookeeperKind, name) + Eventually(context.Background(), func() []string { + By("Verifying the Zookeeper cluster resource cleanup") + + zookeeperK8sResources := basicK8sResourceKinds() + zookeeperK8sResources = append(zookeeperK8sResources, zookeeperCRDs()...) + + resources, err := getK8sResources(kubectlOptions, + zookeeperK8sResources, + fmt.Sprintf("app=%s", name), + "", + "--all-namespaces", kubectlArgGoTemplateKindNameNamespace) + Expect(err).ShouldNot(HaveOccurred()) + return resources + + }, zookeeperClusterResourceCleanupTimeout, 1*time.Second).Should(BeEmpty()) + }) +} diff --git a/tests/e2e/uninstall_cluster_test.go b/tests/e2e/uninstall_cluster_test.go new file mode 100644 index 0000000000..78d71aad16 --- /dev/null +++ b/tests/e2e/uninstall_cluster_test.go @@ -0,0 +1,52 @@ +// Copyright © 2023 Cisco Systems, Inc. and/or its affiliates +// +// 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 e2e + +import ( + "github.com/gruntwork-io/terratest/modules/k8s" + . "github.com/onsi/ginkgo/v2" + . "github.com/onsi/gomega" +) + +func testUninstallZookeeperCluster() bool { + return When("Uninstalling Zookeeper cluster", func() { + var kubectlOptions k8s.KubectlOptions + var err error + + It("Acquiring K8s config and context", func() { + kubectlOptions, err = kubectlOptionsForCurrentContext() + Expect(err).NotTo(HaveOccurred()) + }) + + kubectlOptions.Namespace = zookeeperOperatorHelmDescriptor.Namespace + requireDeleteZookeeperCluster(kubectlOptions, zookeeperClusterName) + + }) +} + +func testUninstallKafkaCluster() bool { + return When("Uninstalling Kafka cluster", func() { + var kubectlOptions k8s.KubectlOptions + var err error + + It("Acquiring K8s config and context", func() { + kubectlOptions, err = kubectlOptionsForCurrentContext() + Expect(err).NotTo(HaveOccurred()) + }) + + kubectlOptions.Namespace = koperatorLocalHelmDescriptor.Namespace + requireDeleteKafkaCluster(kubectlOptions, kafkaClusterName) + }) +} diff --git a/tests/e2e/utils.go b/tests/e2e/utils.go index 7440b4b2de..e57bb13d10 100644 --- a/tests/e2e/utils.go +++ b/tests/e2e/utils.go @@ -20,6 +20,10 @@ import ( "strings" ) +const ( + kubectlNotFoundErrorMsg = "NotFound" +) + // Returns the union of the slices from argument. func _stringSlicesUnion(sliceA, sliceB []string) []string { if len(sliceA) == 0 || len(sliceB) == 0 { @@ -59,6 +63,7 @@ func _kubectlArgExtender(args []string, logMsg, selector, names, namespace strin } if len(extraArgs) != 0 { logMsg = fmt.Sprintf("%s extraArgs: '%s'", logMsg, extraArgs) + args = append(args, extraArgs...) } return logMsg, args } diff --git a/tests/e2e/zookeeper_test.go b/tests/e2e/zookeeper_test.go deleted file mode 100644 index 94bc2ba022..0000000000 --- a/tests/e2e/zookeeper_test.go +++ /dev/null @@ -1,117 +0,0 @@ -// Copyright © 2023 Cisco Systems, Inc. and/or its affiliates -// -// 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 e2e - -import ( - "context" - "fmt" - "time" - - "github.com/gruntwork-io/terratest/modules/k8s" - - . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" -) - -// requireInstallingZookeeperOperator deploys zookeeper-operator Helm chart and -// checks the success of that operation. -func requireInstallingZookeeperOperator(kubectlOptions *k8s.KubectlOptions, certManagerVersion string) { - When("Installing zookeeper-operator", func() { - requireInstallingZookeeperOperatorHelmChartIfDoesNotExist(kubectlOptions, certManagerVersion) - }) -} - -// requireDeployingCertManagerHelmChart checks the existence of the cert-manager -// Helm release and installs it if it's not present. -func requireInstallingZookeeperOperatorHelmChartIfDoesNotExist( - kubectlOptions *k8s.KubectlOptions, - zookeeperOperatorVersion string, -) { - It("Installing zookeeper-operator Helm chart", func() { - installHelmChartIfDoesNotExist( - kubectlOptions, - "https://charts.pravega.io", - "zookeeper-operator", - zookeeperOperatorVersion, - "zookeeper-operator", - nil, - ) - - By("Verifying zookeeper-operator pods") - requireRunningPods(kubectlOptions, "name", "zookeeper-operator") - }) -} - -// requireUninstallingZookeeperOperator uninstall Zookeeper-operator Helm chart -// and remove CRDs. -func requireUninstallingZookeeperOperator(kubectlOptions *k8s.KubectlOptions) { - When("Uninstalling zookeeper-operator", func() { - requireUninstallingZookeeperOperatorHelmChart(kubectlOptions) - requireRemoveZookeeperOperatorCRDs(kubectlOptions) - }) -} - -// requireUninstallingZookeeperOperatorHelmChart uninstall Zookeeper-operator Helm chart -// and checks the success of that operation. -func requireUninstallingZookeeperOperatorHelmChart(kubectlOptions *k8s.KubectlOptions) { - It("Uninstalling zookeeper-operator Helm chart", func() { - uninstallHelmChartIfExists(kubectlOptions, "zookeeper-operator", true) - By("Verifying Zookeeper-operator helm chart resources cleanup") - k8sCRDs := listK8sAllResourceType(kubectlOptions) - remainedResources := getK8sResources(kubectlOptions, - k8sCRDs, - fmt.Sprintf(managedByHelmLabelTemplate, "zookeeper-operator"), - "", - kubectlArgGoTemplateKindNameNamespace, - "--all-namespaces") - Expect(remainedResources).Should(BeEmpty()) - }) -} - -// requireRemoveZookeeperOperatorCRDs deletes the zookeeper-operator CRDs -func requireRemoveZookeeperOperatorCRDs(kubectlOptions *k8s.KubectlOptions) { - It("Removing zookeeper-operator CRDs", func() { - for _, crd := range zookeeperCRDs() { - deleteK8sResourceGlobalNoErrNotFound(kubectlOptions, defaultDeletionTimeout, "crds", crd) - } - }) -} - -// requireUninstallZookeeperCluster uninstall the Zookeeper cluster -func requireUninstallZookeeperCluster(kubectlOptions *k8s.KubectlOptions, name string) { - When("Uninstalling Zookeeper cluster", func() { - requireDeleteZookeeperCluster(kubectlOptions, name) - - }) -} - -// requireDeleteZookeeperCluster deletes the ZookeeperCluster CR and verify the corresponding resources cleanup -func requireDeleteZookeeperCluster(kubectlOptions *k8s.KubectlOptions, name string) { - It("Delete ZookeeperCluster custom resource", func() { - deleteK8sResourceGlobalNoErrNotFound(kubectlOptions, defaultDeletionTimeout, zookeeperKind, name) - Eventually(context.Background(), func() []string { - By("Verifying the Zookeeper cluster resource cleanup") - - zookeeperK8sResources := basicK8sCRDs() - zookeeperK8sResources = append(zookeeperK8sResources, zookeeperCRDs()...) - - return getK8sResources(kubectlOptions, - zookeeperK8sResources, - fmt.Sprintf("app=%s", name), - "", - "--all-namespaces", kubectlArgGoTemplateKindNameNamespace) - }, zookeeperClusterResourceCleanupTimeout, 3*time.Millisecond).Should(BeEmpty()) - }) -}