Skip to content

Commit 84cc3c5

Browse files
committed
ability-to-add-second-logo-pt6
1 parent 94fa59b commit 84cc3c5

File tree

8 files changed

+989
-16
lines changed

8 files changed

+989
-16
lines changed

openapi/generated_openapi/zz_generated.openapi.go

+169-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

openapi/openapi.json

+110-2
Original file line numberDiff line numberDiff line change
@@ -26889,6 +26889,26 @@
2688926889
}
2689026890
}
2689126891
},
26892+
"com.github.openshift.api.operator.v1.ConfigMapFileReference": {
26893+
"description": "ConfigMapFileReference references a specific file within a ConfigMap.",
26894+
"type": "object",
26895+
"required": [
26896+
"name",
26897+
"key"
26898+
],
26899+
"properties": {
26900+
"key": {
26901+
"description": "key is the logo key inside the referenced ConfigMap. Must consist only of alphanumeric characters, dashes (-), underscores (_), and periods (.). Must be at most 253 characters in length. Must end in a valid file extension. A valid file extension must consist of a period followed by 2 to 5 alpha characters.",
26902+
"type": "string",
26903+
"default": ""
26904+
},
26905+
"name": {
26906+
"description": "name is the name of the ConfigMap. name is a required field. Must consist of lower case alphanumeric characters, '-' or '.', and must start and end with an alphanumeric character. Must be at most 253 characters in length.",
26907+
"type": "string",
26908+
"default": ""
26909+
}
26910+
}
26911+
},
2689226912
"com.github.openshift.api.operator.v1.ConfigSpec": {
2689326913
"type": "object",
2689426914
"required": [
@@ -27023,7 +27043,7 @@
2702327043
}
2702427044
},
2702527045
"com.github.openshift.api.operator.v1.ConsoleCustomization": {
27026-
"description": "ConsoleCustomization defines a list of optional configuration for the console UI.",
27046+
"description": "ConsoleCustomization defines a list of optional configuration for the console UI. Ensure that Logos and CustomLogoFile cannot be set at the same time.",
2702727047
"type": "object",
2702827048
"properties": {
2702927049
"addPage": {
@@ -27048,7 +27068,7 @@
2704827068
"x-kubernetes-list-type": "map"
2704927069
},
2705027070
"customLogoFile": {
27051-
"description": "customLogoFile replaces the default OpenShift logo in the masthead and about dialog. It is a reference to a ConfigMap in the openshift-config namespace. This can be created with a command like 'oc create configmap custom-logo --from-file=/path/to/file -n openshift-config'. Image size must be less than 1 MB due to constraints on the ConfigMap size. The ConfigMap key should include a file extension so that the console serves the file with the correct MIME type. Recommended logo specifications: Dimensions: Max height of 68px and max width of 200px SVG format preferred",
27071+
"description": "customLogoFile replaces the default OpenShift logo in the masthead and about dialog. It is a reference to a Only one of customLogoFile or logos can be set at a time. ConfigMap in the openshift-config namespace. This can be created with a command like 'oc create configmap custom-logo --from-file=/path/to/file -n openshift-config'. Image size must be less than 1 MB due to constraints on the ConfigMap size. The ConfigMap key should include a file extension so that the console serves the file with the correct MIME type. The recommended file format for the logo is SVG, but other file formats are allowed if supported by the browser. Deprecated: Use logos instead.",
2705227072
"default": {},
2705327073
"$ref": "#/definitions/com.github.openshift.api.config.v1.ConfigMapFileReference"
2705427074
},
@@ -27065,6 +27085,18 @@
2706527085
"description": "documentationBaseURL links to external documentation are shown in various sections of the web console. Providing documentationBaseURL will override the default documentation URL. Invalid value will prevent a console rollout.",
2706627086
"type": "string"
2706727087
},
27088+
"logos": {
27089+
"description": "logos is used to replace the OpenShift Masthead and Favicon logos in the console UI with custom logos. logos is an optional field that allows a list of logos. Only one of logos or customLogoFile can be set at a time. If logos is set, customLogoFile must be unset. When specified, there must be at least one entry and no more than 2 entries. Each type must appear only once in the list.",
27090+
"type": "array",
27091+
"items": {
27092+
"default": {},
27093+
"$ref": "#/definitions/com.github.openshift.api.operator.v1.Logo"
27094+
},
27095+
"x-kubernetes-list-map-keys": [
27096+
"type"
27097+
],
27098+
"x-kubernetes-list-type": "map"
27099+
},
2706827100
"perspectives": {
2706927101
"description": "perspectives allows enabling/disabling of perspective(s) that user can see in the Perspective switcher dropdown.",
2707027102
"type": "array",
@@ -27896,6 +27928,27 @@
2789627928
}
2789727929
}
2789827930
},
27931+
"com.github.openshift.api.operator.v1.FileReferenceSource": {
27932+
"description": "FileReferenceSource is used by the console to locate the specified file containing a custom logo.",
27933+
"type": "object",
27934+
"required": [
27935+
"from"
27936+
],
27937+
"properties": {
27938+
"configMap": {
27939+
"description": "configMap specifies the ConfigMap sourcing details such as the name of the ConfigMap and the key for the file. The ConfigMap must exist in the openshift-config namespace. Required when from is \"ConfigMap\", and forbidden otherwise.",
27940+
"$ref": "#/definitions/com.github.openshift.api.operator.v1.ConfigMapFileReference"
27941+
},
27942+
"from": {
27943+
"description": "from is a required field to specify the source type of the file reference. Allowed values are ConfigMap. When set to ConfigMap, the file will be sourced from a ConfigMap in the openshift-config namespace. The configMap field must be set when from is set to ConfigMap.\n\nPossible enum values:\n - `\"ConfigMap\"` represents a ConfigMap source.",
27944+
"type": "string",
27945+
"default": "",
27946+
"enum": [
27947+
"ConfigMap"
27948+
]
27949+
}
27950+
}
27951+
},
2789927952
"com.github.openshift.api.operator.v1.ForwardPlugin": {
2790027953
"description": "ForwardPlugin defines a schema for configuring the CoreDNS forward plugin.",
2790127954
"type": "object",
@@ -29805,6 +29858,37 @@
2980529858
}
2980629859
]
2980729860
},
29861+
"com.github.openshift.api.operator.v1.Logo": {
29862+
"description": "Logo defines a configuration based on theme modes for the console UI logo.",
29863+
"type": "object",
29864+
"required": [
29865+
"type",
29866+
"themes"
29867+
],
29868+
"properties": {
29869+
"themes": {
29870+
"description": "themes specifies the themes for the console UI logo. themes is a required field that allows a list of themes. Each item in the themes list must have a unique mode and a source field. Each mode determines whether the logo is for the dark or light mode of the console UI. If a theme is not specified, the default OpenShift logo will be displayed for that theme. There must be at least one entry and no more than 2 entries.",
29871+
"type": "array",
29872+
"items": {
29873+
"default": {},
29874+
"$ref": "#/definitions/com.github.openshift.api.operator.v1.Theme"
29875+
},
29876+
"x-kubernetes-list-map-keys": [
29877+
"mode"
29878+
],
29879+
"x-kubernetes-list-type": "map"
29880+
},
29881+
"type": {
29882+
"description": "type specifies the type of the logo for the console UI. It determines whether the logo is for the masthead or favicon. type is a required field that allows values of Masthead and Favicon. When set to \"Masthead\", the logo will be used in the masthead and about modal of the console UI. When set to \"Favicon\", the logo will be used as the favicon of the console UI.\n\nPossible enum values:\n - `\"Favicon\"` Favicon represents the favicon logo.\n - `\"Masthead\"` Masthead represents the logo in the masthead.",
29883+
"type": "string",
29884+
"default": "",
29885+
"enum": [
29886+
"Favicon",
29887+
"Masthead"
29888+
]
29889+
}
29890+
}
29891+
},
2980829892
"com.github.openshift.api.operator.v1.MTUMigration": {
2980929893
"description": "MTUMigration contains infomation about MTU migration.",
2981029894
"type": "object",
@@ -32663,6 +32747,30 @@
3266332747
}
3266432748
}
3266532749
},
32750+
"com.github.openshift.api.operator.v1.Theme": {
32751+
"description": "Theme defines a theme mode for the console UI.",
32752+
"type": "object",
32753+
"required": [
32754+
"mode",
32755+
"source"
32756+
],
32757+
"properties": {
32758+
"mode": {
32759+
"description": "mode is used to specify what theme mode a logo will apply to in the console UI. mode is a required field that allows values of Dark and Light. When set to Dark, the logo file referenced in the 'file' field will be used when an end-user of the console UI enables the Dark mode. When set to Light, the logo file referenced in the 'file' field will be used when an end-user of the console UI enables the Light mode.\n\nPossible enum values:\n - `\"Dark\"` represents the dark mode for a console theme.\n - `\"Light\"` represents the light mode for a console theme.",
32760+
"type": "string",
32761+
"default": "",
32762+
"enum": [
32763+
"Dark",
32764+
"Light"
32765+
]
32766+
},
32767+
"source": {
32768+
"description": "source is used by the console to locate the specified file containing a custom logo. source is a required field that references a ConfigMap name and key that contains the custom logo file in the openshift-config namespace. You can create it with a command like: - 'oc create configmap custom-logos-config --namespace=openshift-config --from-file=/path/to/file' The ConfigMap key must include the file extension so that the console serves the file with the correct MIME type. The recommended file format for the Masthead and Favicon logos is SVG, but other file formats are allowed if supported by the browser. The logo image size must be less than 1 MB due to constraints on the ConfigMap size. For more information, see the documentation: https://docs.redhat.com/en/documentation/openshift_container_platform/4.19/html/web_console/customizing-web-console#customizing-web-console",
32769+
"default": {},
32770+
"$ref": "#/definitions/com.github.openshift.api.operator.v1.FileReferenceSource"
32771+
}
32772+
}
32773+
},
3266632774
"com.github.openshift.api.operator.v1.Upstream": {
3266732775
"description": "Upstream can either be of type SystemResolvConf, or of type Network.\n\n - For an Upstream of type SystemResolvConf, no further fields are necessary:\n The upstream will be configured to use /etc/resolv.conf.\n - For an Upstream of type Network, a NetworkResolver field needs to be defined\n with an IP address or IP:port if the upstream listens on a port other than 53.",
3266832776
"type": "object",

operator/v1/tests/consoles.operator.openshift.io/AAA_ungated.yaml

+175
Original file line numberDiff line numberDiff line change
@@ -296,3 +296,178 @@ tests:
296296
visibility:
297297
state: Enables
298298
expectedError: "spec.customization.capabilities[0].visibility.state: Unsupported value: \"Enables\": supported values: \"Enabled\", \"Disabled\""
299+
- name: Should allow creating custom logos for Dark and Light themes
300+
initial: |
301+
apiVersion: operator.openshift.io/v1
302+
kind: Console
303+
spec:
304+
customization:
305+
logos:
306+
- type: Masthead
307+
themes:
308+
- mode: Dark
309+
source:
310+
from: ConfigMap
311+
configMap:
312+
name: custom-logos-config
313+
key: masthead-dark-logo.svg
314+
- mode: Light
315+
source:
316+
from: ConfigMap
317+
configMap:
318+
name: custom-logos-config
319+
key: masthead-light-logo.svg
320+
expected: |
321+
apiVersion: operator.openshift.io/v1
322+
kind: Console
323+
spec:
324+
logLevel: Normal
325+
operatorLogLevel: Normal
326+
customization:
327+
logos:
328+
- type: Masthead
329+
themes:
330+
- mode: Dark
331+
source:
332+
from: ConfigMap
333+
configMap:
334+
name: custom-logos-config
335+
key: masthead-dark-logo.svg
336+
- mode: Light
337+
source:
338+
from: ConfigMap
339+
configMap:
340+
name: custom-logos-config
341+
key: masthead-light-logo.svg
342+
- name: Should not allow duplicate theme types
343+
initial: |
344+
apiVersion: operator.openshift.io/v1
345+
kind: Console
346+
spec:
347+
customization:
348+
logos:
349+
- type: Masthead
350+
themes:
351+
- mode: Dark
352+
source:
353+
from: ConfigMap
354+
configMap:
355+
name: custom-logos-config
356+
key: masthead-dark-logo.svg
357+
- mode: Dark
358+
source:
359+
from: ConfigMap
360+
configMap:
361+
type: custom-logos-config
362+
key: masthead-dark-logo.svg
363+
expectedError: "spec.customization.logos[0].themes[1]: Duplicate value: map[string]interface {}{\"mode\":\"Dark\"}"
364+
- name: Should not allow duplicate custom logo types
365+
initial: |
366+
apiVersion: operator.openshift.io/v1
367+
kind: Console
368+
spec:
369+
customization:
370+
logos:
371+
- type: Masthead
372+
themes:
373+
- mode: Dark
374+
source:
375+
from: ConfigMap
376+
configMap:
377+
name: custom-logos-config
378+
key: masthead-dark-logo.svg
379+
- type: Masthead
380+
themes:
381+
- mode: Light
382+
source:
383+
from: ConfigMap
384+
configMap:
385+
name: custom-logos-config
386+
key: masthead-light-logo.svg
387+
expectedError: "spec.customization.logos[1]: Duplicate value: map[string]interface {}{\"type\":\"Masthead\"}"
388+
- name: Should not allow both logos and customLogoFile to be set
389+
initial: |
390+
apiVersion: operator.openshift.io/v1
391+
kind: Console
392+
spec:
393+
customization:
394+
logos:
395+
- type: Masthead
396+
themes:
397+
- mode: Dark
398+
source:
399+
from: ConfigMap
400+
configMap:
401+
name: custom-logos-config
402+
key: masthead-dark-logo.svg
403+
- mode: Light
404+
source:
405+
from: ConfigMap
406+
configMap:
407+
name: custom-logos-config
408+
key: masthead-light-logo.svg
409+
customLogoFile:
410+
name: custom-logos-config
411+
key: custom-logo.svg
412+
expectedError: 'spec.customization: Invalid value: "object": Only one of logos or customLogoFile can be set'
413+
- name: Should not allow invalid file extension in source.configMap.key
414+
initial: |
415+
apiVersion: operator.openshift.io/v1
416+
kind: Console
417+
spec:
418+
customization:
419+
logos:
420+
- type: Masthead
421+
themes:
422+
- mode: Dark
423+
source:
424+
from: ConfigMap
425+
configMap:
426+
name: custom-logos-config
427+
key: invalid-key.invalidextension
428+
expectedError: 'spec.customization.logos[0].themes[0].source.configMap.key: Invalid value: "string": The ConfigMap key must end with a valid file extension (2 to 5 letters).'
429+
- name: Should not allow invalid characters in source.configMap.name
430+
initial: |
431+
apiVersion: operator.openshift.io/v1
432+
kind: Console
433+
spec:
434+
customization:
435+
logos:
436+
- type: Masthead
437+
themes:
438+
- mode: Dark
439+
source:
440+
from: ConfigMap
441+
configMap:
442+
name: invalid name!
443+
key: masthead-dark-logo.svg
444+
expectedError: "spec.customization.logos[0].themes[0].source.configMap.name: Invalid value: \"string\": a lowercase RFC 1123 subdomain must consist of lower case alphanumeric characters, '-' or '.', and must start and end with an alphanumeric character."
445+
- name: Should fail validation if ConfigMap is not set when From is ConfigMap
446+
initial: |
447+
apiVersion: operator.openshift.io/v1
448+
kind: Console
449+
spec:
450+
customization:
451+
logos:
452+
- type: Masthead
453+
themes:
454+
- mode: Dark
455+
source:
456+
from: ConfigMap
457+
expectedError: "spec.customization.logos[0].themes[0].source: Invalid value: \"object\": configMap is required when from is 'ConfigMap', and forbidden otherwise."
458+
- name: Should fail validation if ConfigMap is set and From is invalid source
459+
initial: |
460+
apiVersion: operator.openshift.io/v1
461+
kind: Console
462+
spec:
463+
customization:
464+
logos:
465+
- type: Masthead
466+
themes:
467+
- mode: Dark
468+
source:
469+
from: InvalidSource
470+
configMap:
471+
name: custom-logos-config
472+
key: masthead-dark-logo.svg
473+
expectedError: "spec.customization.logos[0].themes[0].source.from: Unsupported value: \"InvalidSource\": supported values: \"ConfigMap\""

0 commit comments

Comments
 (0)