diff --git a/changelog/fragments/remove-error-thrown-for-proxy-path.yaml b/changelog/fragments/remove-error-thrown-for-proxy-path.yaml new file mode 100644 index 0000000000..6119b614de --- /dev/null +++ b/changelog/fragments/remove-error-thrown-for-proxy-path.yaml @@ -0,0 +1,5 @@ +entries: + - description: > + Previously we added this error to show the user that the Path component is part of proxy server. Now, kubectl made this fix that handles this case and there is no need to throw this error anymore. + kind: addition + breaking: false \ No newline at end of file diff --git a/internal/cmd/ansible-operator/run/cmd.go b/internal/cmd/ansible-operator/run/cmd.go index 4a0800960e..a82ce5b99d 100644 --- a/internal/cmd/ansible-operator/run/cmd.go +++ b/internal/cmd/ansible-operator/run/cmd.go @@ -18,7 +18,6 @@ import ( "errors" "flag" "fmt" - "net/url" "os" "runtime" "strconv" @@ -112,11 +111,6 @@ func run(cmd *cobra.Command, f *flags.Flags) { os.Exit(1) } - if err := verifyCfgURL(cfg.Host); err != nil { - log.Error(err, "URL verification failed.") - os.Exit(1) - } - // TODO(2.0.0): remove // Deprecated: OPERATOR_NAME environment variable is an artifact of the // legacy operator-sdk project scaffolding. Flag `--leader-election-id` @@ -295,19 +289,6 @@ func run(cmd *cobra.Command, f *flags.Flags) { log.Info("Exiting.") } -// verifyCfgURL verifies the path component of api endpoint -// passed through the config. -func verifyCfgURL(path string) error { - urlPath, err := url.Parse(path) - if err != nil { - return fmt.Errorf("failed to parse the path in URL %v", err) - } - if urlPath != nil && urlPath.Path != "" && urlPath.Path != "/" { - return fmt.Errorf("api endpoint '%s' contains a path component, which the proxy server is currently unable to handle properly. Work on this issue is being tracked here: https://github.com/operator-framework/operator-sdk/issues/4925", path) - } - return nil -} - // exitIfUnsupported prints an error containing unsupported field names and exits // if any of those fields are not their default values. func exitIfUnsupported(options manager.Options) { diff --git a/internal/cmd/ansible-operator/run/cmd_test.go b/internal/cmd/ansible-operator/run/cmd_test.go deleted file mode 100644 index dc80016930..0000000000 --- a/internal/cmd/ansible-operator/run/cmd_test.go +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright 2020 The Operator-SDK Authors -// -// 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 run - -import ( - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" -) - -var _ = Describe("Running a verify config command", func() { - - Describe("verifyCfgURL", func() { - It("verify valid URL", func() { - err := verifyCfgURL("https://127.0.0.1:49810") - Expect(err).NotTo(HaveOccurred()) - }) - }) - - Describe("verifyCfgURL", func() { - It("verify valid URL with slash at the end", func() { - err := verifyCfgURL("https://127.0.0.1:49810/") - Expect(err).To(BeNil()) - }) - }) - - Describe("verifyCfgURL", func() { - It("Verify invalid URL and check if printed output contains path or not", func() { - err := verifyCfgURL("https://127.0.0.1:49810/path") - Expect(err).NotTo(BeNil()) - Expect(err.Error()).To(ContainSubstring("'https://127.0.0.1:49810/path' contains a path component, which the proxy server is currently unable to handle properly")) - }) - }) - - Describe("verifyCfgURL", func() { - It("verify Empty URL", func() { - err := verifyCfgURL("") - Expect(err).To(BeNil()) - }) - }) - -})