Skip to content

Commit

Permalink
OCPBUGS-33787: add console and download URLs to console operator config
Browse files Browse the repository at this point in the history
  • Loading branch information
alebedev87 committed May 22, 2024
1 parent 0314f31 commit c0622aa
Show file tree
Hide file tree
Showing 8 changed files with 275 additions and 1 deletion.
39 changes: 38 additions & 1 deletion openapi/generated_openapi/zz_generated.openapi.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 21 additions & 0 deletions openapi/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -26353,6 +26353,11 @@
"default": {},
"$ref": "#/definitions/com.github.openshift.api.operator.v1.ConsoleCustomization"
},
"ingress": {
"description": "ingress allows to configure the alternative ingress for the console. This field is intended for clusters without ingress capability, where access to routes is not possible.",
"default": {},
"$ref": "#/definitions/com.github.openshift.api.operator.v1.Ingress"
},
"logLevel": {
"description": "logLevel is an intent based logging for an overall component. It does not give fine grained control, but it is a simple way to manage coarse grained logging choices that operators have to interpret for their operands.\n\nValid values are: \"Normal\", \"Debug\", \"Trace\", \"TraceAll\". Defaults to \"Normal\".",
"type": "string"
Expand Down Expand Up @@ -27494,6 +27499,22 @@
}
}
},
"com.github.openshift.api.operator.v1.Ingress": {
"description": "Ingress allows cluster admin to configure alternative ingress for the console.",
"type": "object",
"properties": {
"clientDownloadsURL": {
"description": "clientDownloadsURL is a URL to be used as the address to download client binaries. If not specified, the downloads route hostname will be used. This field is required for clusters without ingress capability, where access to routes is not possible. The console operator will monitor the URL and may go degraded if it's unreachable for an extended period. Must use the HTTPS scheme.",
"type": "string",
"default": ""
},
"consoleURL": {
"description": "consoleURL is a URL to be used as the base console address. If not specified, the console route hostname will be used. This field is required for clusters without ingress capability, where access to routes is not possible. Make sure that appropriate ingress is set up at this URL. The console operator will monitor the URL and may go degraded if it's unreachable for an extended period. Must use the HTTPS scheme.",
"type": "string",
"default": ""
}
}
},
"com.github.openshift.api.operator.v1.IngressController": {
"description": "IngressController describes a managed ingress controller for the cluster. The controller can service OpenShift Route and Kubernetes Ingress resources.\n\nWhen an IngressController is created, a new ingress controller deployment is created to allow external traffic to reach the services that expose Ingress or Route resources. Updating this resource may lead to disruption for public facing network connections as a new ingress controller revision may be rolled out.\n\nhttps://kubernetes.io/docs/concepts/services-networking/ingress-controllers\n\nWhenever possible, sensible defaults for the platform are used. See each field for more details.\n\nCompatibility level 1: Stable within a major release for a minimum of 12 months or 3 minor releases (whichever is longer).",
"type": "object",
Expand Down
82 changes: 82 additions & 0 deletions operator/v1/tests/consoles.operator.openshift.io/AAA_ungated.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -155,3 +155,85 @@ tests:
resource: Deployment
version: v1
expectedError: "spec.customization.perspectives[0].pinnedResources[0].resource in body should match '^[a-z0-9]([-a-z0-9]*[a-z0-9])?$'"
- name: Should be able to add https urls
initial: |
apiVersion: operator.openshift.io/v1
kind: Console
spec:
ingress:
consoleURL: "https://testingress.com"
clientDownloadsURL: "https://testingress.com"
expected: |
apiVersion: operator.openshift.io/v1
kind: Console
spec:
logLevel: Normal
operatorLogLevel: Normal
ingress:
consoleURL: "https://testingress.com"
clientDownloadsURL: "https://testingress.com"
- name: Should be able to add empty urls
initial: |
apiVersion: operator.openshift.io/v1
kind: Console
spec:
ingress:
consoleURL: ""
clientDownloadsURL: ""
expected: |
apiVersion: operator.openshift.io/v1
kind: Console
spec:
logLevel: Normal
operatorLogLevel: Normal
ingress:
consoleURL: ""
clientDownloadsURL: ""
- name: Should throw an error if the value of console url has http scheme
initial: |
apiVersion: operator.openshift.io/v1
kind: Console
spec:
ingress:
consoleURL: "http://testingress.com"
expectedError: "spec.ingress.consoleURL: Invalid value: \"string\": console url scheme must be https"
- name: Should throw an error if the value of client downloads url has http scheme
initial: |
apiVersion: operator.openshift.io/v1
kind: Console
spec:
ingress:
clientDownloadsURL: "http://testingress.com"
expectedError: "spec.ingress.clientDownloadsURL: Invalid value: \"string\": client downloads url scheme must be https"
- name: Should throw an error if console url is invalid
initial: |
apiVersion: operator.openshift.io/v1
kind: Console
spec:
ingress:
consoleURL: "https://\ntestingress.com"
expectedError: "spec.ingress.consoleURL: Invalid value: \"string\": console url must be a valid absolute URL"
- name: Should throw an error if client downloads url is invalid
initial: |
apiVersion: operator.openshift.io/v1
kind: Console
spec:
ingress:
clientDownloadsURL: "https://\ntestingress.com"
expectedError: "spec.ingress.clientDownloadsURL: Invalid value: \"string\": client downloads url must be a valid absolute URL"
- name: Should throw an invalid url error if console url is invalid and has no scheme
initial: |
apiVersion: operator.openshift.io/v1
kind: Console
spec:
ingress:
consoleURL: "\ntestingress.com"
expectedError: "spec.ingress.consoleURL: Invalid value: \"string\": console url must be a valid absolute URL"
- name: Should throw an invalid error if client downloads url is invalid and has no scheme
initial: |
apiVersion: operator.openshift.io/v1
kind: Console
spec:
ingress:
clientDownloadsURL: "\ntestingress.com"
expectedError: "spec.ingress.clientDownloadsURL: Invalid value: \"string\": client downloads url must be a valid absolute URL"
34 changes: 34 additions & 0 deletions operator/v1/types_console.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ type ConsoleSpec struct {
// plugins defines a list of enabled console plugin names.
// +optional
Plugins []string `json:"plugins,omitempty"`
// ingress allows to configure the alternative ingress for the console.
// This field is intended for clusters without ingress capability,
// where access to routes is not possible.
// +optional
Ingress Ingress `json:"ingress"`
}

// ConsoleConfigRoute holds information on external route access to console.
Expand Down Expand Up @@ -375,6 +380,35 @@ const (
BrandROSA Brand = "ROSA"
)

// Ingress allows cluster admin to configure alternative ingress for the console.
type Ingress struct {
// consoleURL is a URL to be used as the base console address.
// If not specified, the console route hostname will be used.
// This field is required for clusters without ingress capability,
// where access to routes is not possible.
// Make sure that appropriate ingress is set up at this URL.
// The console operator will monitor the URL and may go degraded
// if it's unreachable for an extended period.
// Must use the HTTPS scheme.
// +optional
// +kubebuilder:validation:XValidation:rule="size(self) == 0 || isURL(self)",message="console url must be a valid absolute URL"
// +kubebuilder:validation:XValidation:rule="size(self) == 0 || url(self).getScheme() == 'https'",message="console url scheme must be https"
// +kubebuilder:validation:MaxLength=1024
ConsoleURL string `json:"consoleURL"`
// clientDownloadsURL is a URL to be used as the address to download client binaries.
// If not specified, the downloads route hostname will be used.
// This field is required for clusters without ingress capability,
// where access to routes is not possible.
// The console operator will monitor the URL and may go degraded
// if it's unreachable for an extended period.
// Must use the HTTPS scheme.
// +optional
// +kubebuilder:validation:XValidation:rule="size(self) == 0 || isURL(self)",message="client downloads url must be a valid absolute URL"
// +kubebuilder:validation:XValidation:rule="size(self) == 0 || url(self).getScheme() == 'https'",message="client downloads url scheme must be https"
// +kubebuilder:validation:MaxLength=1024
ClientDownloadsURL string `json:"clientDownloadsURL"`
}

// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

// Compatibility level 1: Stable within a major release for a minimum of 12 months or 3 minor releases (whichever is longer).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,42 @@ spec:
type: array
type: object
type: object
ingress:
description: ingress allows to configure the alternative ingress for
the console. This field is intended for clusters without ingress
capability, where access to routes is not possible.
properties:
clientDownloadsURL:
description: clientDownloadsURL is a URL to be used as the address
to download client binaries. If not specified, the downloads
route hostname will be used. This field is required for clusters
without ingress capability, where access to routes is not possible.
The console operator will monitor the URL and may go degraded
if it's unreachable for an extended period. Must use the HTTPS
scheme.
maxLength: 1024
type: string
x-kubernetes-validations:
- message: client downloads url must be a valid absolute URL
rule: size(self) == 0 || isURL(self)
- message: client downloads url scheme must be https
rule: size(self) == 0 || url(self).getScheme() == 'https'
consoleURL:
description: consoleURL is a URL to be used as the base console
address. If not specified, the console route hostname will be
used. This field is required for clusters without ingress capability,
where access to routes is not possible. Make sure that appropriate
ingress is set up at this URL. The console operator will monitor
the URL and may go degraded if it's unreachable for an extended
period. Must use the HTTPS scheme.
maxLength: 1024
type: string
x-kubernetes-validations:
- message: console url must be a valid absolute URL
rule: size(self) == 0 || isURL(self)
- message: console url scheme must be https
rule: size(self) == 0 || url(self).getScheme() == 'https'
type: object
logLevel:
default: Normal
description: "logLevel is an intent based logging for an overall component.
Expand Down
17 changes: 17 additions & 0 deletions operator/v1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,42 @@ spec:
type: array
type: object
type: object
ingress:
description: ingress allows to configure the alternative ingress for
the console. This field is intended for clusters without ingress
capability, where access to routes is not possible.
properties:
clientDownloadsURL:
description: clientDownloadsURL is a URL to be used as the address
to download client binaries. If not specified, the downloads
route hostname will be used. This field is required for clusters
without ingress capability, where access to routes is not possible.
The console operator will monitor the URL and may go degraded
if it's unreachable for an extended period. Must use the HTTPS
scheme.
maxLength: 1024
type: string
x-kubernetes-validations:
- message: client downloads url must be a valid absolute URL
rule: size(self) == 0 || isURL(self)
- message: client downloads url scheme must be https
rule: size(self) == 0 || url(self).getScheme() == 'https'
consoleURL:
description: consoleURL is a URL to be used as the base console
address. If not specified, the console route hostname will be
used. This field is required for clusters without ingress capability,
where access to routes is not possible. Make sure that appropriate
ingress is set up at this URL. The console operator will monitor
the URL and may go degraded if it's unreachable for an extended
period. Must use the HTTPS scheme.
maxLength: 1024
type: string
x-kubernetes-validations:
- message: console url must be a valid absolute URL
rule: size(self) == 0 || isURL(self)
- message: console url scheme must be https
rule: size(self) == 0 || url(self).getScheme() == 'https'
type: object
logLevel:
default: Normal
description: "logLevel is an intent based logging for an overall component.
Expand Down
Loading

0 comments on commit c0622aa

Please sign in to comment.