From 5684396561e9fe679a4660bc75dc7f79f0642cac Mon Sep 17 00:00:00 2001 From: "Benjamin A. Petersen" Date: Thu, 16 May 2019 14:23:57 -0400 Subject: [PATCH 1/5] Add manifest for ConsoleLink CRD - Related to https://github.com/openshift/console/pull/1360 --- manifests/00-crd-extension-console-link.yaml | 61 ++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 manifests/00-crd-extension-console-link.yaml diff --git a/manifests/00-crd-extension-console-link.yaml b/manifests/00-crd-extension-console-link.yaml new file mode 100644 index 0000000000..0131de30be --- /dev/null +++ b/manifests/00-crd-extension-console-link.yaml @@ -0,0 +1,61 @@ +apiVersion: apiextensions.k8s.io/v1beta1 +kind: CustomResourceDefinition +metadata: + name: consolelinks.console.openshift.io + annotations: + displayName: ConsoleLinks + description: Extension for customizing OpenShift web console links +spec: + # TODO: + # this relates to where the API resources live in openshift/api + # likely under /config/console, which might make it something like: + # extensions.console.config.openshift.io? + group: console.openshift.io + version: v1 + versions: + - name: v1 + served: true + storage: true + scope: Cluster + names: + plural: consolelinks + singular: consolelink + kind: ConsoleLink + listKind: ConsoleLinkList + additionalPrinterColumns: + - name: Text + type: string + JSONPath: .spec.text + - name: URL + type: string + JSONPath: .spec.href + - name: Menu + type: string + JSONPath: .spec.menu + - name: Age + type: date + JSONPath: .metadata.creationTimestamp + subresources: + status: {} + validation: + openAPIV3Schema: + properties: + spec: + type: object + description: Represents console link customizations spec + required: + - text + - href + - menu + properties: + text: + type: string + description: Text of the link + href: + type: string + description: URL for the link + pattern: '^http(s)?://([\w-]+.)+[\w-]+(/[\w- ./?%&=])?$' + menu: + type: string + description: Determines which dropdown menu the link is added to (help, user) + pattern: '\bhelp\b|\buser\b' From 01c468ee2ce8b003445ad32a6a8adec25a93a061 Mon Sep 17 00:00:00 2001 From: "Benjamin A. Petersen" Date: Thu, 16 May 2019 14:25:35 -0400 Subject: [PATCH 2/5] Add manifest for ConsoleCLIDownload CRD - Related to https://github.com/openshift/console/pull/1441 --- manifests/00-crd-extension-console-cli.yaml | 66 +++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 manifests/00-crd-extension-console-cli.yaml diff --git a/manifests/00-crd-extension-console-cli.yaml b/manifests/00-crd-extension-console-cli.yaml new file mode 100644 index 0000000000..f787c1b26a --- /dev/null +++ b/manifests/00-crd-extension-console-cli.yaml @@ -0,0 +1,66 @@ +apiVersion: apiextensions.k8s.io/v1beta1 +kind: CustomResourceDefinition +metadata: + name: consoleclidownloads.console.openshift.io + annotations: + displayName: ConsoleCLIDownload + description: Extension for configuring openshift web console command line interface (CLI) downloads. +spec: + # TODO: + # this relates to where the API resources live in openshift/api + # likely under /config/console, which might make it something like: + # extensions.console.config.openshift.io? + group: console.openshift.io + version: v1 + versions: + - name: v1 + served: true + storage: true + scope: Cluster + names: + plural: consoleclidownloads + singular: consoleclidownload + kind: ConsoleCLIDownload + listKind: ConsoleCLIDownloadList + additionalPrinterColumns: + - name: Display name + type: string + JSONPath: .spec.displayName + - name: Age + type: string + JSONPath: .metadata.creationTimestamp + - name: Description + type: string + JSONPath: .spec.description + subresources: + status: {} + validation: + openAPIV3Schema: + properties: + spec: + type: object + description: Represents console CLI download spec + required: + - displayName + - description + - link + properties: + displayName: + type: string + description: Display name of the CLI download + description: + type: string + description: Description of the CLI download (can include markdown) + link: + type: object + description: Object that holds CLI download link details + required: + - href + properties: + text: + type: string + description: Text of the link + href: + type: string + description: Absolute secure URL for the link (must use https) + pattern: '^https://([\w-]+.)+[\w-]+(/[\w- ./?%&=])?$' From fa61a9bf764b9d32ccbc6e608eb8dcb0a3171c07 Mon Sep 17 00:00:00 2001 From: "Benjamin A. Petersen" Date: Thu, 16 May 2019 14:27:30 -0400 Subject: [PATCH 3/5] Add manifest for ConsoleNotification CRD - Related to https://github.com/openshift/console/pull/1542 --- manifests/00-crd-extension-console-cli.yaml | 4 -- manifests/00-crd-extension-console-link.yaml | 4 -- ...extension-console-notification-banner.yaml | 65 +++++++++++++++++++ 3 files changed, 65 insertions(+), 8 deletions(-) create mode 100644 manifests/00-crd-extension-console-notification-banner.yaml diff --git a/manifests/00-crd-extension-console-cli.yaml b/manifests/00-crd-extension-console-cli.yaml index f787c1b26a..9a7b908b63 100644 --- a/manifests/00-crd-extension-console-cli.yaml +++ b/manifests/00-crd-extension-console-cli.yaml @@ -6,10 +6,6 @@ metadata: displayName: ConsoleCLIDownload description: Extension for configuring openshift web console command line interface (CLI) downloads. spec: - # TODO: - # this relates to where the API resources live in openshift/api - # likely under /config/console, which might make it something like: - # extensions.console.config.openshift.io? group: console.openshift.io version: v1 versions: diff --git a/manifests/00-crd-extension-console-link.yaml b/manifests/00-crd-extension-console-link.yaml index 0131de30be..ab2dbd1ffd 100644 --- a/manifests/00-crd-extension-console-link.yaml +++ b/manifests/00-crd-extension-console-link.yaml @@ -6,10 +6,6 @@ metadata: displayName: ConsoleLinks description: Extension for customizing OpenShift web console links spec: - # TODO: - # this relates to where the API resources live in openshift/api - # likely under /config/console, which might make it something like: - # extensions.console.config.openshift.io? group: console.openshift.io version: v1 versions: diff --git a/manifests/00-crd-extension-console-notification-banner.yaml b/manifests/00-crd-extension-console-notification-banner.yaml new file mode 100644 index 0000000000..7131ee44b5 --- /dev/null +++ b/manifests/00-crd-extension-console-notification-banner.yaml @@ -0,0 +1,65 @@ +apiVersion: apiextensions.k8s.io/v1beta1 +kind: CustomResourceDefinition +metadata: + name: consolenotificationbanners.console.openshift.io + annotations: + displayName: ConsoleNotification + description: Extension for configuring openshift web console notifications. +spec: + group: console.openshift.io + version: v1 + versions: + - name: v1 + served: true + storage: true + scope: Cluster + names: + plural: consolenotifications + singular: consolenotification + kind: ConsoleNotification + listKind: ConsoleNotificationList + additionalPrinterColumns: + - name: Text + type: string + JSONPath: .spec.text + - name: Age + type: date + JSONPath: .metadata.creationTimestamp + subresources: + status: {} + validation: + openAPIV3Schema: + properties: + spec: + type: object + description: Represents console notification spec + required: + - text + - position + properties: + text: + type: string + description: Text of the notification + position: + type: string + description: The location of the notification (top, bottom, topBottom) + pattern: '\btop\b|\bbottom\b|\btopBottom\b' + link: + type: object + description: Object that holds notification link details + required: + - href + properties: + text: + type: string + description: Text of the link + href: + type: string + description: Absolute URL for the link + pattern: '^http(s)?://([\w-]+.)+[\w-]+(/[\w- ./?%&=])?$' + backgroundColor: + type: string + description: The background color for the notification + color: + type: string + description: The color of the text for the notification From 6df3412a6c159a0e972d1fd7a2d08915216e2068 Mon Sep 17 00:00:00 2001 From: "Benjamin A. Petersen" Date: Thu, 23 May 2019 09:56:09 -0400 Subject: [PATCH 4/5] Add RBAC for console extensions --- manifests/03-rbac-role-cluster-extensions.yaml | 17 +++++++++++++++++ manifests/04-rbac-rolebinding.yaml | 13 +++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 manifests/03-rbac-role-cluster-extensions.yaml diff --git a/manifests/03-rbac-role-cluster-extensions.yaml b/manifests/03-rbac-role-cluster-extensions.yaml new file mode 100644 index 0000000000..9a88ef890a --- /dev/null +++ b/manifests/03-rbac-role-cluster-extensions.yaml @@ -0,0 +1,17 @@ +# any logged-in user authenticated through the +# console needs READONLY access to these resources +kind: ClusterRole +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: console-extensions +rules: +- apiGroups: + - console.openshift.io + resources: + - consolelinks + - consoleclidownloads + - consolenotificationbanners + verbs: + - get + - list + - watch diff --git a/manifests/04-rbac-rolebinding.yaml b/manifests/04-rbac-rolebinding.yaml index fd8c92dfb0..66823c1a19 100644 --- a/manifests/04-rbac-rolebinding.yaml +++ b/manifests/04-rbac-rolebinding.yaml @@ -65,3 +65,16 @@ subjects: - kind: Group name: system:authenticated apiGroup: rbac.authorization.k8s.io +--- +kind: RoleBinding +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: console-extensions +roleRef: + kind: Role + name: console-extensions + apiGroup: rbac.authorization.k8s.io +subjects: +- kind: Group + name: system:authenticated + apiGroup: rbac.authorization.k8s.io From 260818b808a8de32e0dfc091411ad91134830aaf Mon Sep 17 00:00:00 2001 From: "Benjamin A. Petersen" Date: Thu, 23 May 2019 14:17:12 -0400 Subject: [PATCH 5/5] Adjustments to custom resource manfiests --- ...0-crd-extension-console-cli-download.yaml} | 35 ++++++++++--------- manifests/00-crd-extension-console-link.yaml | 15 ++++---- ...0-crd-extension-console-notification.yaml} | 25 +++++++------ .../03-rbac-role-cluster-extensions.yaml | 4 +-- manifests/04-rbac-rolebinding-cluster.yaml | 12 +++++++ manifests/04-rbac-rolebinding.yaml | 13 ------- 6 files changed, 54 insertions(+), 50 deletions(-) rename manifests/{00-crd-extension-console-cli.yaml => 00-crd-extension-console-cli-download.yaml} (68%) rename manifests/{00-crd-extension-console-notification-banner.yaml => 00-crd-extension-console-notification.yaml} (67%) create mode 100644 manifests/04-rbac-rolebinding-cluster.yaml diff --git a/manifests/00-crd-extension-console-cli.yaml b/manifests/00-crd-extension-console-cli-download.yaml similarity index 68% rename from manifests/00-crd-extension-console-cli.yaml rename to manifests/00-crd-extension-console-cli-download.yaml index 9a7b908b63..3d576e54f4 100644 --- a/manifests/00-crd-extension-console-cli.yaml +++ b/manifests/00-crd-extension-console-cli-download.yaml @@ -6,13 +6,12 @@ metadata: displayName: ConsoleCLIDownload description: Extension for configuring openshift web console command line interface (CLI) downloads. spec: + scope: Cluster group: console.openshift.io - version: v1 versions: - name: v1 served: true storage: true - scope: Cluster names: plural: consoleclidownloads singular: consoleclidownload @@ -39,7 +38,7 @@ spec: required: - displayName - description - - link + - links properties: displayName: type: string @@ -47,16 +46,20 @@ spec: description: type: string description: Description of the CLI download (can include markdown) - link: - type: object - description: Object that holds CLI download link details - required: - - href - properties: - text: - type: string - description: Text of the link - href: - type: string - description: Absolute secure URL for the link (must use https) - pattern: '^https://([\w-]+.)+[\w-]+(/[\w- ./?%&=])?$' + links: + type: array + description: Objects that hold CLI download link details + nullable: true + items: + type: object + required: + - href + properties: + text: + type: string + description: Text of the link + href: + type: string + description: Absolute secure URL for the link (must use https) + pattern: '^https://([\w-]+.)+[\w-]+(/[\w- ./?%&=])?$' + diff --git a/manifests/00-crd-extension-console-link.yaml b/manifests/00-crd-extension-console-link.yaml index ab2dbd1ffd..5fc9650971 100644 --- a/manifests/00-crd-extension-console-link.yaml +++ b/manifests/00-crd-extension-console-link.yaml @@ -6,13 +6,12 @@ metadata: displayName: ConsoleLinks description: Extension for customizing OpenShift web console links spec: + scope: Cluster group: console.openshift.io - version: v1 versions: - name: v1 served: true storage: true - scope: Cluster names: plural: consolelinks singular: consolelink @@ -42,16 +41,16 @@ spec: required: - text - href - - menu + - location properties: text: type: string description: Text of the link href: type: string - description: URL for the link - pattern: '^http(s)?://([\w-]+.)+[\w-]+(/[\w- ./?%&=])?$' - menu: + description: Absolute secure URL for the link (must use https) + pattern: '^https://([\w-]+.)+[\w-]+(/[\w- ./?%&=])?$' + location: type: string - description: Determines which dropdown menu the link is added to (help, user) - pattern: '\bhelp\b|\buser\b' + description: Determines which dropdown menu the link is added to (HelpMenu, UserMenu) + pattern: '\bHelpMenu\b|\bUserMenu\b' diff --git a/manifests/00-crd-extension-console-notification-banner.yaml b/manifests/00-crd-extension-console-notification.yaml similarity index 67% rename from manifests/00-crd-extension-console-notification-banner.yaml rename to manifests/00-crd-extension-console-notification.yaml index 7131ee44b5..e90ac4e220 100644 --- a/manifests/00-crd-extension-console-notification-banner.yaml +++ b/manifests/00-crd-extension-console-notification.yaml @@ -1,18 +1,17 @@ apiVersion: apiextensions.k8s.io/v1beta1 kind: CustomResourceDefinition metadata: - name: consolenotificationbanners.console.openshift.io + name: consolenotifications.console.openshift.io annotations: displayName: ConsoleNotification description: Extension for configuring openshift web console notifications. spec: + scope: Cluster group: console.openshift.io - version: v1 versions: - name: v1 served: true storage: true - scope: Cluster names: plural: consolenotifications singular: consolenotification @@ -22,6 +21,9 @@ spec: - name: Text type: string JSONPath: .spec.text + - name: Location + type: string + JSONPath: .spec.location - name: Age type: date JSONPath: .metadata.creationTimestamp @@ -35,31 +37,32 @@ spec: description: Represents console notification spec required: - text - - position + - location properties: text: type: string description: Text of the notification - position: + location: type: string - description: The location of the notification (top, bottom, topBottom) - pattern: '\btop\b|\bbottom\b|\btopBottom\b' + description: The location of the notification (BannerTop, BannerBottom, BannerTopBottom) + pattern: '^(BannerTop|BannerBottom|BannerTopBottom)$' link: type: object description: Object that holds notification link details required: - href + - text properties: text: type: string description: Text of the link href: type: string - description: Absolute URL for the link - pattern: '^http(s)?://([\w-]+.)+[\w-]+(/[\w- ./?%&=])?$' + description: Absolute secure URL for the link (must use https) + pattern: '^https://([\w-]+.)+[\w-]+(/[\w- ./?%&=])?$' backgroundColor: type: string - description: The background color for the notification + description: The background color for the notification as CSS data type color color: type: string - description: The color of the text for the notification + description: The color of the text for the notification as CSS data type color diff --git a/manifests/03-rbac-role-cluster-extensions.yaml b/manifests/03-rbac-role-cluster-extensions.yaml index 9a88ef890a..5bbf186843 100644 --- a/manifests/03-rbac-role-cluster-extensions.yaml +++ b/manifests/03-rbac-role-cluster-extensions.yaml @@ -3,14 +3,14 @@ kind: ClusterRole apiVersion: rbac.authorization.k8s.io/v1 metadata: - name: console-extensions + name: console-extensions-reader rules: - apiGroups: - console.openshift.io resources: - consolelinks - consoleclidownloads - - consolenotificationbanners + - consolenotifications verbs: - get - list diff --git a/manifests/04-rbac-rolebinding-cluster.yaml b/manifests/04-rbac-rolebinding-cluster.yaml new file mode 100644 index 0000000000..dbf3cba5da --- /dev/null +++ b/manifests/04-rbac-rolebinding-cluster.yaml @@ -0,0 +1,12 @@ +kind: ClusterRoleBinding +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: console-extensions-reader +roleRef: + kind: ClusterRole + name: console-extensions-reader + apiGroup: rbac.authorization.k8s.io +subjects: +- kind: Group + name: system:authenticated + apiGroup: rbac.authorization.k8s.io diff --git a/manifests/04-rbac-rolebinding.yaml b/manifests/04-rbac-rolebinding.yaml index 66823c1a19..fd8c92dfb0 100644 --- a/manifests/04-rbac-rolebinding.yaml +++ b/manifests/04-rbac-rolebinding.yaml @@ -65,16 +65,3 @@ subjects: - kind: Group name: system:authenticated apiGroup: rbac.authorization.k8s.io ---- -kind: RoleBinding -apiVersion: rbac.authorization.k8s.io/v1 -metadata: - name: console-extensions -roleRef: - kind: Role - name: console-extensions - apiGroup: rbac.authorization.k8s.io -subjects: -- kind: Group - name: system:authenticated - apiGroup: rbac.authorization.k8s.io