From 0b3b04727993e42096ffe893b6913dee3d1d024a Mon Sep 17 00:00:00 2001 From: Hongkai Liu Date: Mon, 25 May 2026 09:17:03 -0400 Subject: [PATCH 1/5] Add e2e tests for TLS profile update Two tests are added: * One modifies TLS configuration in `APIServer/cluster` and checks if CVO syncs with it and if the CVO target is still up afterward. If the env. var. `${WAIT_STABLE}` is set to `true`, the test waits until the cluster is stable after modifying the condition before moving the test forward. Otherwise, instead of waiting, the CVO target is checked a few times to ensure it is consistently up. It is currently marked as Local, i.e., we do not run it in CI because it would be too destructive. But it gives us some convenience to execute it, e.g., against a cluster-bot cluster. * The other is to avoid APIServer resource not loaded at startup. --- pkg/tls/tls.go | 9 +- test/cvo/cvo.go | 2 +- test/cvo/prometheus.go | 45 ++++++ test/cvo/tls.go | 307 +++++++++++++++++++++++++++++++++++++++++ test/oc/api/api.go | 4 + test/oc/cli/cli.go | 15 ++ test/util/util.go | 126 +++++++++++++++++ 7 files changed, 505 insertions(+), 3 deletions(-) create mode 100644 test/cvo/prometheus.go create mode 100644 test/cvo/tls.go diff --git a/pkg/tls/tls.go b/pkg/tls/tls.go index 17bf7d7a09..ff7c7c436c 100644 --- a/pkg/tls/tls.go +++ b/pkg/tls/tls.go @@ -30,6 +30,11 @@ type Settings struct { CipherSuites []uint16 } +const ( + APIServerNotAvailableAtStartupLogKeyword = "APIServer resource not available at startup" + SyncedCachedTLSProfileLogKeyword = "Synced cached TLS profile" +) + // NewProfileManager creates a new TLS profile manager and performs initial resolution. // Falls back to safe defaults on any error to prioritize availability. func NewProfileManager(apiServerInformer configinformersv1.APIServerInformer, overrides *Settings) (*ProfileManager, error) { @@ -39,7 +44,7 @@ func NewProfileManager(apiServerInformer configinformersv1.APIServerInformer, ov apiServer, err := apiServerInformer.Lister().Get(tlsprofile.APIServerName) if err != nil { - klog.Warningf("APIServer resource not available at startup: %v, using fallback defaults", err) + klog.Warningf("%s: %v, using fallback defaults", APIServerNotAvailableAtStartupLogKeyword, err) apiServer = nil } @@ -106,7 +111,7 @@ func (m *ProfileManager) updateSettings(apiServer *configv1.APIServer) error { m.applyProfile = applyFunc m.mu.Unlock() - klog.V(2).Info("Synced cached TLS profile") + klog.V(2).Info(SyncedCachedTLSProfileLogKeyword) return nil } diff --git a/test/cvo/cvo.go b/test/cvo/cvo.go index 7b3bf8ed89..ccaaba1abb 100644 --- a/test/cvo/cvo.go +++ b/test/cvo/cvo.go @@ -18,7 +18,7 @@ import ( "github.com/openshift/cluster-version-operator/test/util" ) -var logger = g.GinkgoLogr.WithName("cluster-version-operator-tests") +var logger = util.Logger var _ = g.Describe(`[Jira:"Cluster Version Operator"] cluster-version-operator-tests`, func() { g.It("should support passing tests", func() { diff --git a/test/cvo/prometheus.go b/test/cvo/prometheus.go new file mode 100644 index 0000000000..0e2f3ccb86 --- /dev/null +++ b/test/cvo/prometheus.go @@ -0,0 +1,45 @@ +package cvo + +import ( + "fmt" + "regexp" +) + +type prometheusTarget struct { + Labels map[string]string + Health string + ScrapeUrl string +} + +// Ref. https://github.com/openshift/origin/blob/f4d1c208855b7216452041276a7f909c3cf477ce/test/extended/prometheus/prometheus.go#L970 +type prometheusTargets struct { + Data struct { + ActiveTargets []prometheusTarget + } + Status string +} + +type labels map[string]string + +func (t *prometheusTargets) Expect(l labels, health, scrapeURLPattern string) error { + for _, target := range t.Data.ActiveTargets { + match := true + for k, v := range l { + if target.Labels[k] != v { + match = false + break + } + } + if !match { + continue + } + if health != target.Health { + continue + } + if !regexp.MustCompile(scrapeURLPattern).MatchString(target.ScrapeUrl) { + continue + } + return nil + } + return fmt.Errorf("no match for %v with health %s and scrape URL %s", l, health, scrapeURLPattern) +} diff --git a/test/cvo/tls.go b/test/cvo/tls.go new file mode 100644 index 0000000000..3b93e8ff7e --- /dev/null +++ b/test/cvo/tls.go @@ -0,0 +1,307 @@ +package cvo + +import ( + "bufio" + "context" + "encoding/json" + "fmt" + "io" + "os" + "strings" + "time" + + g "github.com/onsi/ginkgo/v2" + o "github.com/onsi/gomega" + "github.com/openshift/cluster-version-operator/pkg/tls" + + corev1 "k8s.io/api/core/v1" + kerrors "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/util/wait" + "k8s.io/client-go/kubernetes" + "k8s.io/client-go/rest" + + oteginkgo "github.com/openshift-eng/openshift-tests-extension/pkg/ginkgo" + configv1 "github.com/openshift/api/config/v1" + configv1client "github.com/openshift/client-go/config/clientset/versioned/typed/config/v1" + routev1client "github.com/openshift/client-go/route/clientset/versioned" + tlsprofile "github.com/openshift/controller-runtime-common/pkg/tls" + "github.com/openshift/library-go/pkg/crypto" + + "github.com/openshift/cluster-version-operator/pkg/external" + "github.com/openshift/cluster-version-operator/test/oc" + ocapi "github.com/openshift/cluster-version-operator/test/oc/api" + "github.com/openshift/cluster-version-operator/test/util" +) + +var _ = g.Describe(`[Jira:"Cluster Version Operator"] cluster-version-operator`, func() { + + var ( + c *rest.Config + kubeClient kubernetes.Interface + configClient *configv1client.ConfigV1Client + routeClient *routev1client.Clientset + ocClient ocapi.OC + err error + + ctx = context.Background() + needRecover bool + backup configv1.APIServerSpec + + prometheusURL, bearerToken string + waitStable bool + ) + + g.BeforeEach(func() { + c, err = util.GetRestConfig() + o.Expect(err).To(o.BeNil()) + + o.Expect(util.SkipIfHypershift(ctx, c)).To(o.BeNil()) + o.Expect(util.SkipIfMicroshift(ctx, c)).To(o.BeNil()) + + kubeClient, err = util.GetKubeClient(c) + o.Expect(err).NotTo(o.HaveOccurred()) + + configClient, err = configv1client.NewForConfig(c) + o.Expect(err).To(o.BeNil()) + + routeClient, err = routev1client.NewForConfig(c) + o.Expect(err).To(o.BeNil()) + + waitStable = strings.ToLower(os.Getenv("WAIT_STABLE")) == "true" + + timeout := 2 * time.Minute + if waitStable { + timeout = 61 * time.Minute + } + ocClient, err = oc.NewOC(ocapi.Options{Logger: logger, Timeout: timeout}) + o.Expect(err).NotTo(o.HaveOccurred()) + o.Expect(ocClient).NotTo(o.BeNil()) + + if waitStable { + // check if cluster is stable before testing + _, err = ocClient.AdmWaitForStableCluster("1m0s", "5m0s") + o.Expect(err).NotTo(o.HaveOccurred(), "The cluster isn't stable before testing") + } + + prometheusURL, err = util.PrometheusRouteURL(ctx, routeClient) + o.Expect(err).NotTo(o.HaveOccurred(), "Failed to get public url of prometheus") + bearerToken, err = util.RequestPrometheusServiceAccountAPIToken(ctx, kubeClient) + o.Expect(err).NotTo(o.HaveOccurred(), "Failed to request Prometheus service account API token") + + apiServer, err := configClient.APIServers().Get(ctx, tlsprofile.APIServerName, metav1.GetOptions{}) + o.Expect(err).NotTo(o.HaveOccurred()) + backup = *apiServer.Spec.DeepCopy() + if backup.TLSAdherence == "" { + backup.TLSAdherence = configv1.TLSAdherencePolicyLegacyAdheringComponentsOnly + } + }) + + g.AfterEach(func() { + if needRecover { + apiServer, err := configClient.APIServers().Get(ctx, tlsprofile.APIServerName, metav1.GetOptions{}) + o.Expect(err).NotTo(o.HaveOccurred()) + apiServer.Spec = backup + _, err = configClient.APIServers().Update(ctx, apiServer, metav1.UpdateOptions{}) + o.Expect(err).NotTo(o.HaveOccurred()) + + if waitStable { + // wait before handing the cluster over to other tests + _, err = ocClient.AdmWaitForStableCluster("5m0s", "1h0m0s") + o.Expect(err).NotTo(o.HaveOccurred()) + } + } + }) + + // Automate the manual verification in https://github.com/openshift/cluster-version-operator/pull/1338#issuecomment-4593397211 + g.It("must get the APIServer when the TLS profile manager is created", oteginkgo.Informing(), func() { + g.By("Checking if the APIServer exists on the cluster") + _, err := configClient.APIServers().Get(ctx, tlsprofile.APIServerName, metav1.GetOptions{}) + if !kerrors.IsNotFound(err) { + o.Expect(err).NotTo(o.HaveOccurred()) + } else { + g.Skip("Skipping test: APIServer/cluster not found on the cluster") + } + + g.By("Checking if CVO failed to load the APIServer when the TLS profile manager is created") + podList, err := kubeClient.CoreV1().Pods(external.DefaultCVONamespace).List(ctx, metav1.ListOptions{ + LabelSelector: "k8s-app=cluster-version-operator", + }) + o.Expect(err).NotTo(o.HaveOccurred()) + + var podName string + for _, pod := range podList.Items { + podName = pod.Name + break + } + o.Expect(podName).NotTo(o.BeEmpty(), "Failed to find the CVO pod") + + req := kubeClient.CoreV1().Pods(external.DefaultCVONamespace).GetLogs(podName, &corev1.PodLogOptions{ + Follow: false, + }) + + podStream, err := req.Stream(ctx) + o.Expect(err).NotTo(o.HaveOccurred()) + defer func() { + err := podStream.Close() + o.Expect(err).NotTo(o.HaveOccurred()) + }() + + buf := new(strings.Builder) + _, err = io.Copy(buf, podStream) + o.Expect(err).NotTo(o.HaveOccurred()) + o.Expect(strings.Contains(buf.String(), tls.APIServerNotAvailableAtStartupLogKeyword)).To(o.BeFalse()) + }) + + // Local as it updates APIServer/cluster on the cluster which is very destructive and impacts many monitor tests + g.It("should update TLS profile", g.Label("Local"), g.Label("OTA-1996"), func() { + + controlPlaneTopology, err := util.GetControlPlaneTopology(ctx, configClient) + o.Expect(err).NotTo(o.HaveOccurred()) + if controlPlaneTopology == configv1.ExternalTopologyMode { + g.Skip("Skipping test: running on External cluster!") + } + + g.By("Checking if the CVO target is up in Prometheus") + + promTargets := func() (*prometheusTargets, error) { + contents, err := util.GetURLWithToken(util.MustJoinUrlPath(prometheusURL, "api/v1/targets"), bearerToken) + if err != nil { + return nil, err + } + targets := &prometheusTargets{} + err = json.Unmarshal([]byte(contents), targets) + if err != nil { + return nil, err + } + // sanity check. + if len(targets.Data.ActiveTargets) < 5 { + return nil, fmt.Errorf("only got %d targets, something is wrong", len(targets.Data.ActiveTargets)) + } + return targets, nil + } + + targets, err := promTargets() + o.Expect(err).NotTo(o.HaveOccurred()) + // ref. https://github.com/openshift/origin/blob/f4d1c208855b7216452041276a7f909c3cf477ce/test/extended/prometheus/prometheus.go#L722 + err = targets.Expect(labels{"job": "cluster-version-operator"}, "up", "^https://.*/metrics$") + o.Expect(err).NotTo(o.HaveOccurred()) + + g.By("Setting up modern TLS profile and strict TLS adherence") + t := time.Now() + apiServer, err := configClient.APIServers().Get(ctx, tlsprofile.APIServerName, metav1.GetOptions{}) + o.Expect(err).NotTo(o.HaveOccurred()) + apiServer.Spec.TLSAdherence = configv1.TLSAdherencePolicyStrictAllComponents + apiServer.Spec.TLSSecurityProfile = &configv1.TLSSecurityProfile{ + Type: configv1.TLSProfileModernType, + Modern: &configv1.ModernTLSProfile{}, + } + + _, err = configClient.APIServers().Update(ctx, apiServer, metav1.UpdateOptions{}) + o.Expect(err).NotTo(o.HaveOccurred()) + needRecover = true + + g.By("Waiting for the cluster to stabilize") + // It takes too long in CI to wait until the cluster is stable + // co/authentication is about 5-8 mins + // co/openshift-apiserver is about 50 - 60 mins + if waitStable { + _, err = ocClient.AdmWaitForStableCluster("5m0s", "1h0m0s") + o.Expect(err).NotTo(o.HaveOccurred()) + } else { + logger.Info("Did not waiting for the cluster to stabilize after updating API server", "waitStable", waitStable) + } + + g.By("Checking if the CVO target is still up in Prometheus") + count := 1 + if !waitStable { + // checking 3 times in total; 30s once + count = 3 + } + for i := 0; i < count; i++ { + if !waitStable { + time.Sleep(30 * time.Second) + } + var errUp error + errWait := wait.PollUntilContextTimeout(context.Background(), 10*time.Second, 2*time.Minute, true, func(context.Context) (bool, error) { + targets, err = promTargets() + o.Expect(err).NotTo(o.HaveOccurred()) + errUp = targets.Expect(labels{"job": "cluster-version-operator"}, "up", "^https://.*/metrics$") + if errUp != nil { + logger.Error(errUp, "The CVO target is not up in Prometheus, retrying...", "count", i) + } + return errUp == nil, nil + }) + o.Expect(errWait).NotTo(o.HaveOccurred(), "The CVO target is not up in Prometheus with count=%d and errUp=%v", i, errUp) + logger.Info("The CVO target is still up in Prometheus", "count", i, "at", time.Now().Format(time.RFC3339)) + } + + g.By("Checking if CVO updates TLS profile") + podList, err := kubeClient.CoreV1().Pods(external.DefaultCVONamespace).List(ctx, metav1.ListOptions{ + LabelSelector: "k8s-app=cluster-version-operator", + }) + o.Expect(err).NotTo(o.HaveOccurred()) + + var podName string + for _, pod := range podList.Items { + podName = pod.Name + break + } + o.Expect(podName).NotTo(o.BeEmpty(), "Failed to find the CVO pod") + + req := kubeClient.CoreV1().Pods(external.DefaultCVONamespace).GetLogs(podName, &corev1.PodLogOptions{ + Follow: false, + Timestamps: true, + }) + + podStream, err := req.Stream(ctx) + o.Expect(err).NotTo(o.HaveOccurred()) + defer func() { + err := podStream.Close() + o.Expect(err).NotTo(o.HaveOccurred()) + }() + + buf := new(strings.Builder) + _, err = io.Copy(buf, podStream) + o.Expect(err).NotTo(o.HaveOccurred()) + + scanner := bufio.NewScanner(strings.NewReader(buf.String())) + var found bool + for scanner.Scan() { + line := scanner.Text() + if strings.Contains(line, tls.SyncedCachedTLSProfileLogKeyword) { + if timeInLog, logMessage, err := parseLogTimestamp(line); err == nil && timeInLog.After(t) { + logger.Info("Found log", "logMessage", logMessage, "timestamp", timeInLog.Format(time.RFC3339)) + found = true + break + } + + } + } + o.Expect(found).To(o.BeTrue(), "Failed to find logs about updating TCP profile when ShouldHonorClusterTLSProfile=%t after %s", + crypto.ShouldHonorClusterTLSProfile(apiServer.Spec.TLSAdherence), t.Format(time.RFC3339)) + }) +}) + +func parseLogTimestamp(logLine string) (time.Time, string, error) { + // 1. Split the line by the first space to separate the timestamp from the message + parts := strings.SplitN(logLine, " ", 2) + if len(parts) < 2 { + return time.Time{}, "", fmt.Errorf("invalid log format, no space separator found") + } + + timestampStr := parts[0] + logMessage := parts[1] + + // 2. Parse the timestamp using the RFC3339Nano layout + t, err := time.Parse(time.RFC3339Nano, timestampStr) + if err != nil { + // Fallback: Try standard RFC3339 if Nano fails for some reason + t, err = time.Parse(time.RFC3339, timestampStr) + if err != nil { + return time.Time{}, "", fmt.Errorf("failed to parse timestamp '%s': %w", timestampStr, err) + } + } + + return t, logMessage, nil +} diff --git a/test/oc/api/api.go b/test/oc/api/api.go index 050cbea148..3e6c995910 100644 --- a/test/oc/api/api.go +++ b/test/oc/api/api.go @@ -22,4 +22,8 @@ type Options struct { type OC interface { AdmReleaseExtract(o ReleaseExtractOptions) error Version(o VersionOptions) (string, error) + + // AdmWaitForStableCluster runs oc adm wait-for-stable-cluster + // Non-Empty minimumStablePeriod or timeout overrides the default value in the command + AdmWaitForStableCluster(minimumStablePeriod, timeout string) (string, error) } diff --git a/test/oc/cli/cli.go b/test/oc/cli/cli.go index 7e6d4509ee..56655d6ba3 100644 --- a/test/oc/cli/cli.go +++ b/test/oc/cli/cli.go @@ -98,3 +98,18 @@ func (c *client) Version(o api.VersionOptions) (string, error) { } return string(output), nil } + +func (c *client) AdmWaitForStableCluster(minimumStablePeriod, timeout string) (string, error) { + args := []string{"adm", "wait-for-stable-cluster"} + if minimumStablePeriod != "" { + args = append(args, fmt.Sprintf("--minimum-stable-period=%s", minimumStablePeriod)) + } + if timeout != "" { + args = append(args, fmt.Sprintf("--timeout=%s", timeout)) + } + output, err := c.executor.Run(args...) + if err != nil { + return "", err + } + return string(output), nil +} diff --git a/test/util/util.go b/test/util/util.go index 0ebfc395fd..8dce7321b4 100644 --- a/test/util/util.go +++ b/test/util/util.go @@ -3,13 +3,19 @@ package util import ( "bytes" "context" + "crypto/tls" "fmt" + "io" + "net/http" + "net/url" "strings" + "sync" "time" g "github.com/onsi/ginkgo/v2" o "github.com/onsi/gomega" + authenticationv1 "k8s.io/api/authentication/v1" corev1 "k8s.io/api/core/v1" apierrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -23,10 +29,14 @@ import ( configv1 "github.com/openshift/api/config/v1" clientconfigv1 "github.com/openshift/client-go/config/clientset/versioned" + configv1client "github.com/openshift/client-go/config/clientset/versioned/typed/config/v1" + routev1client "github.com/openshift/client-go/route/clientset/versioned" "github.com/openshift/cluster-version-operator/pkg/external" ) +var Logger = g.GinkgoLogr.WithName("cluster-version-operator-tests") + // IsHypershift checks if running on a HyperShift hosted cluster // Refer to https://github.com/openshift/origin/blob/31704414237b8bd5c66ad247c105c94abc9470b1/test/extended/util/framework.go#L2301 func IsHypershift(ctx context.Context, restConfig *rest.Config) (bool, error) { @@ -212,3 +222,119 @@ func SkipIfNetworkRestricted(ctx context.Context, restConfig *rest.Config, urls } return nil } + +var ( + controlPlaneTopology configv1.TopologyMode + controlPlaneMutex sync.Mutex +) + +// GetControlPlaneTopology retrieves the cluster infrastructure TopologyMode +// Ref. https://github.com/openshift/origin/blob/ca9ab3a7054e27ad63bd072344d7783b3ee42c18/test/extended/util/framework.go#L2125 +func GetControlPlaneTopology(ctx context.Context, configClient *configv1client.ConfigV1Client) (configv1.TopologyMode, error) { + controlPlaneMutex.Lock() + defer controlPlaneMutex.Unlock() + + if controlPlaneTopology == "" { + infra, err := configClient.Infrastructures().Get(ctx, "cluster", metav1.GetOptions{}) + if err != nil { + return "", fmt.Errorf("failure getting test cluster Infrastructure: %s", err.Error()) + } + controlPlaneTopology = infra.Status.ControlPlaneTopology + } + return controlPlaneTopology, nil +} + +// MustJoinUrlPath behaves like url.JoinPath but it will panic in case of error. +// Ref. https://github.com/openshift/origin/blob/301fda316591283a71882642977fa15af4da26dd/test/extended/util/prometheus/helpers.go#L446 +func MustJoinUrlPath(base string, paths ...string) string { + path, err := url.JoinPath(base, paths...) + if err != nil { + panic(err) + } + return path +} + +// PrometheusRouteURL returns the public url of the cluster prometheus service or an error if the route is not found. +// Ref. https://github.com/openshift/origin/blob/301fda316591283a71882642977fa15af4da26dd/test/extended/util/prometheus/helpers.go#L123 +func PrometheusRouteURL(ctx context.Context, routeClient *routev1client.Clientset) (string, error) { + rte, err := routeClient.RouteV1().Routes(namespaceOpenshiftMonitoring).Get(ctx, prometheusName, metav1.GetOptions{}) + if err != nil { + return "", fmt.Errorf("unable to get the %s route in the %s namespace: %w", prometheusName, namespaceOpenshiftMonitoring, err) + } + return "https://" + rte.Status.Ingress[0].Host, nil +} + +// RequestPrometheusServiceAccountAPIToken returns a time-bound (24hr) API token for the prometheus service account. +// Ref. https://github.com/openshift/origin/blob/301fda316591283a71882642977fa15af4da26dd/test/extended/util/prometheus/helpers.go#L141 +func RequestPrometheusServiceAccountAPIToken(ctx context.Context, kubeClient kubernetes.Interface) (string, error) { + expirationSeconds := int64(24 * time.Hour / time.Second) + req, err := kubeClient.CoreV1().ServiceAccounts(namespaceOpenshiftMonitoring).CreateToken(ctx, serviceAccountPrometheus, + &authenticationv1.TokenRequest{ + Spec: authenticationv1.TokenRequestSpec{ExpirationSeconds: &expirationSeconds}, + }, metav1.CreateOptions{}) + if err != nil { + return "", fmt.Errorf("unable to get an API token for the %s service account in the %s namespace: %w", serviceAccountPrometheus, namespaceOpenshiftMonitoring, err) + } + return req.Status.Token, nil +} + +const ( + namespaceOpenshiftMonitoring = "openshift-monitoring" + prometheusName = "prometheus-k8s" + serviceAccountPrometheus = prometheusName +) + +// GetURLWithToken makes an HTTP request with a bearer token. +// Ref. https://github.com/openshift/origin/blob/301fda316591283a71882642977fa15af4da26dd/test/extended/util/prometheus/helpers.go#L46 +func GetURLWithToken(url, bearerToken string) (string, error) { + client := &http.Client{ + Timeout: time.Duration(10 * time.Second), + Transport: &http.Transport{ + TLSClientConfig: &tls.Config{InsecureSkipVerify: true}, + // Use the HTTP proxy configured in the environment variables. + Proxy: http.ProxyFromEnvironment, + }, + } + + req, err := http.NewRequest("GET", url, nil) + if err != nil { + return "", fmt.Errorf("%s: %w", url, err) + } + + req.Header.Add("Authorization", "Bearer "+bearerToken) + + var ( + body []byte + lastErr error + ) + condition := func(ctx context.Context) (bool, error) { + resp, err := client.Do(req) + if err != nil { + lastErr = fmt.Errorf("%s: request failed: %w", url, err) + return false, nil + } + defer func() { + if err := resp.Body.Close(); err != nil { + Logger.Error(err, "failed to close response body") + } + }() + + if resp.StatusCode != http.StatusOK { + lastErr = fmt.Errorf("%s: unexpected status code: %d", url, resp.StatusCode) + return false, nil + } + + body, err = io.ReadAll(resp.Body) + if err != nil { + lastErr = fmt.Errorf("%s: failed to read response: %w", url, err) + return false, nil + } + + return true, nil + } + if err = wait.PollUntilContextTimeout(context.Background(), time.Second, time.Minute, true, condition); err != nil { + return "", fmt.Errorf("%w: %w", err, lastErr) + } + + return string(body), nil +} From 76f6514059336b9d3333671b5d23772350637b8e Mon Sep 17 00:00:00 2001 From: Hongkai Liu Date: Sat, 30 May 2026 23:24:20 -0400 Subject: [PATCH 2/5] go mod vendor --- .../applyconfigurations/internal/internal.go | 396 ++++++++++++++++++ .../route/v1/localobjectreference.go | 28 ++ .../applyconfigurations/route/v1/route.go | 303 ++++++++++++++ .../route/v1/routehttpheader.go | 42 ++ .../route/v1/routehttpheaderactions.go | 74 ++++ .../route/v1/routehttpheaderactionunion.go | 44 ++ .../route/v1/routehttpheaders.go | 49 +++ .../route/v1/routeingress.go | 76 ++++ .../route/v1/routeingresscondition.go | 76 ++++ .../applyconfigurations/route/v1/routeport.go | 32 ++ .../route/v1/routesethttpheader.go | 33 ++ .../applyconfigurations/route/v1/routespec.go | 150 +++++++ .../route/v1/routestatus.go | 34 ++ .../route/v1/routetargetreference.go | 48 +++ .../applyconfigurations/route/v1/tlsconfig.go | 118 ++++++ .../route/clientset/versioned/clientset.go | 104 +++++ .../route/clientset/versioned/scheme/doc.go | 4 + .../clientset/versioned/scheme/register.go | 40 ++ .../clientset/versioned/typed/route/v1/doc.go | 4 + .../typed/route/v1/generated_expansion.go | 5 + .../versioned/typed/route/v1/route.go | 58 +++ .../versioned/typed/route/v1/route_client.go | 85 ++++ vendor/modules.txt | 5 + 23 files changed, 1808 insertions(+) create mode 100644 vendor/github.com/openshift/client-go/route/applyconfigurations/internal/internal.go create mode 100644 vendor/github.com/openshift/client-go/route/applyconfigurations/route/v1/localobjectreference.go create mode 100644 vendor/github.com/openshift/client-go/route/applyconfigurations/route/v1/route.go create mode 100644 vendor/github.com/openshift/client-go/route/applyconfigurations/route/v1/routehttpheader.go create mode 100644 vendor/github.com/openshift/client-go/route/applyconfigurations/route/v1/routehttpheaderactions.go create mode 100644 vendor/github.com/openshift/client-go/route/applyconfigurations/route/v1/routehttpheaderactionunion.go create mode 100644 vendor/github.com/openshift/client-go/route/applyconfigurations/route/v1/routehttpheaders.go create mode 100644 vendor/github.com/openshift/client-go/route/applyconfigurations/route/v1/routeingress.go create mode 100644 vendor/github.com/openshift/client-go/route/applyconfigurations/route/v1/routeingresscondition.go create mode 100644 vendor/github.com/openshift/client-go/route/applyconfigurations/route/v1/routeport.go create mode 100644 vendor/github.com/openshift/client-go/route/applyconfigurations/route/v1/routesethttpheader.go create mode 100644 vendor/github.com/openshift/client-go/route/applyconfigurations/route/v1/routespec.go create mode 100644 vendor/github.com/openshift/client-go/route/applyconfigurations/route/v1/routestatus.go create mode 100644 vendor/github.com/openshift/client-go/route/applyconfigurations/route/v1/routetargetreference.go create mode 100644 vendor/github.com/openshift/client-go/route/applyconfigurations/route/v1/tlsconfig.go create mode 100644 vendor/github.com/openshift/client-go/route/clientset/versioned/clientset.go create mode 100644 vendor/github.com/openshift/client-go/route/clientset/versioned/scheme/doc.go create mode 100644 vendor/github.com/openshift/client-go/route/clientset/versioned/scheme/register.go create mode 100644 vendor/github.com/openshift/client-go/route/clientset/versioned/typed/route/v1/doc.go create mode 100644 vendor/github.com/openshift/client-go/route/clientset/versioned/typed/route/v1/generated_expansion.go create mode 100644 vendor/github.com/openshift/client-go/route/clientset/versioned/typed/route/v1/route.go create mode 100644 vendor/github.com/openshift/client-go/route/clientset/versioned/typed/route/v1/route_client.go diff --git a/vendor/github.com/openshift/client-go/route/applyconfigurations/internal/internal.go b/vendor/github.com/openshift/client-go/route/applyconfigurations/internal/internal.go new file mode 100644 index 0000000000..757d9d0b9b --- /dev/null +++ b/vendor/github.com/openshift/client-go/route/applyconfigurations/internal/internal.go @@ -0,0 +1,396 @@ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package internal + +import ( + fmt "fmt" + sync "sync" + + typed "sigs.k8s.io/structured-merge-diff/v6/typed" +) + +func Parser() *typed.Parser { + parserOnce.Do(func() { + var err error + parser, err = typed.NewParser(schemaYAML) + if err != nil { + panic(fmt.Sprintf("Failed to parse schema: %v", err)) + } + }) + return parser +} + +var parserOnce sync.Once +var parser *typed.Parser +var schemaYAML = typed.YAMLObject(`types: +- name: FieldsV1.v1.meta.apis.pkg.apimachinery.k8s.io + map: + elementType: + scalar: untyped + list: + elementType: + namedType: __untyped_atomic_ + elementRelationship: atomic + map: + elementType: + namedType: __untyped_deduced_ + elementRelationship: separable +- name: IntOrString.intstr.util.pkg.apimachinery.k8s.io + scalar: untyped +- name: ManagedFieldsEntry.v1.meta.apis.pkg.apimachinery.k8s.io + map: + fields: + - name: apiVersion + type: + scalar: string + - name: fieldsType + type: + scalar: string + - name: fieldsV1 + type: + namedType: FieldsV1.v1.meta.apis.pkg.apimachinery.k8s.io + - name: manager + type: + scalar: string + - name: operation + type: + scalar: string + - name: subresource + type: + scalar: string + - name: time + type: + namedType: Time.v1.meta.apis.pkg.apimachinery.k8s.io +- name: ObjectMeta.v1.meta.apis.pkg.apimachinery.k8s.io + map: + fields: + - name: annotations + type: + map: + elementType: + scalar: string + - name: creationTimestamp + type: + namedType: Time.v1.meta.apis.pkg.apimachinery.k8s.io + - name: deletionGracePeriodSeconds + type: + scalar: numeric + - name: deletionTimestamp + type: + namedType: Time.v1.meta.apis.pkg.apimachinery.k8s.io + - name: finalizers + type: + list: + elementType: + scalar: string + elementRelationship: associative + - name: generateName + type: + scalar: string + - name: generation + type: + scalar: numeric + - name: labels + type: + map: + elementType: + scalar: string + - name: managedFields + type: + list: + elementType: + namedType: ManagedFieldsEntry.v1.meta.apis.pkg.apimachinery.k8s.io + elementRelationship: atomic + - name: name + type: + scalar: string + - name: namespace + type: + scalar: string + - name: ownerReferences + type: + list: + elementType: + namedType: OwnerReference.v1.meta.apis.pkg.apimachinery.k8s.io + elementRelationship: associative + keys: + - uid + - name: resourceVersion + type: + scalar: string + - name: selfLink + type: + scalar: string + - name: uid + type: + scalar: string +- name: OwnerReference.v1.meta.apis.pkg.apimachinery.k8s.io + map: + fields: + - name: apiVersion + type: + scalar: string + default: "" + - name: blockOwnerDeletion + type: + scalar: boolean + - name: controller + type: + scalar: boolean + - name: kind + type: + scalar: string + default: "" + - name: name + type: + scalar: string + default: "" + - name: uid + type: + scalar: string + default: "" + elementRelationship: atomic +- name: Time.v1.meta.apis.pkg.apimachinery.k8s.io + scalar: untyped +- name: com.github.openshift.api.route.v1.LocalObjectReference + map: + fields: + - name: name + type: + scalar: string + elementRelationship: atomic +- name: com.github.openshift.api.route.v1.Route + map: + fields: + - name: apiVersion + type: + scalar: string + - name: kind + type: + scalar: string + - name: metadata + type: + namedType: ObjectMeta.v1.meta.apis.pkg.apimachinery.k8s.io + default: {} + - name: spec + type: + namedType: com.github.openshift.api.route.v1.RouteSpec + default: {} + - name: status + type: + namedType: com.github.openshift.api.route.v1.RouteStatus + default: {} +- name: com.github.openshift.api.route.v1.RouteHTTPHeader + map: + fields: + - name: action + type: + namedType: com.github.openshift.api.route.v1.RouteHTTPHeaderActionUnion + default: {} + - name: name + type: + scalar: string + default: "" +- name: com.github.openshift.api.route.v1.RouteHTTPHeaderActionUnion + map: + fields: + - name: set + type: + namedType: com.github.openshift.api.route.v1.RouteSetHTTPHeader + - name: type + type: + scalar: string + default: "" + unions: + - discriminator: type + fields: + - fieldName: set + discriminatorValue: Set +- name: com.github.openshift.api.route.v1.RouteHTTPHeaderActions + map: + fields: + - name: request + type: + list: + elementType: + namedType: com.github.openshift.api.route.v1.RouteHTTPHeader + elementRelationship: associative + keys: + - name + - name: response + type: + list: + elementType: + namedType: com.github.openshift.api.route.v1.RouteHTTPHeader + elementRelationship: associative + keys: + - name +- name: com.github.openshift.api.route.v1.RouteHTTPHeaders + map: + fields: + - name: actions + type: + namedType: com.github.openshift.api.route.v1.RouteHTTPHeaderActions + default: {} +- name: com.github.openshift.api.route.v1.RouteIngress + map: + fields: + - name: conditions + type: + list: + elementType: + namedType: com.github.openshift.api.route.v1.RouteIngressCondition + elementRelationship: associative + keys: + - type + - name: host + type: + scalar: string + - name: routerCanonicalHostname + type: + scalar: string + - name: routerName + type: + scalar: string + - name: wildcardPolicy + type: + scalar: string +- name: com.github.openshift.api.route.v1.RouteIngressCondition + map: + fields: + - name: lastTransitionTime + type: + namedType: Time.v1.meta.apis.pkg.apimachinery.k8s.io + - name: message + type: + scalar: string + - name: reason + type: + scalar: string + - name: status + type: + scalar: string + default: "" + - name: type + type: + scalar: string + default: "" +- name: com.github.openshift.api.route.v1.RoutePort + map: + fields: + - name: targetPort + type: + namedType: IntOrString.intstr.util.pkg.apimachinery.k8s.io +- name: com.github.openshift.api.route.v1.RouteSetHTTPHeader + map: + fields: + - name: value + type: + scalar: string + default: "" +- name: com.github.openshift.api.route.v1.RouteSpec + map: + fields: + - name: alternateBackends + type: + list: + elementType: + namedType: com.github.openshift.api.route.v1.RouteTargetReference + elementRelationship: associative + keys: + - name + - kind + - name: host + type: + scalar: string + - name: httpHeaders + type: + namedType: com.github.openshift.api.route.v1.RouteHTTPHeaders + - name: path + type: + scalar: string + - name: port + type: + namedType: com.github.openshift.api.route.v1.RoutePort + - name: subdomain + type: + scalar: string + - name: tls + type: + namedType: com.github.openshift.api.route.v1.TLSConfig + - name: to + type: + namedType: com.github.openshift.api.route.v1.RouteTargetReference + default: {} + - name: wildcardPolicy + type: + scalar: string +- name: com.github.openshift.api.route.v1.RouteStatus + map: + fields: + - name: ingress + type: + list: + elementType: + namedType: com.github.openshift.api.route.v1.RouteIngress + elementRelationship: atomic +- name: com.github.openshift.api.route.v1.RouteTargetReference + map: + fields: + - name: kind + type: + scalar: string + default: "" + - name: name + type: + scalar: string + default: "" + - name: weight + type: + scalar: numeric +- name: com.github.openshift.api.route.v1.TLSConfig + map: + fields: + - name: caCertificate + type: + scalar: string + - name: certificate + type: + scalar: string + - name: destinationCACertificate + type: + scalar: string + - name: externalCertificate + type: + namedType: com.github.openshift.api.route.v1.LocalObjectReference + - name: insecureEdgeTerminationPolicy + type: + scalar: string + - name: key + type: + scalar: string + - name: termination + type: + scalar: string + default: "" +- name: __untyped_atomic_ + scalar: untyped + list: + elementType: + namedType: __untyped_atomic_ + elementRelationship: atomic + map: + elementType: + namedType: __untyped_atomic_ + elementRelationship: atomic +- name: __untyped_deduced_ + scalar: untyped + list: + elementType: + namedType: __untyped_atomic_ + elementRelationship: atomic + map: + elementType: + namedType: __untyped_deduced_ + elementRelationship: separable +`) diff --git a/vendor/github.com/openshift/client-go/route/applyconfigurations/route/v1/localobjectreference.go b/vendor/github.com/openshift/client-go/route/applyconfigurations/route/v1/localobjectreference.go new file mode 100644 index 0000000000..dd26254300 --- /dev/null +++ b/vendor/github.com/openshift/client-go/route/applyconfigurations/route/v1/localobjectreference.go @@ -0,0 +1,28 @@ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1 + +// LocalObjectReferenceApplyConfiguration represents a declarative configuration of the LocalObjectReference type for use +// with apply. +// +// LocalObjectReference contains enough information to let you locate the +// referenced object inside the same namespace. +type LocalObjectReferenceApplyConfiguration struct { + // name of the referent. + // More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + Name *string `json:"name,omitempty"` +} + +// LocalObjectReferenceApplyConfiguration constructs a declarative configuration of the LocalObjectReference type for use with +// apply. +func LocalObjectReference() *LocalObjectReferenceApplyConfiguration { + return &LocalObjectReferenceApplyConfiguration{} +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *LocalObjectReferenceApplyConfiguration) WithName(value string) *LocalObjectReferenceApplyConfiguration { + b.Name = &value + return b +} diff --git a/vendor/github.com/openshift/client-go/route/applyconfigurations/route/v1/route.go b/vendor/github.com/openshift/client-go/route/applyconfigurations/route/v1/route.go new file mode 100644 index 0000000000..4cfbce5051 --- /dev/null +++ b/vendor/github.com/openshift/client-go/route/applyconfigurations/route/v1/route.go @@ -0,0 +1,303 @@ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1 + +import ( + routev1 "github.com/openshift/api/route/v1" + internal "github.com/openshift/client-go/route/applyconfigurations/internal" + apismetav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + managedfields "k8s.io/apimachinery/pkg/util/managedfields" + metav1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// RouteApplyConfiguration represents a declarative configuration of the Route type for use +// with apply. +// +// A route allows developers to expose services through an HTTP(S) aware load balancing and proxy +// layer via a public DNS entry. The route may further specify TLS options and a certificate, or +// specify a public CNAME that the router should also accept for HTTP and HTTPS traffic. An +// administrator typically configures their router to be visible outside the cluster firewall, and +// may also add additional security, caching, or traffic controls on the service content. Routers +// usually talk directly to the service endpoints. +// +// Once a route is created, the `host` field may not be changed. Generally, routers use the oldest +// route with a given host when resolving conflicts. +// +// Routers are subject to additional customization and may support additional controls via the +// annotations field. +// +// Because administrators may configure multiple routers, the route status field is used to +// return information to clients about the names and states of the route under each router. +// If a client chooses a duplicate name, for instance, the route status conditions are used +// to indicate the route cannot be chosen. +// +// To enable HTTP/2 ALPN on a route it requires a custom +// (non-wildcard) certificate. This prevents connection coalescing by +// clients, notably web browsers. We do not support HTTP/2 ALPN on +// routes that use the default certificate because of the risk of +// connection re-use/coalescing. Routes that do not have their own +// custom certificate will not be HTTP/2 ALPN-enabled on either the +// frontend or the backend. +// +// Compatibility level 1: Stable within a major release for a minimum of 12 months or 3 minor releases (whichever is longer). +type RouteApplyConfiguration struct { + metav1.TypeMetaApplyConfiguration `json:",inline"` + // metadata is the standard object's metadata. + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + *metav1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + // spec is the desired state of the route + Spec *RouteSpecApplyConfiguration `json:"spec,omitempty"` + // status is the current state of the route + Status *RouteStatusApplyConfiguration `json:"status,omitempty"` +} + +// Route constructs a declarative configuration of the Route type for use with +// apply. +func Route(name, namespace string) *RouteApplyConfiguration { + b := &RouteApplyConfiguration{} + b.WithName(name) + b.WithNamespace(namespace) + b.WithKind("Route") + b.WithAPIVersion("route.openshift.io/v1") + return b +} + +// ExtractRouteFrom extracts the applied configuration owned by fieldManager from +// route for the specified subresource. Pass an empty string for subresource to extract +// the main resource. Common subresources include "status", "scale", etc. +// route must be a unmodified Route API object that was retrieved from the Kubernetes API. +// ExtractRouteFrom provides a way to perform a extract/modify-in-place/apply workflow. +// Note that an extracted apply configuration will contain fewer fields than what the fieldManager previously +// applied if another fieldManager has updated or force applied any of the previously applied fields. +func ExtractRouteFrom(route *routev1.Route, fieldManager string, subresource string) (*RouteApplyConfiguration, error) { + b := &RouteApplyConfiguration{} + err := managedfields.ExtractInto(route, internal.Parser().Type("com.github.openshift.api.route.v1.Route"), fieldManager, b, subresource) + if err != nil { + return nil, err + } + b.WithName(route.Name) + b.WithNamespace(route.Namespace) + + b.WithKind("Route") + b.WithAPIVersion("route.openshift.io/v1") + return b, nil +} + +// ExtractRoute extracts the applied configuration owned by fieldManager from +// route. If no managedFields are found in route for fieldManager, a +// RouteApplyConfiguration is returned with only the Name, Namespace (if applicable), +// APIVersion and Kind populated. It is possible that no managed fields were found for because other +// field managers have taken ownership of all the fields previously owned by fieldManager, or because +// the fieldManager never owned fields any fields. +// route must be a unmodified Route API object that was retrieved from the Kubernetes API. +// ExtractRoute provides a way to perform a extract/modify-in-place/apply workflow. +// Note that an extracted apply configuration will contain fewer fields than what the fieldManager previously +// applied if another fieldManager has updated or force applied any of the previously applied fields. +func ExtractRoute(route *routev1.Route, fieldManager string) (*RouteApplyConfiguration, error) { + return ExtractRouteFrom(route, fieldManager, "") +} + +// ExtractRouteStatus extracts the applied configuration owned by fieldManager from +// route for the status subresource. +func ExtractRouteStatus(route *routev1.Route, fieldManager string) (*RouteApplyConfiguration, error) { + return ExtractRouteFrom(route, fieldManager, "status") +} + +func (b RouteApplyConfiguration) IsApplyConfiguration() {} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *RouteApplyConfiguration) WithKind(value string) *RouteApplyConfiguration { + b.TypeMetaApplyConfiguration.Kind = &value + return b +} + +// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIVersion field is set to the value of the last call. +func (b *RouteApplyConfiguration) WithAPIVersion(value string) *RouteApplyConfiguration { + b.TypeMetaApplyConfiguration.APIVersion = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *RouteApplyConfiguration) WithName(value string) *RouteApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.Name = &value + return b +} + +// WithGenerateName sets the GenerateName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GenerateName field is set to the value of the last call. +func (b *RouteApplyConfiguration) WithGenerateName(value string) *RouteApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *RouteApplyConfiguration) WithNamespace(value string) *RouteApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.Namespace = &value + return b +} + +// WithUID sets the UID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UID field is set to the value of the last call. +func (b *RouteApplyConfiguration) WithUID(value types.UID) *RouteApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceVersion field is set to the value of the last call. +func (b *RouteApplyConfiguration) WithResourceVersion(value string) *RouteApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Generation field is set to the value of the last call. +func (b *RouteApplyConfiguration) WithGeneration(value int64) *RouteApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CreationTimestamp field is set to the value of the last call. +func (b *RouteApplyConfiguration) WithCreationTimestamp(value apismetav1.Time) *RouteApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionTimestamp field is set to the value of the last call. +func (b *RouteApplyConfiguration) WithDeletionTimestamp(value apismetav1.Time) *RouteApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *RouteApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *RouteApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *RouteApplyConfiguration) WithLabels(entries map[string]string) *RouteApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.ObjectMetaApplyConfiguration.Labels == nil && len(entries) > 0 { + b.ObjectMetaApplyConfiguration.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.ObjectMetaApplyConfiguration.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *RouteApplyConfiguration) WithAnnotations(entries map[string]string) *RouteApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.ObjectMetaApplyConfiguration.Annotations == nil && len(entries) > 0 { + b.ObjectMetaApplyConfiguration.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.ObjectMetaApplyConfiguration.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OwnerReferences field. +func (b *RouteApplyConfiguration) WithOwnerReferences(values ...*metav1.OwnerReferenceApplyConfiguration) *RouteApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.ObjectMetaApplyConfiguration.OwnerReferences = append(b.ObjectMetaApplyConfiguration.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Finalizers field. +func (b *RouteApplyConfiguration) WithFinalizers(values ...string) *RouteApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.ObjectMetaApplyConfiguration.Finalizers = append(b.ObjectMetaApplyConfiguration.Finalizers, values[i]) + } + return b +} + +func (b *RouteApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &metav1.ObjectMetaApplyConfiguration{} + } +} + +// WithSpec sets the Spec field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Spec field is set to the value of the last call. +func (b *RouteApplyConfiguration) WithSpec(value *RouteSpecApplyConfiguration) *RouteApplyConfiguration { + b.Spec = value + return b +} + +// WithStatus sets the Status field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Status field is set to the value of the last call. +func (b *RouteApplyConfiguration) WithStatus(value *RouteStatusApplyConfiguration) *RouteApplyConfiguration { + b.Status = value + return b +} + +// GetKind retrieves the value of the Kind field in the declarative configuration. +func (b *RouteApplyConfiguration) GetKind() *string { + return b.TypeMetaApplyConfiguration.Kind +} + +// GetAPIVersion retrieves the value of the APIVersion field in the declarative configuration. +func (b *RouteApplyConfiguration) GetAPIVersion() *string { + return b.TypeMetaApplyConfiguration.APIVersion +} + +// GetName retrieves the value of the Name field in the declarative configuration. +func (b *RouteApplyConfiguration) GetName() *string { + b.ensureObjectMetaApplyConfigurationExists() + return b.ObjectMetaApplyConfiguration.Name +} + +// GetNamespace retrieves the value of the Namespace field in the declarative configuration. +func (b *RouteApplyConfiguration) GetNamespace() *string { + b.ensureObjectMetaApplyConfigurationExists() + return b.ObjectMetaApplyConfiguration.Namespace +} diff --git a/vendor/github.com/openshift/client-go/route/applyconfigurations/route/v1/routehttpheader.go b/vendor/github.com/openshift/client-go/route/applyconfigurations/route/v1/routehttpheader.go new file mode 100644 index 0000000000..e4754c9355 --- /dev/null +++ b/vendor/github.com/openshift/client-go/route/applyconfigurations/route/v1/routehttpheader.go @@ -0,0 +1,42 @@ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1 + +// RouteHTTPHeaderApplyConfiguration represents a declarative configuration of the RouteHTTPHeader type for use +// with apply. +// +// RouteHTTPHeader specifies configuration for setting or deleting an HTTP header. +type RouteHTTPHeaderApplyConfiguration struct { + // name specifies the name of a header on which to perform an action. Its value must be a valid HTTP header + // name as defined in RFC 2616 section 4.2. + // The name must consist only of alphanumeric and the following special characters, "-!#$%&'*+.^_`". + // The following header names are reserved and may not be modified via this API: + // Strict-Transport-Security, Proxy, Cookie, Set-Cookie. + // It must be no more than 255 characters in length. + // Header name must be unique. + Name *string `json:"name,omitempty"` + // action specifies actions to perform on headers, such as setting or deleting headers. + Action *RouteHTTPHeaderActionUnionApplyConfiguration `json:"action,omitempty"` +} + +// RouteHTTPHeaderApplyConfiguration constructs a declarative configuration of the RouteHTTPHeader type for use with +// apply. +func RouteHTTPHeader() *RouteHTTPHeaderApplyConfiguration { + return &RouteHTTPHeaderApplyConfiguration{} +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *RouteHTTPHeaderApplyConfiguration) WithName(value string) *RouteHTTPHeaderApplyConfiguration { + b.Name = &value + return b +} + +// WithAction sets the Action field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Action field is set to the value of the last call. +func (b *RouteHTTPHeaderApplyConfiguration) WithAction(value *RouteHTTPHeaderActionUnionApplyConfiguration) *RouteHTTPHeaderApplyConfiguration { + b.Action = value + return b +} diff --git a/vendor/github.com/openshift/client-go/route/applyconfigurations/route/v1/routehttpheaderactions.go b/vendor/github.com/openshift/client-go/route/applyconfigurations/route/v1/routehttpheaderactions.go new file mode 100644 index 0000000000..e19652cd22 --- /dev/null +++ b/vendor/github.com/openshift/client-go/route/applyconfigurations/route/v1/routehttpheaderactions.go @@ -0,0 +1,74 @@ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1 + +// RouteHTTPHeaderActionsApplyConfiguration represents a declarative configuration of the RouteHTTPHeaderActions type for use +// with apply. +// +// RouteHTTPHeaderActions defines configuration for actions on HTTP request and response headers. +type RouteHTTPHeaderActionsApplyConfiguration struct { + // response is a list of HTTP response headers to modify. + // Currently, actions may define to either `Set` or `Delete` headers values. + // Actions defined here will modify the response headers of all requests made through a route. + // These actions are applied to a specific Route defined within a cluster i.e. connections made through a route. + // Route actions will be executed before IngressController actions for response headers. + // Actions are applied in sequence as defined in this list. + // A maximum of 20 response header actions may be configured. + // You can use this field to specify HTTP response headers that should be set or deleted + // when forwarding responses from your application to the client. + // Sample fetchers allowed are "res.hdr" and "ssl_c_der". + // Converters allowed are "lower" and "base64". + // Example header values: "%[res.hdr(X-target),lower]", "%{+Q}[ssl_c_der,base64]". + // Note: This field cannot be used if your route uses TLS passthrough. + Response []RouteHTTPHeaderApplyConfiguration `json:"response,omitempty"` + // request is a list of HTTP request headers to modify. + // Currently, actions may define to either `Set` or `Delete` headers values. + // Actions defined here will modify the request headers of all requests made through a route. + // These actions are applied to a specific Route defined within a cluster i.e. connections made through a route. + // Currently, actions may define to either `Set` or `Delete` headers values. + // Route actions will be executed after IngressController actions for request headers. + // Actions are applied in sequence as defined in this list. + // A maximum of 20 request header actions may be configured. + // You can use this field to specify HTTP request headers that should be set or deleted + // when forwarding connections from the client to your application. + // Sample fetchers allowed are "req.hdr" and "ssl_c_der". + // Converters allowed are "lower" and "base64". + // Example header values: "%[req.hdr(X-target),lower]", "%{+Q}[ssl_c_der,base64]". + // Any request header configuration applied directly via a Route resource using this API + // will override header configuration for a header of the same name applied via + // spec.httpHeaders.actions on the IngressController or route annotation. + // Note: This field cannot be used if your route uses TLS passthrough. + Request []RouteHTTPHeaderApplyConfiguration `json:"request,omitempty"` +} + +// RouteHTTPHeaderActionsApplyConfiguration constructs a declarative configuration of the RouteHTTPHeaderActions type for use with +// apply. +func RouteHTTPHeaderActions() *RouteHTTPHeaderActionsApplyConfiguration { + return &RouteHTTPHeaderActionsApplyConfiguration{} +} + +// WithResponse adds the given value to the Response field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Response field. +func (b *RouteHTTPHeaderActionsApplyConfiguration) WithResponse(values ...*RouteHTTPHeaderApplyConfiguration) *RouteHTTPHeaderActionsApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithResponse") + } + b.Response = append(b.Response, *values[i]) + } + return b +} + +// WithRequest adds the given value to the Request field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Request field. +func (b *RouteHTTPHeaderActionsApplyConfiguration) WithRequest(values ...*RouteHTTPHeaderApplyConfiguration) *RouteHTTPHeaderActionsApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithRequest") + } + b.Request = append(b.Request, *values[i]) + } + return b +} diff --git a/vendor/github.com/openshift/client-go/route/applyconfigurations/route/v1/routehttpheaderactionunion.go b/vendor/github.com/openshift/client-go/route/applyconfigurations/route/v1/routehttpheaderactionunion.go new file mode 100644 index 0000000000..822bc3056d --- /dev/null +++ b/vendor/github.com/openshift/client-go/route/applyconfigurations/route/v1/routehttpheaderactionunion.go @@ -0,0 +1,44 @@ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1 + +import ( + routev1 "github.com/openshift/api/route/v1" +) + +// RouteHTTPHeaderActionUnionApplyConfiguration represents a declarative configuration of the RouteHTTPHeaderActionUnion type for use +// with apply. +// +// RouteHTTPHeaderActionUnion specifies an action to take on an HTTP header. +type RouteHTTPHeaderActionUnionApplyConfiguration struct { + // type defines the type of the action to be applied on the header. + // Possible values are Set or Delete. + // Set allows you to set HTTP request and response headers. + // Delete allows you to delete HTTP request and response headers. + Type *routev1.RouteHTTPHeaderActionType `json:"type,omitempty"` + // set defines the HTTP header that should be set: added if it doesn't exist or replaced if it does. + // This field is required when type is Set and forbidden otherwise. + Set *RouteSetHTTPHeaderApplyConfiguration `json:"set,omitempty"` +} + +// RouteHTTPHeaderActionUnionApplyConfiguration constructs a declarative configuration of the RouteHTTPHeaderActionUnion type for use with +// apply. +func RouteHTTPHeaderActionUnion() *RouteHTTPHeaderActionUnionApplyConfiguration { + return &RouteHTTPHeaderActionUnionApplyConfiguration{} +} + +// WithType sets the Type field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Type field is set to the value of the last call. +func (b *RouteHTTPHeaderActionUnionApplyConfiguration) WithType(value routev1.RouteHTTPHeaderActionType) *RouteHTTPHeaderActionUnionApplyConfiguration { + b.Type = &value + return b +} + +// WithSet sets the Set field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Set field is set to the value of the last call. +func (b *RouteHTTPHeaderActionUnionApplyConfiguration) WithSet(value *RouteSetHTTPHeaderApplyConfiguration) *RouteHTTPHeaderActionUnionApplyConfiguration { + b.Set = value + return b +} diff --git a/vendor/github.com/openshift/client-go/route/applyconfigurations/route/v1/routehttpheaders.go b/vendor/github.com/openshift/client-go/route/applyconfigurations/route/v1/routehttpheaders.go new file mode 100644 index 0000000000..7cff1dfeee --- /dev/null +++ b/vendor/github.com/openshift/client-go/route/applyconfigurations/route/v1/routehttpheaders.go @@ -0,0 +1,49 @@ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1 + +// RouteHTTPHeadersApplyConfiguration represents a declarative configuration of the RouteHTTPHeaders type for use +// with apply. +// +// RouteHTTPHeaders defines policy for HTTP headers. +type RouteHTTPHeadersApplyConfiguration struct { + // actions specifies options for modifying headers and their values. + // Note that this option only applies to cleartext HTTP connections + // and to secure HTTP connections for which the ingress controller + // terminates encryption (that is, edge-terminated or reencrypt + // connections). Headers cannot be modified for TLS passthrough + // connections. + // Setting the HSTS (`Strict-Transport-Security`) header is not supported via actions. + // `Strict-Transport-Security` may only be configured using the "haproxy.router.openshift.io/hsts_header" + // route annotation, and only in accordance with the policy specified in Ingress.Spec.RequiredHSTSPolicies. + // In case of HTTP request headers, the actions specified in spec.httpHeaders.actions on the Route will be executed after + // the actions specified in the IngressController's spec.httpHeaders.actions field. + // In case of HTTP response headers, the actions specified in spec.httpHeaders.actions on the IngressController will be + // executed after the actions specified in the Route's spec.httpHeaders.actions field. + // The headers set via this API will not appear in access logs. + // Any actions defined here are applied after any actions related to the following other fields: + // cache-control, spec.clientTLS, + // spec.httpHeaders.forwardedHeaderPolicy, spec.httpHeaders.uniqueId, + // and spec.httpHeaders.headerNameCaseAdjustments. + // The following header names are reserved and may not be modified via this API: + // Strict-Transport-Security, Proxy, Cookie, Set-Cookie. + // Note that the total size of all net added headers *after* interpolating dynamic values + // must not exceed the value of spec.tuningOptions.headerBufferMaxRewriteBytes on the + // IngressController. Please refer to the documentation + // for that API field for more details. + Actions *RouteHTTPHeaderActionsApplyConfiguration `json:"actions,omitempty"` +} + +// RouteHTTPHeadersApplyConfiguration constructs a declarative configuration of the RouteHTTPHeaders type for use with +// apply. +func RouteHTTPHeaders() *RouteHTTPHeadersApplyConfiguration { + return &RouteHTTPHeadersApplyConfiguration{} +} + +// WithActions sets the Actions field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Actions field is set to the value of the last call. +func (b *RouteHTTPHeadersApplyConfiguration) WithActions(value *RouteHTTPHeaderActionsApplyConfiguration) *RouteHTTPHeadersApplyConfiguration { + b.Actions = value + return b +} diff --git a/vendor/github.com/openshift/client-go/route/applyconfigurations/route/v1/routeingress.go b/vendor/github.com/openshift/client-go/route/applyconfigurations/route/v1/routeingress.go new file mode 100644 index 0000000000..15932cbd97 --- /dev/null +++ b/vendor/github.com/openshift/client-go/route/applyconfigurations/route/v1/routeingress.go @@ -0,0 +1,76 @@ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1 + +import ( + routev1 "github.com/openshift/api/route/v1" +) + +// RouteIngressApplyConfiguration represents a declarative configuration of the RouteIngress type for use +// with apply. +// +// RouteIngress holds information about the places where a route is exposed. +type RouteIngressApplyConfiguration struct { + // host is the host string under which the route is exposed; this value is required + Host *string `json:"host,omitempty"` + // Name is a name chosen by the router to identify itself; this value is required + RouterName *string `json:"routerName,omitempty"` + // conditions is the state of the route, may be empty. + Conditions []RouteIngressConditionApplyConfiguration `json:"conditions,omitempty"` + // Wildcard policy is the wildcard policy that was allowed where this route is exposed. + WildcardPolicy *routev1.WildcardPolicyType `json:"wildcardPolicy,omitempty"` + // CanonicalHostname is the external host name for the router that can be used as a CNAME + // for the host requested for this route. This value is optional and may not be set in all cases. + RouterCanonicalHostname *string `json:"routerCanonicalHostname,omitempty"` +} + +// RouteIngressApplyConfiguration constructs a declarative configuration of the RouteIngress type for use with +// apply. +func RouteIngress() *RouteIngressApplyConfiguration { + return &RouteIngressApplyConfiguration{} +} + +// WithHost sets the Host field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Host field is set to the value of the last call. +func (b *RouteIngressApplyConfiguration) WithHost(value string) *RouteIngressApplyConfiguration { + b.Host = &value + return b +} + +// WithRouterName sets the RouterName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the RouterName field is set to the value of the last call. +func (b *RouteIngressApplyConfiguration) WithRouterName(value string) *RouteIngressApplyConfiguration { + b.RouterName = &value + return b +} + +// WithConditions adds the given value to the Conditions field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Conditions field. +func (b *RouteIngressApplyConfiguration) WithConditions(values ...*RouteIngressConditionApplyConfiguration) *RouteIngressApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithConditions") + } + b.Conditions = append(b.Conditions, *values[i]) + } + return b +} + +// WithWildcardPolicy sets the WildcardPolicy field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the WildcardPolicy field is set to the value of the last call. +func (b *RouteIngressApplyConfiguration) WithWildcardPolicy(value routev1.WildcardPolicyType) *RouteIngressApplyConfiguration { + b.WildcardPolicy = &value + return b +} + +// WithRouterCanonicalHostname sets the RouterCanonicalHostname field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the RouterCanonicalHostname field is set to the value of the last call. +func (b *RouteIngressApplyConfiguration) WithRouterCanonicalHostname(value string) *RouteIngressApplyConfiguration { + b.RouterCanonicalHostname = &value + return b +} diff --git a/vendor/github.com/openshift/client-go/route/applyconfigurations/route/v1/routeingresscondition.go b/vendor/github.com/openshift/client-go/route/applyconfigurations/route/v1/routeingresscondition.go new file mode 100644 index 0000000000..a895dc9483 --- /dev/null +++ b/vendor/github.com/openshift/client-go/route/applyconfigurations/route/v1/routeingresscondition.go @@ -0,0 +1,76 @@ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1 + +import ( + routev1 "github.com/openshift/api/route/v1" + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// RouteIngressConditionApplyConfiguration represents a declarative configuration of the RouteIngressCondition type for use +// with apply. +// +// RouteIngressCondition contains details for the current condition of this route on a particular +// router. +type RouteIngressConditionApplyConfiguration struct { + // type is the type of the condition. + // Currently only Admitted or UnservableInFutureVersions. + Type *routev1.RouteIngressConditionType `json:"type,omitempty"` + // status is the status of the condition. + // Can be True, False, Unknown. + Status *corev1.ConditionStatus `json:"status,omitempty"` + // (brief) reason for the condition's last transition, and is usually a machine and human + // readable constant + Reason *string `json:"reason,omitempty"` + // Human readable message indicating details about last transition. + Message *string `json:"message,omitempty"` + // RFC 3339 date and time when this condition last transitioned + LastTransitionTime *metav1.Time `json:"lastTransitionTime,omitempty"` +} + +// RouteIngressConditionApplyConfiguration constructs a declarative configuration of the RouteIngressCondition type for use with +// apply. +func RouteIngressCondition() *RouteIngressConditionApplyConfiguration { + return &RouteIngressConditionApplyConfiguration{} +} + +// WithType sets the Type field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Type field is set to the value of the last call. +func (b *RouteIngressConditionApplyConfiguration) WithType(value routev1.RouteIngressConditionType) *RouteIngressConditionApplyConfiguration { + b.Type = &value + return b +} + +// WithStatus sets the Status field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Status field is set to the value of the last call. +func (b *RouteIngressConditionApplyConfiguration) WithStatus(value corev1.ConditionStatus) *RouteIngressConditionApplyConfiguration { + b.Status = &value + return b +} + +// WithReason sets the Reason field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Reason field is set to the value of the last call. +func (b *RouteIngressConditionApplyConfiguration) WithReason(value string) *RouteIngressConditionApplyConfiguration { + b.Reason = &value + return b +} + +// WithMessage sets the Message field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Message field is set to the value of the last call. +func (b *RouteIngressConditionApplyConfiguration) WithMessage(value string) *RouteIngressConditionApplyConfiguration { + b.Message = &value + return b +} + +// WithLastTransitionTime sets the LastTransitionTime field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the LastTransitionTime field is set to the value of the last call. +func (b *RouteIngressConditionApplyConfiguration) WithLastTransitionTime(value metav1.Time) *RouteIngressConditionApplyConfiguration { + b.LastTransitionTime = &value + return b +} diff --git a/vendor/github.com/openshift/client-go/route/applyconfigurations/route/v1/routeport.go b/vendor/github.com/openshift/client-go/route/applyconfigurations/route/v1/routeport.go new file mode 100644 index 0000000000..b14b396255 --- /dev/null +++ b/vendor/github.com/openshift/client-go/route/applyconfigurations/route/v1/routeport.go @@ -0,0 +1,32 @@ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1 + +import ( + intstr "k8s.io/apimachinery/pkg/util/intstr" +) + +// RoutePortApplyConfiguration represents a declarative configuration of the RoutePort type for use +// with apply. +// +// RoutePort defines a port mapping from a router to an endpoint in the service endpoints. +type RoutePortApplyConfiguration struct { + // The target port on pods selected by the service this route points to. + // If this is a string, it will be looked up as a named port in the target + // endpoints port list. Required + TargetPort *intstr.IntOrString `json:"targetPort,omitempty"` +} + +// RoutePortApplyConfiguration constructs a declarative configuration of the RoutePort type for use with +// apply. +func RoutePort() *RoutePortApplyConfiguration { + return &RoutePortApplyConfiguration{} +} + +// WithTargetPort sets the TargetPort field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the TargetPort field is set to the value of the last call. +func (b *RoutePortApplyConfiguration) WithTargetPort(value intstr.IntOrString) *RoutePortApplyConfiguration { + b.TargetPort = &value + return b +} diff --git a/vendor/github.com/openshift/client-go/route/applyconfigurations/route/v1/routesethttpheader.go b/vendor/github.com/openshift/client-go/route/applyconfigurations/route/v1/routesethttpheader.go new file mode 100644 index 0000000000..2e26ebb3f7 --- /dev/null +++ b/vendor/github.com/openshift/client-go/route/applyconfigurations/route/v1/routesethttpheader.go @@ -0,0 +1,33 @@ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1 + +// RouteSetHTTPHeaderApplyConfiguration represents a declarative configuration of the RouteSetHTTPHeader type for use +// with apply. +// +// RouteSetHTTPHeader specifies what value needs to be set on an HTTP header. +type RouteSetHTTPHeaderApplyConfiguration struct { + // value specifies a header value. + // Dynamic values can be added. The value will be interpreted as an HAProxy format string as defined in + // http://cbonte.github.io/haproxy-dconv/2.6/configuration.html#8.2.6 and may use HAProxy's %[] syntax and + // otherwise must be a valid HTTP header value as defined in https://datatracker.ietf.org/doc/html/rfc7230#section-3.2. + // The value of this field must be no more than 16384 characters in length. + // Note that the total size of all net added headers *after* interpolating dynamic values + // must not exceed the value of spec.tuningOptions.headerBufferMaxRewriteBytes on the + // IngressController. + Value *string `json:"value,omitempty"` +} + +// RouteSetHTTPHeaderApplyConfiguration constructs a declarative configuration of the RouteSetHTTPHeader type for use with +// apply. +func RouteSetHTTPHeader() *RouteSetHTTPHeaderApplyConfiguration { + return &RouteSetHTTPHeaderApplyConfiguration{} +} + +// WithValue sets the Value field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Value field is set to the value of the last call. +func (b *RouteSetHTTPHeaderApplyConfiguration) WithValue(value string) *RouteSetHTTPHeaderApplyConfiguration { + b.Value = &value + return b +} diff --git a/vendor/github.com/openshift/client-go/route/applyconfigurations/route/v1/routespec.go b/vendor/github.com/openshift/client-go/route/applyconfigurations/route/v1/routespec.go new file mode 100644 index 0000000000..d26dc02624 --- /dev/null +++ b/vendor/github.com/openshift/client-go/route/applyconfigurations/route/v1/routespec.go @@ -0,0 +1,150 @@ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1 + +import ( + routev1 "github.com/openshift/api/route/v1" +) + +// RouteSpecApplyConfiguration represents a declarative configuration of the RouteSpec type for use +// with apply. +// +// RouteSpec describes the hostname or path the route exposes, any security information, +// and one to four backends (services) the route points to. Requests are distributed +// among the backends depending on the weights assigned to each backend. When using +// roundrobin scheduling the portion of requests that go to each backend is the backend +// weight divided by the sum of all of the backend weights. When the backend has more than +// one endpoint the requests that end up on the backend are roundrobin distributed among +// the endpoints. Weights are between 0 and 256 with default 100. Weight 0 causes no requests +// to the backend. If all weights are zero the route will be considered to have no backends +// and return a standard 503 response. +// +// The `tls` field is optional and allows specific certificates or behavior for the +// route. Routers typically configure a default certificate on a wildcard domain to +// terminate routes without explicit certificates, but custom hostnames usually must +// choose passthrough (send traffic directly to the backend via the TLS Server-Name- +// Indication field) or provide a certificate. +type RouteSpecApplyConfiguration struct { + // host is an alias/DNS that points to the service. Optional. + // If not specified a route name will typically be automatically + // chosen. + // Must follow DNS952 subdomain conventions. + Host *string `json:"host,omitempty"` + // subdomain is a DNS subdomain that is requested within the ingress controller's + // domain (as a subdomain). If host is set this field is ignored. An ingress + // controller may choose to ignore this suggested name, in which case the controller + // will report the assigned name in the status.ingress array or refuse to admit the + // route. If this value is set and the server does not support this field host will + // be populated automatically. Otherwise host is left empty. The field may have + // multiple parts separated by a dot, but not all ingress controllers may honor + // the request. This field may not be changed after creation except by a user with + // the update routes/custom-host permission. + // + // Example: subdomain `frontend` automatically receives the router subdomain + // `apps.mycluster.com` to have a full hostname `frontend.apps.mycluster.com`. + Subdomain *string `json:"subdomain,omitempty"` + // path that the router watches for, to route traffic for to the service. Optional + Path *string `json:"path,omitempty"` + // to is an object the route should use as the primary backend. Only the Service kind + // is allowed, and it will be defaulted to Service. If the weight field (0-256 default 100) + // is set to zero, no traffic will be sent to this backend. + To *RouteTargetReferenceApplyConfiguration `json:"to,omitempty"` + // alternateBackends allows up to 3 additional backends to be assigned to the route. + // Only the Service kind is allowed, and it will be defaulted to Service. + // Use the weight field in RouteTargetReference object to specify relative preference. + AlternateBackends []RouteTargetReferenceApplyConfiguration `json:"alternateBackends,omitempty"` + // If specified, the port to be used by the router. Most routers will use all + // endpoints exposed by the service by default - set this value to instruct routers + // which port to use. + Port *RoutePortApplyConfiguration `json:"port,omitempty"` + // The tls field provides the ability to configure certificates and termination for the route. + TLS *TLSConfigApplyConfiguration `json:"tls,omitempty"` + // Wildcard policy if any for the route. + // Currently only 'Subdomain' or 'None' is allowed. + WildcardPolicy *routev1.WildcardPolicyType `json:"wildcardPolicy,omitempty"` + // httpHeaders defines policy for HTTP headers. + HTTPHeaders *RouteHTTPHeadersApplyConfiguration `json:"httpHeaders,omitempty"` +} + +// RouteSpecApplyConfiguration constructs a declarative configuration of the RouteSpec type for use with +// apply. +func RouteSpec() *RouteSpecApplyConfiguration { + return &RouteSpecApplyConfiguration{} +} + +// WithHost sets the Host field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Host field is set to the value of the last call. +func (b *RouteSpecApplyConfiguration) WithHost(value string) *RouteSpecApplyConfiguration { + b.Host = &value + return b +} + +// WithSubdomain sets the Subdomain field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Subdomain field is set to the value of the last call. +func (b *RouteSpecApplyConfiguration) WithSubdomain(value string) *RouteSpecApplyConfiguration { + b.Subdomain = &value + return b +} + +// WithPath sets the Path field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Path field is set to the value of the last call. +func (b *RouteSpecApplyConfiguration) WithPath(value string) *RouteSpecApplyConfiguration { + b.Path = &value + return b +} + +// WithTo sets the To field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the To field is set to the value of the last call. +func (b *RouteSpecApplyConfiguration) WithTo(value *RouteTargetReferenceApplyConfiguration) *RouteSpecApplyConfiguration { + b.To = value + return b +} + +// WithAlternateBackends adds the given value to the AlternateBackends field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the AlternateBackends field. +func (b *RouteSpecApplyConfiguration) WithAlternateBackends(values ...*RouteTargetReferenceApplyConfiguration) *RouteSpecApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithAlternateBackends") + } + b.AlternateBackends = append(b.AlternateBackends, *values[i]) + } + return b +} + +// WithPort sets the Port field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Port field is set to the value of the last call. +func (b *RouteSpecApplyConfiguration) WithPort(value *RoutePortApplyConfiguration) *RouteSpecApplyConfiguration { + b.Port = value + return b +} + +// WithTLS sets the TLS field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the TLS field is set to the value of the last call. +func (b *RouteSpecApplyConfiguration) WithTLS(value *TLSConfigApplyConfiguration) *RouteSpecApplyConfiguration { + b.TLS = value + return b +} + +// WithWildcardPolicy sets the WildcardPolicy field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the WildcardPolicy field is set to the value of the last call. +func (b *RouteSpecApplyConfiguration) WithWildcardPolicy(value routev1.WildcardPolicyType) *RouteSpecApplyConfiguration { + b.WildcardPolicy = &value + return b +} + +// WithHTTPHeaders sets the HTTPHeaders field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the HTTPHeaders field is set to the value of the last call. +func (b *RouteSpecApplyConfiguration) WithHTTPHeaders(value *RouteHTTPHeadersApplyConfiguration) *RouteSpecApplyConfiguration { + b.HTTPHeaders = value + return b +} diff --git a/vendor/github.com/openshift/client-go/route/applyconfigurations/route/v1/routestatus.go b/vendor/github.com/openshift/client-go/route/applyconfigurations/route/v1/routestatus.go new file mode 100644 index 0000000000..a1d77a1951 --- /dev/null +++ b/vendor/github.com/openshift/client-go/route/applyconfigurations/route/v1/routestatus.go @@ -0,0 +1,34 @@ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1 + +// RouteStatusApplyConfiguration represents a declarative configuration of the RouteStatus type for use +// with apply. +// +// RouteStatus provides relevant info about the status of a route, including which routers +// acknowledge it. +type RouteStatusApplyConfiguration struct { + // ingress describes the places where the route may be exposed. The list of + // ingress points may contain duplicate Host or RouterName values. Routes + // are considered live once they are `Ready` + Ingress []RouteIngressApplyConfiguration `json:"ingress,omitempty"` +} + +// RouteStatusApplyConfiguration constructs a declarative configuration of the RouteStatus type for use with +// apply. +func RouteStatus() *RouteStatusApplyConfiguration { + return &RouteStatusApplyConfiguration{} +} + +// WithIngress adds the given value to the Ingress field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Ingress field. +func (b *RouteStatusApplyConfiguration) WithIngress(values ...*RouteIngressApplyConfiguration) *RouteStatusApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithIngress") + } + b.Ingress = append(b.Ingress, *values[i]) + } + return b +} diff --git a/vendor/github.com/openshift/client-go/route/applyconfigurations/route/v1/routetargetreference.go b/vendor/github.com/openshift/client-go/route/applyconfigurations/route/v1/routetargetreference.go new file mode 100644 index 0000000000..affbe2ac49 --- /dev/null +++ b/vendor/github.com/openshift/client-go/route/applyconfigurations/route/v1/routetargetreference.go @@ -0,0 +1,48 @@ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1 + +// RouteTargetReferenceApplyConfiguration represents a declarative configuration of the RouteTargetReference type for use +// with apply. +// +// RouteTargetReference specifies the target that resolve into endpoints. Only the 'Service' +// kind is allowed. Use 'weight' field to emphasize one over others. +type RouteTargetReferenceApplyConfiguration struct { + // The kind of target that the route is referring to. Currently, only 'Service' is allowed + Kind *string `json:"kind,omitempty"` + // name of the service/target that is being referred to. e.g. name of the service + Name *string `json:"name,omitempty"` + // weight as an integer between 0 and 256, default 100, that specifies the target's relative weight + // against other target reference objects. 0 suppresses requests to this backend. + Weight *int32 `json:"weight,omitempty"` +} + +// RouteTargetReferenceApplyConfiguration constructs a declarative configuration of the RouteTargetReference type for use with +// apply. +func RouteTargetReference() *RouteTargetReferenceApplyConfiguration { + return &RouteTargetReferenceApplyConfiguration{} +} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *RouteTargetReferenceApplyConfiguration) WithKind(value string) *RouteTargetReferenceApplyConfiguration { + b.Kind = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *RouteTargetReferenceApplyConfiguration) WithName(value string) *RouteTargetReferenceApplyConfiguration { + b.Name = &value + return b +} + +// WithWeight sets the Weight field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Weight field is set to the value of the last call. +func (b *RouteTargetReferenceApplyConfiguration) WithWeight(value int32) *RouteTargetReferenceApplyConfiguration { + b.Weight = &value + return b +} diff --git a/vendor/github.com/openshift/client-go/route/applyconfigurations/route/v1/tlsconfig.go b/vendor/github.com/openshift/client-go/route/applyconfigurations/route/v1/tlsconfig.go new file mode 100644 index 0000000000..4cc66b2cc0 --- /dev/null +++ b/vendor/github.com/openshift/client-go/route/applyconfigurations/route/v1/tlsconfig.go @@ -0,0 +1,118 @@ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1 + +import ( + routev1 "github.com/openshift/api/route/v1" +) + +// TLSConfigApplyConfiguration represents a declarative configuration of the TLSConfig type for use +// with apply. +// +// TLSConfig defines config used to secure a route and provide termination +type TLSConfigApplyConfiguration struct { + // termination indicates the TLS termination type. + // + // * edge - TLS termination is done by the router and http is used to communicate with the backend (default) + // + // * passthrough - Traffic is sent straight to the destination without the router providing TLS termination + // + // * reencrypt - TLS termination is done by the router and https is used to communicate with the backend + // + // Note: passthrough termination is incompatible with httpHeader actions + Termination *routev1.TLSTerminationType `json:"termination,omitempty"` + // certificate provides certificate contents. This should be a single serving certificate, not a certificate + // chain. Do not include a CA certificate. + Certificate *string `json:"certificate,omitempty"` + // key provides key file contents + Key *string `json:"key,omitempty"` + // caCertificate provides the cert authority certificate contents + CACertificate *string `json:"caCertificate,omitempty"` + // destinationCACertificate provides the contents of the ca certificate of the final destination. When using reencrypt + // termination this file should be provided in order to have routers use it for health checks on the secure connection. + // If this field is not specified, the router may provide its own destination CA and perform hostname validation using + // the short service name (service.namespace.svc), which allows infrastructure generated certificates to automatically + // verify. + DestinationCACertificate *string `json:"destinationCACertificate,omitempty"` + // insecureEdgeTerminationPolicy indicates the desired behavior for insecure connections to a route. While + // each router may make its own decisions on which ports to expose, this is normally port 80. + // + // If a route does not specify insecureEdgeTerminationPolicy, then the default behavior is "None". + // + // * Allow - traffic is sent to the server on the insecure port (edge/reencrypt terminations only). + // + // * None - no traffic is allowed on the insecure port (default). + // + // * Redirect - clients are redirected to the secure port. + InsecureEdgeTerminationPolicy *routev1.InsecureEdgeTerminationPolicyType `json:"insecureEdgeTerminationPolicy,omitempty"` + // externalCertificate provides certificate contents as a secret reference. + // This should be a single serving certificate, not a certificate + // chain. Do not include a CA certificate. The secret referenced should + // be present in the same namespace as that of the Route. + // Forbidden when `certificate` is set. + // The router service account needs to be granted with read-only access to this secret, + // please refer to openshift docs for additional details. + ExternalCertificate *LocalObjectReferenceApplyConfiguration `json:"externalCertificate,omitempty"` +} + +// TLSConfigApplyConfiguration constructs a declarative configuration of the TLSConfig type for use with +// apply. +func TLSConfig() *TLSConfigApplyConfiguration { + return &TLSConfigApplyConfiguration{} +} + +// WithTermination sets the Termination field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Termination field is set to the value of the last call. +func (b *TLSConfigApplyConfiguration) WithTermination(value routev1.TLSTerminationType) *TLSConfigApplyConfiguration { + b.Termination = &value + return b +} + +// WithCertificate sets the Certificate field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Certificate field is set to the value of the last call. +func (b *TLSConfigApplyConfiguration) WithCertificate(value string) *TLSConfigApplyConfiguration { + b.Certificate = &value + return b +} + +// WithKey sets the Key field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Key field is set to the value of the last call. +func (b *TLSConfigApplyConfiguration) WithKey(value string) *TLSConfigApplyConfiguration { + b.Key = &value + return b +} + +// WithCACertificate sets the CACertificate field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CACertificate field is set to the value of the last call. +func (b *TLSConfigApplyConfiguration) WithCACertificate(value string) *TLSConfigApplyConfiguration { + b.CACertificate = &value + return b +} + +// WithDestinationCACertificate sets the DestinationCACertificate field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DestinationCACertificate field is set to the value of the last call. +func (b *TLSConfigApplyConfiguration) WithDestinationCACertificate(value string) *TLSConfigApplyConfiguration { + b.DestinationCACertificate = &value + return b +} + +// WithInsecureEdgeTerminationPolicy sets the InsecureEdgeTerminationPolicy field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the InsecureEdgeTerminationPolicy field is set to the value of the last call. +func (b *TLSConfigApplyConfiguration) WithInsecureEdgeTerminationPolicy(value routev1.InsecureEdgeTerminationPolicyType) *TLSConfigApplyConfiguration { + b.InsecureEdgeTerminationPolicy = &value + return b +} + +// WithExternalCertificate sets the ExternalCertificate field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ExternalCertificate field is set to the value of the last call. +func (b *TLSConfigApplyConfiguration) WithExternalCertificate(value *LocalObjectReferenceApplyConfiguration) *TLSConfigApplyConfiguration { + b.ExternalCertificate = value + return b +} diff --git a/vendor/github.com/openshift/client-go/route/clientset/versioned/clientset.go b/vendor/github.com/openshift/client-go/route/clientset/versioned/clientset.go new file mode 100644 index 0000000000..e81ff98b38 --- /dev/null +++ b/vendor/github.com/openshift/client-go/route/clientset/versioned/clientset.go @@ -0,0 +1,104 @@ +// Code generated by client-gen. DO NOT EDIT. + +package versioned + +import ( + fmt "fmt" + http "net/http" + + routev1 "github.com/openshift/client-go/route/clientset/versioned/typed/route/v1" + discovery "k8s.io/client-go/discovery" + rest "k8s.io/client-go/rest" + flowcontrol "k8s.io/client-go/util/flowcontrol" +) + +type Interface interface { + Discovery() discovery.DiscoveryInterface + RouteV1() routev1.RouteV1Interface +} + +// Clientset contains the clients for groups. +type Clientset struct { + *discovery.DiscoveryClient + routeV1 *routev1.RouteV1Client +} + +// RouteV1 retrieves the RouteV1Client +func (c *Clientset) RouteV1() routev1.RouteV1Interface { + return c.routeV1 +} + +// Discovery retrieves the DiscoveryClient +func (c *Clientset) Discovery() discovery.DiscoveryInterface { + if c == nil { + return nil + } + return c.DiscoveryClient +} + +// NewForConfig creates a new Clientset for the given config. +// If config's RateLimiter is not set and QPS and Burst are acceptable, +// NewForConfig will generate a rate-limiter in configShallowCopy. +// NewForConfig is equivalent to NewForConfigAndClient(c, httpClient), +// where httpClient was generated with rest.HTTPClientFor(c). +func NewForConfig(c *rest.Config) (*Clientset, error) { + configShallowCopy := *c + + if configShallowCopy.UserAgent == "" { + configShallowCopy.UserAgent = rest.DefaultKubernetesUserAgent() + } + + // share the transport between all clients + httpClient, err := rest.HTTPClientFor(&configShallowCopy) + if err != nil { + return nil, err + } + + return NewForConfigAndClient(&configShallowCopy, httpClient) +} + +// NewForConfigAndClient creates a new Clientset for the given config and http client. +// Note the http client provided takes precedence over the configured transport values. +// If config's RateLimiter is not set and QPS and Burst are acceptable, +// NewForConfigAndClient will generate a rate-limiter in configShallowCopy. +func NewForConfigAndClient(c *rest.Config, httpClient *http.Client) (*Clientset, error) { + configShallowCopy := *c + if configShallowCopy.RateLimiter == nil && configShallowCopy.QPS > 0 { + if configShallowCopy.Burst <= 0 { + return nil, fmt.Errorf("burst is required to be greater than 0 when RateLimiter is not set and QPS is set to greater than 0") + } + configShallowCopy.RateLimiter = flowcontrol.NewTokenBucketRateLimiter(configShallowCopy.QPS, configShallowCopy.Burst) + } + + var cs Clientset + var err error + cs.routeV1, err = routev1.NewForConfigAndClient(&configShallowCopy, httpClient) + if err != nil { + return nil, err + } + + cs.DiscoveryClient, err = discovery.NewDiscoveryClientForConfigAndClient(&configShallowCopy, httpClient) + if err != nil { + return nil, err + } + return &cs, nil +} + +// NewForConfigOrDie creates a new Clientset for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *rest.Config) *Clientset { + cs, err := NewForConfig(c) + if err != nil { + panic(err) + } + return cs +} + +// New creates a new Clientset for the given RESTClient. +func New(c rest.Interface) *Clientset { + var cs Clientset + cs.routeV1 = routev1.New(c) + + cs.DiscoveryClient = discovery.NewDiscoveryClient(c) + return &cs +} diff --git a/vendor/github.com/openshift/client-go/route/clientset/versioned/scheme/doc.go b/vendor/github.com/openshift/client-go/route/clientset/versioned/scheme/doc.go new file mode 100644 index 0000000000..14db57a58f --- /dev/null +++ b/vendor/github.com/openshift/client-go/route/clientset/versioned/scheme/doc.go @@ -0,0 +1,4 @@ +// Code generated by client-gen. DO NOT EDIT. + +// This package contains the scheme of the automatically generated clientset. +package scheme diff --git a/vendor/github.com/openshift/client-go/route/clientset/versioned/scheme/register.go b/vendor/github.com/openshift/client-go/route/clientset/versioned/scheme/register.go new file mode 100644 index 0000000000..53ac82ff5d --- /dev/null +++ b/vendor/github.com/openshift/client-go/route/clientset/versioned/scheme/register.go @@ -0,0 +1,40 @@ +// Code generated by client-gen. DO NOT EDIT. + +package scheme + +import ( + routev1 "github.com/openshift/api/route/v1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" + serializer "k8s.io/apimachinery/pkg/runtime/serializer" + utilruntime "k8s.io/apimachinery/pkg/util/runtime" +) + +var Scheme = runtime.NewScheme() +var Codecs = serializer.NewCodecFactory(Scheme) +var ParameterCodec = runtime.NewParameterCodec(Scheme) +var localSchemeBuilder = runtime.SchemeBuilder{ + routev1.AddToScheme, +} + +// AddToScheme adds all types of this clientset into the given scheme. This allows composition +// of clientsets, like in: +// +// import ( +// "k8s.io/client-go/kubernetes" +// clientsetscheme "k8s.io/client-go/kubernetes/scheme" +// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" +// ) +// +// kclientset, _ := kubernetes.NewForConfig(c) +// _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) +// +// After this, RawExtensions in Kubernetes types will serialize kube-aggregator types +// correctly. +var AddToScheme = localSchemeBuilder.AddToScheme + +func init() { + v1.AddToGroupVersion(Scheme, schema.GroupVersion{Version: "v1"}) + utilruntime.Must(AddToScheme(Scheme)) +} diff --git a/vendor/github.com/openshift/client-go/route/clientset/versioned/typed/route/v1/doc.go b/vendor/github.com/openshift/client-go/route/clientset/versioned/typed/route/v1/doc.go new file mode 100644 index 0000000000..225e6b2be3 --- /dev/null +++ b/vendor/github.com/openshift/client-go/route/clientset/versioned/typed/route/v1/doc.go @@ -0,0 +1,4 @@ +// Code generated by client-gen. DO NOT EDIT. + +// This package has the automatically generated typed clients. +package v1 diff --git a/vendor/github.com/openshift/client-go/route/clientset/versioned/typed/route/v1/generated_expansion.go b/vendor/github.com/openshift/client-go/route/clientset/versioned/typed/route/v1/generated_expansion.go new file mode 100644 index 0000000000..4f2173b6fc --- /dev/null +++ b/vendor/github.com/openshift/client-go/route/clientset/versioned/typed/route/v1/generated_expansion.go @@ -0,0 +1,5 @@ +// Code generated by client-gen. DO NOT EDIT. + +package v1 + +type RouteExpansion interface{} diff --git a/vendor/github.com/openshift/client-go/route/clientset/versioned/typed/route/v1/route.go b/vendor/github.com/openshift/client-go/route/clientset/versioned/typed/route/v1/route.go new file mode 100644 index 0000000000..fa11e4aa14 --- /dev/null +++ b/vendor/github.com/openshift/client-go/route/clientset/versioned/typed/route/v1/route.go @@ -0,0 +1,58 @@ +// Code generated by client-gen. DO NOT EDIT. + +package v1 + +import ( + context "context" + + routev1 "github.com/openshift/api/route/v1" + applyconfigurationsroutev1 "github.com/openshift/client-go/route/applyconfigurations/route/v1" + scheme "github.com/openshift/client-go/route/clientset/versioned/scheme" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + gentype "k8s.io/client-go/gentype" +) + +// RoutesGetter has a method to return a RouteInterface. +// A group's client should implement this interface. +type RoutesGetter interface { + Routes(namespace string) RouteInterface +} + +// RouteInterface has methods to work with Route resources. +type RouteInterface interface { + Create(ctx context.Context, route *routev1.Route, opts metav1.CreateOptions) (*routev1.Route, error) + Update(ctx context.Context, route *routev1.Route, opts metav1.UpdateOptions) (*routev1.Route, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). + UpdateStatus(ctx context.Context, route *routev1.Route, opts metav1.UpdateOptions) (*routev1.Route, error) + Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error + Get(ctx context.Context, name string, opts metav1.GetOptions) (*routev1.Route, error) + List(ctx context.Context, opts metav1.ListOptions) (*routev1.RouteList, error) + Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *routev1.Route, err error) + Apply(ctx context.Context, route *applyconfigurationsroutev1.RouteApplyConfiguration, opts metav1.ApplyOptions) (result *routev1.Route, err error) + // Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). + ApplyStatus(ctx context.Context, route *applyconfigurationsroutev1.RouteApplyConfiguration, opts metav1.ApplyOptions) (result *routev1.Route, err error) + RouteExpansion +} + +// routes implements RouteInterface +type routes struct { + *gentype.ClientWithListAndApply[*routev1.Route, *routev1.RouteList, *applyconfigurationsroutev1.RouteApplyConfiguration] +} + +// newRoutes returns a Routes +func newRoutes(c *RouteV1Client, namespace string) *routes { + return &routes{ + gentype.NewClientWithListAndApply[*routev1.Route, *routev1.RouteList, *applyconfigurationsroutev1.RouteApplyConfiguration]( + "routes", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *routev1.Route { return &routev1.Route{} }, + func() *routev1.RouteList { return &routev1.RouteList{} }, + ), + } +} diff --git a/vendor/github.com/openshift/client-go/route/clientset/versioned/typed/route/v1/route_client.go b/vendor/github.com/openshift/client-go/route/clientset/versioned/typed/route/v1/route_client.go new file mode 100644 index 0000000000..716f6ec203 --- /dev/null +++ b/vendor/github.com/openshift/client-go/route/clientset/versioned/typed/route/v1/route_client.go @@ -0,0 +1,85 @@ +// Code generated by client-gen. DO NOT EDIT. + +package v1 + +import ( + http "net/http" + + routev1 "github.com/openshift/api/route/v1" + scheme "github.com/openshift/client-go/route/clientset/versioned/scheme" + rest "k8s.io/client-go/rest" +) + +type RouteV1Interface interface { + RESTClient() rest.Interface + RoutesGetter +} + +// RouteV1Client is used to interact with features provided by the route.openshift.io group. +type RouteV1Client struct { + restClient rest.Interface +} + +func (c *RouteV1Client) Routes(namespace string) RouteInterface { + return newRoutes(c, namespace) +} + +// NewForConfig creates a new RouteV1Client for the given config. +// NewForConfig is equivalent to NewForConfigAndClient(c, httpClient), +// where httpClient was generated with rest.HTTPClientFor(c). +func NewForConfig(c *rest.Config) (*RouteV1Client, error) { + config := *c + setConfigDefaults(&config) + httpClient, err := rest.HTTPClientFor(&config) + if err != nil { + return nil, err + } + return NewForConfigAndClient(&config, httpClient) +} + +// NewForConfigAndClient creates a new RouteV1Client for the given config and http client. +// Note the http client provided takes precedence over the configured transport values. +func NewForConfigAndClient(c *rest.Config, h *http.Client) (*RouteV1Client, error) { + config := *c + setConfigDefaults(&config) + client, err := rest.RESTClientForConfigAndClient(&config, h) + if err != nil { + return nil, err + } + return &RouteV1Client{client}, nil +} + +// NewForConfigOrDie creates a new RouteV1Client for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *rest.Config) *RouteV1Client { + client, err := NewForConfig(c) + if err != nil { + panic(err) + } + return client +} + +// New creates a new RouteV1Client for the given RESTClient. +func New(c rest.Interface) *RouteV1Client { + return &RouteV1Client{c} +} + +func setConfigDefaults(config *rest.Config) { + gv := routev1.SchemeGroupVersion + config.GroupVersion = &gv + config.APIPath = "/apis" + config.NegotiatedSerializer = rest.CodecFactoryForGeneratedClient(scheme.Scheme, scheme.Codecs).WithoutConversion() + + if config.UserAgent == "" { + config.UserAgent = rest.DefaultKubernetesUserAgent() + } +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *RouteV1Client) RESTClient() rest.Interface { + if c == nil { + return nil + } + return c.restClient +} diff --git a/vendor/modules.txt b/vendor/modules.txt index 7f4a6b5985..e87c1975c2 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -345,6 +345,11 @@ github.com/openshift/client-go/operator/informers/externalversions/operator/v1 github.com/openshift/client-go/operator/informers/externalversions/operator/v1alpha1 github.com/openshift/client-go/operator/listers/operator/v1 github.com/openshift/client-go/operator/listers/operator/v1alpha1 +github.com/openshift/client-go/route/applyconfigurations/internal +github.com/openshift/client-go/route/applyconfigurations/route/v1 +github.com/openshift/client-go/route/clientset/versioned +github.com/openshift/client-go/route/clientset/versioned/scheme +github.com/openshift/client-go/route/clientset/versioned/typed/route/v1 github.com/openshift/client-go/security/applyconfigurations github.com/openshift/client-go/security/applyconfigurations/internal github.com/openshift/client-go/security/applyconfigurations/security/v1 From c6f4ad23fec2cced3b95f38e939103a091e9230a Mon Sep 17 00:00:00 2001 From: Hongkai Liu Date: Thu, 4 Jun 2026 09:42:10 -0400 Subject: [PATCH 3/5] make update --- ...hift_payload_cluster-version-operator.json | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/.openshift-tests-extension/openshift_payload_cluster-version-operator.json b/.openshift-tests-extension/openshift_payload_cluster-version-operator.json index 928c2adf63..7c543bd5fc 100644 --- a/.openshift-tests-extension/openshift_payload_cluster-version-operator.json +++ b/.openshift-tests-extension/openshift_payload_cluster-version-operator.json @@ -110,5 +110,30 @@ "source": "openshift:payload:cluster-version-operator", "lifecycle": "informing", "environmentSelector": {} + }, + { + "name": "[Jira:\"Cluster Version Operator\"] cluster-version-operator must get the APIServer when the TLS profile manager is created", + "labels": { + "Lifecycle:informing": {} + }, + "resources": { + "isolation": {} + }, + "source": "openshift:payload:cluster-version-operator", + "lifecycle": "informing", + "environmentSelector": {} + }, + { + "name": "[Jira:\"Cluster Version Operator\"] cluster-version-operator should update TLS profile", + "labels": { + "Local": {}, + "OTA-1996": {} + }, + "resources": { + "isolation": {} + }, + "source": "openshift:payload:cluster-version-operator", + "lifecycle": "blocking", + "environmentSelector": {} } ] \ No newline at end of file From a16e6379dc666125d2da38a8d213cf3640e0e761 Mon Sep 17 00:00:00 2001 From: Hongkai Liu Date: Thu, 4 Jun 2026 22:43:36 -0400 Subject: [PATCH 4/5] No waiting for stable cluster The goal is to check if the CVO target is still up after the TPL profile is updated, no matter if the cluster is stable or not. --- test/cvo/tls.go | 50 +++------------------------------------------- test/oc/api/api.go | 4 ---- test/oc/cli/cli.go | 15 -------------- 3 files changed, 3 insertions(+), 66 deletions(-) diff --git a/test/cvo/tls.go b/test/cvo/tls.go index 3b93e8ff7e..d69ca41239 100644 --- a/test/cvo/tls.go +++ b/test/cvo/tls.go @@ -6,13 +6,11 @@ import ( "encoding/json" "fmt" "io" - "os" "strings" "time" g "github.com/onsi/ginkgo/v2" o "github.com/onsi/gomega" - "github.com/openshift/cluster-version-operator/pkg/tls" corev1 "k8s.io/api/core/v1" kerrors "k8s.io/apimachinery/pkg/api/errors" @@ -29,8 +27,7 @@ import ( "github.com/openshift/library-go/pkg/crypto" "github.com/openshift/cluster-version-operator/pkg/external" - "github.com/openshift/cluster-version-operator/test/oc" - ocapi "github.com/openshift/cluster-version-operator/test/oc/api" + "github.com/openshift/cluster-version-operator/pkg/tls" "github.com/openshift/cluster-version-operator/test/util" ) @@ -41,7 +38,6 @@ var _ = g.Describe(`[Jira:"Cluster Version Operator"] cluster-version-operator`, kubeClient kubernetes.Interface configClient *configv1client.ConfigV1Client routeClient *routev1client.Clientset - ocClient ocapi.OC err error ctx = context.Background() @@ -49,7 +45,6 @@ var _ = g.Describe(`[Jira:"Cluster Version Operator"] cluster-version-operator`, backup configv1.APIServerSpec prometheusURL, bearerToken string - waitStable bool ) g.BeforeEach(func() { @@ -68,22 +63,6 @@ var _ = g.Describe(`[Jira:"Cluster Version Operator"] cluster-version-operator`, routeClient, err = routev1client.NewForConfig(c) o.Expect(err).To(o.BeNil()) - waitStable = strings.ToLower(os.Getenv("WAIT_STABLE")) == "true" - - timeout := 2 * time.Minute - if waitStable { - timeout = 61 * time.Minute - } - ocClient, err = oc.NewOC(ocapi.Options{Logger: logger, Timeout: timeout}) - o.Expect(err).NotTo(o.HaveOccurred()) - o.Expect(ocClient).NotTo(o.BeNil()) - - if waitStable { - // check if cluster is stable before testing - _, err = ocClient.AdmWaitForStableCluster("1m0s", "5m0s") - o.Expect(err).NotTo(o.HaveOccurred(), "The cluster isn't stable before testing") - } - prometheusURL, err = util.PrometheusRouteURL(ctx, routeClient) o.Expect(err).NotTo(o.HaveOccurred(), "Failed to get public url of prometheus") bearerToken, err = util.RequestPrometheusServiceAccountAPIToken(ctx, kubeClient) @@ -104,12 +83,6 @@ var _ = g.Describe(`[Jira:"Cluster Version Operator"] cluster-version-operator`, apiServer.Spec = backup _, err = configClient.APIServers().Update(ctx, apiServer, metav1.UpdateOptions{}) o.Expect(err).NotTo(o.HaveOccurred()) - - if waitStable { - // wait before handing the cluster over to other tests - _, err = ocClient.AdmWaitForStableCluster("5m0s", "1h0m0s") - o.Expect(err).NotTo(o.HaveOccurred()) - } } }) @@ -201,27 +174,10 @@ var _ = g.Describe(`[Jira:"Cluster Version Operator"] cluster-version-operator`, o.Expect(err).NotTo(o.HaveOccurred()) needRecover = true - g.By("Waiting for the cluster to stabilize") - // It takes too long in CI to wait until the cluster is stable - // co/authentication is about 5-8 mins - // co/openshift-apiserver is about 50 - 60 mins - if waitStable { - _, err = ocClient.AdmWaitForStableCluster("5m0s", "1h0m0s") - o.Expect(err).NotTo(o.HaveOccurred()) - } else { - logger.Info("Did not waiting for the cluster to stabilize after updating API server", "waitStable", waitStable) - } - g.By("Checking if the CVO target is still up in Prometheus") - count := 1 - if !waitStable { - // checking 3 times in total; 30s once - count = 3 - } + count := 3 for i := 0; i < count; i++ { - if !waitStable { - time.Sleep(30 * time.Second) - } + time.Sleep(30 * time.Second) var errUp error errWait := wait.PollUntilContextTimeout(context.Background(), 10*time.Second, 2*time.Minute, true, func(context.Context) (bool, error) { targets, err = promTargets() diff --git a/test/oc/api/api.go b/test/oc/api/api.go index 3e6c995910..050cbea148 100644 --- a/test/oc/api/api.go +++ b/test/oc/api/api.go @@ -22,8 +22,4 @@ type Options struct { type OC interface { AdmReleaseExtract(o ReleaseExtractOptions) error Version(o VersionOptions) (string, error) - - // AdmWaitForStableCluster runs oc adm wait-for-stable-cluster - // Non-Empty minimumStablePeriod or timeout overrides the default value in the command - AdmWaitForStableCluster(minimumStablePeriod, timeout string) (string, error) } diff --git a/test/oc/cli/cli.go b/test/oc/cli/cli.go index 56655d6ba3..7e6d4509ee 100644 --- a/test/oc/cli/cli.go +++ b/test/oc/cli/cli.go @@ -98,18 +98,3 @@ func (c *client) Version(o api.VersionOptions) (string, error) { } return string(output), nil } - -func (c *client) AdmWaitForStableCluster(minimumStablePeriod, timeout string) (string, error) { - args := []string{"adm", "wait-for-stable-cluster"} - if minimumStablePeriod != "" { - args = append(args, fmt.Sprintf("--minimum-stable-period=%s", minimumStablePeriod)) - } - if timeout != "" { - args = append(args, fmt.Sprintf("--timeout=%s", timeout)) - } - output, err := c.executor.Run(args...) - if err != nil { - return "", err - } - return string(output), nil -} From 4c31ec84b67d14a872b872d316634ee98c6c90c9 Mon Sep 17 00:00:00 2001 From: Hongkai Liu Date: Tue, 9 Jun 2026 10:33:07 -0400 Subject: [PATCH 5/5] Address review comments --- test/cvo/tls.go | 2 +- test/util/util.go | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/test/cvo/tls.go b/test/cvo/tls.go index d69ca41239..16d79e871b 100644 --- a/test/cvo/tls.go +++ b/test/cvo/tls.go @@ -234,7 +234,7 @@ var _ = g.Describe(`[Jira:"Cluster Version Operator"] cluster-version-operator`, } } - o.Expect(found).To(o.BeTrue(), "Failed to find logs about updating TCP profile when ShouldHonorClusterTLSProfile=%t after %s", + o.Expect(found).To(o.BeTrue(), "Failed to find logs about updating TLS profile when ShouldHonorClusterTLSProfile=%t after %s", crypto.ShouldHonorClusterTLSProfile(apiServer.Spec.TLSAdherence), t.Format(time.RFC3339)) }) }) diff --git a/test/util/util.go b/test/util/util.go index 8dce7321b4..ede0324060 100644 --- a/test/util/util.go +++ b/test/util/util.go @@ -261,6 +261,9 @@ func PrometheusRouteURL(ctx context.Context, routeClient *routev1client.Clientse if err != nil { return "", fmt.Errorf("unable to get the %s route in the %s namespace: %w", prometheusName, namespaceOpenshiftMonitoring, err) } + if len(rte.Status.Ingress) == 0 { + return "", fmt.Errorf("unable to get any ingress in the status of the %s route in the %s namespace: %w", prometheusName, namespaceOpenshiftMonitoring, err) + } return "https://" + rte.Status.Ingress[0].Host, nil }