Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
200 changes: 200 additions & 0 deletions console/v1/0000_10_consolequickstart.crd.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,200 @@
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
name: consolequickstarts.console.openshift.io
annotations:
include.release.openshift.io/self-managed-high-availability: "true"
displayName: ConsoleQuickStart
description: Extension for guiding user through various workflows in the OpenShift
web console.
spec:
scope: Cluster
group: console.openshift.io
preserveUnknownFields: false
versions:
- name: v1
served: true
storage: true
names:
plural: consolequickstarts
singular: consolequickstart
kind: ConsoleQuickStart
listKind: ConsoleQuickStartList
"validation":
"openAPIV3Schema":
description: ConsoleQuickStart is an extension for guiding user through various
workflows in the OpenShift web console.
type: object
required:
- spec
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
type: string
kind:
description: 'Kind is a string value representing the REST resource this
object represents. Servers may infer this from the endpoint the client
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
metadata:
type: object
spec:
description: ConsoleQuickStartSpec is the desired quick start configuration.
type: object
required:
- description
- displayName
- durationMinutes
- introduction
- tasks
properties:
accessReviewResources:
description: accessReviewResources contains a list of resources that
the user's access will be reviewed against in order for the user to
complete the Quick Start. The Quick Start will be hidden if any of
the access reviews fail.
type: array
items:
description: ResourceAttributes includes the authorization attributes
available for resource requests to the Authorizer interface
type: object
properties:
group:
description: Group is the API Group of the Resource. "*" means
all.
type: string
name:
description: Name is the name of the resource being requested
for a "get" or deleted for a "delete". "" (empty) means all.
type: string
namespace:
description: Namespace is the namespace of the action being requested. Currently,
there is no distinction between no namespace and all namespaces
"" (empty) is defaulted for LocalSubjectAccessReviews "" (empty)
is empty for cluster-scoped resources "" (empty) means "all"
for namespace scoped resources from a SubjectAccessReview or
SelfSubjectAccessReview
type: string
resource:
description: Resource is one of the existing resource types. "*"
means all.
type: string
subresource:
description: Subresource is one of the existing resource types. ""
means none.
type: string
verb:
description: 'Verb is a kubernetes resource API verb, like: get,
list, watch, create, update, delete, proxy. "*" means all.'
type: string
version:
description: Version is the API Version of the Resource. "*"
means all.
type: string
conclusion:
description: conclusion sums up the Quick Start and suggests the possible
next steps. (includes markdown)
type: string
description:
description: description is the description of the Quick Start. (includes
markdown)
type: string
maxLength: 256
minLength: 1
displayName:
description: displayName is the display name of the Quick Start.
type: string
minLength: 1
durationMinutes:
description: durationMinutes describes approximately how many minutes
it will take to complete the Quick Start.
type: integer
minimum: 1
icon:
description: icon is a base64 encoded image that will be displayed beside
the Quick Start display name. The icon should be an vector image for
easy scaling. The size of the icon should be 40x40.
type: string
introduction:
description: introduction describes the purpose of the Quick Start.
(includes markdown)
type: string
minLength: 1
nextQuickStart:
description: nextQuickStart is a list of the following Quick Starts,
suggested for the user to try.
type: array
items:
type: string
prerequisites:
description: prerequisites contains all prerequisites that need to be
met before taking a Quick Start. (includes markdown)
type: array
items:
type: string
tags:
description: tags is a list of strings that describe the Quick Start.
type: array
items:
type: string
tasks:
description: tasks is the list of steps the user has to perform to complete
the Quick Start.
type: array
minItems: 1
items:
description: ConsoleQuickStartTask is a single step in a Quick Start.
type: object
required:
- description
- title
properties:
description:
description: description describes the steps needed to complete
the task. (includes markdown)
type: string
minLength: 1
review:
description: review contains instructions to validate the task
is complete. The user will select 'Yes' or 'No'. using a radio
button, which indicates whether the step was completed successfully.
type: object
required:
- failedTaskHelp
- instructions
properties:
failedTaskHelp:
description: failedTaskHelp contains suggestions for a failed
task review and is shown at the end of task. (includes markdown)
type: string
minLength: 1
instructions:
description: instructions contains steps that user needs to
take in order to validate his work after going through a
task. (includes markdown)
type: string
minLength: 1
summary:
description: summary contains information about the passed step.
type: object
required:
- failed
- success
properties:
failed:
description: failed briefly describes the unsuccessfully passed
task. (includes markdown)
type: string
maxLength: 128
minLength: 1
success:
description: success describes the succesfully passed task.
type: string
minLength: 1
title:
description: title describes the task and is displayed as a step
heading.
type: string
minLength: 1
2 changes: 2 additions & 0 deletions console/v1/register.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ func addKnownTypes(scheme *runtime.Scheme) error {
&ConsoleExternalLogLinkList{},
&ConsoleYAMLSample{},
&ConsoleYAMLSampleList{},
&ConsoleQuickStart{},
&ConsoleQuickStartList{},
)
metav1.AddToGroupVersion(scheme, GroupVersion)
return nil
Expand Down
132 changes: 132 additions & 0 deletions console/v1/types_console_quick_start.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
package v1

import (
authorizationv1 "k8s.io/api/authorization/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

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

// ConsoleQuickStart is an extension for guiding user through various
// workflows in the OpenShift web console.
type ConsoleQuickStart struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

// +kubebuilder:validation:Required
// +required
Spec ConsoleQuickStartSpec `json:"spec"`
}

// ConsoleQuickStartSpec is the desired quick start configuration.
type ConsoleQuickStartSpec struct {
// displayName is the display name of the Quick Start.
// +kubebuilder:validation:Required
// +kubebuilder:validation:MinLength=1
// +required
DisplayName string `json:"displayName"`
// icon is a base64 encoded image that will be displayed beside the Quick Start display name.
// The icon should be an vector image for easy scaling. The size of the icon should be 40x40.
// +optional
Icon string `json:"icon,omitempty"`
// tags is a list of strings that describe the Quick Start.
// +optional
Tags []string `json:"tags,omitempty"`
// durationMinutes describes approximately how many minutes it will take to complete the Quick Start.
// +kubebuilder:validation:Required
// +kubebuilder:validation:Minimum=1
// +required
DurationMinutes int `json:"durationMinutes"`
// description is the description of the Quick Start. (includes markdown)
// +kubebuilder:validation:Required
// +kubebuilder:validation:MinLength=1
// +kubebuilder:validation:MaxLength=256
// +required
Description string `json:"description"`
// prerequisites contains all prerequisites that need to be met before taking a Quick Start. (includes markdown)
// +optional
Prerequisites []string `json:"prerequisites,omitempty"`
// introduction describes the purpose of the Quick Start. (includes markdown)
// +kubebuilder:validation:Required
// +kubebuilder:validation:MinLength=1
// +required
Introduction string `json:"introduction"`
// tasks is the list of steps the user has to perform to complete the Quick Start.
// +kubebuilder:validation:Required
// +kubebuilder:validation:MinItems=1
// +required
Tasks []ConsoleQuickStartTask `json:"tasks"`
// conclusion sums up the Quick Start and suggests the possible next steps. (includes markdown)
// +optional
Conclusion string `json:"conclusion,omitempty"`
// nextQuickStart is a list of the following Quick Starts, suggested for the user to try.
// +optional
NextQuickStart []string `json:"nextQuickStart,omitempty"`
// accessReviewResources contains a list of resources that the user's access
// will be reviewed against in order for the user to complete the Quick Start.
// The Quick Start will be hidden if any of the access reviews fail.
// +optional
AccessReviewResources []authorizationv1.ResourceAttributes `json:"accessReviewResources,omitempty"`
}

// ConsoleQuickStartTask is a single step in a Quick Start.
type ConsoleQuickStartTask struct {
// title describes the task and is displayed as a step heading.
// +kubebuilder:validation:Required
// +kubebuilder:validation:MinLength=1
// +required
Title string `json:"title"`
// description describes the steps needed to complete the task. (includes markdown)
// +kubebuilder:validation:Required
// +kubebuilder:validation:MinLength=1
// +required
Description string `json:"description"`
// review contains instructions to validate the task is complete. The user will select 'Yes' or 'No'.
// using a radio button, which indicates whether the step was completed successfully.
// +optional
Review *ConsoleQuickStartTaskReview `json:"review,omitempty"`
// summary contains information about the passed step.
// +optional
Summary *ConsoleQuickStartTaskSummary `json:"summary,omitempty"`
}

// ConsoleQuickStartTaskReview contains instructions that validate a task was completed successfully.
type ConsoleQuickStartTaskReview struct {
// instructions contains steps that user needs to take in order
// to validate his work after going through a task. (includes markdown)
// +kubebuilder:validation:Required
// +kubebuilder:validation:MinLength=1
// +required
Instructions string `json:"instructions"`
// failedTaskHelp contains suggestions for a failed task review and is shown at the end of task. (includes markdown)
// +kubebuilder:validation:Required
// +kubebuilder:validation:MinLength=1
// +required
FailedTaskHelp string `json:"failedTaskHelp"`
}

// ConsoleQuickStartTaskSummary contains information about a passed step.
type ConsoleQuickStartTaskSummary struct {
// success describes the succesfully passed task.
// +kubebuilder:validation:Required
// +kubebuilder:validation:MinLength=1
// +required
Success string `json:"success"`
// failed briefly describes the unsuccessfully passed task. (includes markdown)
// +kubebuilder:validation:Required
// +kubebuilder:validation:MinLength=1
// +kubebuilder:validation:MaxLength=128
// +required
Failed string `json:"failed"`
}

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

type ConsoleQuickStartList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata"`

Items []ConsoleQuickStart `json:"items"`
}
Loading