Skip to content

Commit 7949bd3

Browse files
committed
Add feedback: add featuregate and correct url validation
Signed-off-by: sandert-k8s <sandert98@gmail.com>
1 parent 7918d1d commit 7949bd3

File tree

4 files changed

+1124
-3
lines changed

4 files changed

+1124
-3
lines changed

features/features.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1011,4 +1011,10 @@ var (
10111011
enhancementPR("https://github.com/openshift/enhancements/pull/1933").
10121012
enable(inDevPreviewNoUpgrade(), inTechPreviewNoUpgrade()).
10131013
mustRegister()
1014-
)
1014+
1015+
FeatureGateConsoleCustomLoginServerURL = newFeatureGate("ConsoleCustomLoginServerURL").
1016+
reportProblemsToJiraComponent("Management Console").
1017+
contactPerson("console-dev").
1018+
productScope(ocpSpecific).
1019+
enable(inTechPreviewNoUpgrade(), inDevPreviewNoUpgrade()).
1020+
mustRegister()

operator/v1/types_console.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -344,9 +344,13 @@ type ConsoleCustomization struct {
344344
// or any other front-end that accepts oc login traffic) without changing
345345
// how the console itself communicates with the Kubernetes API server.
346346
// When omitted, the console falls back to the standard cluster API server URL.
347-
// Must be a valid HTTPS URL.
347+
// The value must be either empty or an absolute HTTPS URL (i.e. starting with
348+
// 'https://') and must not exceed 1024 characters.
349+
// +openshift:enable:FeatureGate=ConsoleCustomLoginServerURL
348350
// +optional
349-
// +kubebuilder:validation:Pattern=`^$|^https://[^\s].*$`
351+
// +kubebuilder:validation:XValidation:rule="size(self) == 0 || isURL(self)",message="custom login server url must be a valid absolute URL"
352+
// +kubebuilder:validation:XValidation:rule="size(self) == 0 || url(self).getScheme() == 'https'",message="custom login server url scheme must be https"
353+
// +kubebuilder:validation:MaxLength=1024
350354
CustomLoginServerURL string `json:"customLoginServerURL,omitempty"`
351355
}
352356

operator/v1/zz_generated.crd-manifests/0000_50_console_01_consoles.crd.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,22 @@ spec:
153153
customProductName is the name that will be displayed in page titles, logo alt text, and the about dialog
154154
instead of the normal OpenShift product name.
155155
type: string
156+
customLoginServerURL:
157+
description: |-
158+
customLoginServerURL is an optional field that, when set, overrides the server
159+
address displayed in the 'oc login' command shown in the console. Use this
160+
to advertise an alternative API endpoint (for example, a Proxy
161+
or any other front-end that accepts oc login traffic) without changing
162+
how the console itself communicates with the Kubernetes API server.
163+
When omitted, the console falls back to the standard cluster API server URL.
164+
Must be a valid HTTPS URL.
165+
maxLength: 1024
166+
type: string
167+
x-kubernetes-validations:
168+
- message: custom login server url must be a valid absolute URL
169+
rule: size(self) == 0 || isURL(self)
170+
- message: custom login server url scheme must be https
171+
rule: size(self) == 0 || url(self).getScheme() == 'https'
156172
developerCatalog:
157173
description: developerCatalog allows to configure the shown developer
158174
catalog categories (filters) and types (sub-catalogs).

0 commit comments

Comments
 (0)