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
3 changes: 3 additions & 0 deletions console/OWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
reviewers:
- benjaminapetersen
- spadgett
26 changes: 26 additions & 0 deletions console/install.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package console

import (
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"

consolev1 "github.com/openshift/api/console/v1"
)

const (
GroupName = "console.openshift.io"
)

var (
schemeBuilder = runtime.NewSchemeBuilder(consolev1.Install)
// Install is a function which adds every version of this group to a scheme
Install = schemeBuilder.AddToScheme
)

func Resource(resource string) schema.GroupResource {
return schema.GroupResource{Group: GroupName, Resource: resource}
}

func Kind(kind string) schema.GroupKind {
return schema.GroupKind{Group: GroupName, Kind: kind}
}
7 changes: 7 additions & 0 deletions console/v1/doc.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// +k8s:deepcopy-gen=package,register
// +k8s:defaulter-gen=TypeMeta
// +k8s:openapi-gen=true

// +groupName=console.openshift.io
// Package v1 is the v1 version of the API.
package v1
40 changes: 40 additions & 0 deletions console/v1/register.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package v1

import (
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
)

var (
GroupName = "console.openshift.io"
GroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1"}
schemeBuilder = runtime.NewSchemeBuilder(addKnownTypes, corev1.AddToScheme)
// Install is a function which adds this version to a scheme
Install = schemeBuilder.AddToScheme

// SchemeGroupVersion generated code relies on this name
// Deprecated
SchemeGroupVersion = GroupVersion
// AddToScheme exists solely to keep the old generators creating valid code
// DEPRECATED
AddToScheme = schemeBuilder.AddToScheme
)

// Resource generated code relies on this being here, but it logically belongs to the group
// DEPRECATED
func Resource(resource string) schema.GroupResource {
return schema.GroupResource{Group: GroupName, Resource: resource}
}

// addKnownTypes adds types to API group
func addKnownTypes(scheme *runtime.Scheme) error {
scheme.AddKnownTypes(GroupVersion,
&ConsoleLink{},
&ConsoleCLIDownload{},
&ConsoleNotification{},
)
metav1.AddToGroupVersion(scheme, GroupVersion)
return nil
}
9 changes: 9 additions & 0 deletions console/v1/types.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package v1

// Represents a standard link that could be generated in HTML
type Link struct {
// text is the display text for the link
Text string `json:"text"`
// href is the absolute secure URL for the link (must use https)
Href string `json:"href"`
}
34 changes: 34 additions & 0 deletions console/v1/types_console_cli_download.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package v1

import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

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

// ConsoleCLIDownload is an extension for configuring openshift web console command line interface (CLI) downloads.
type ConsoleCLIDownload struct {
metav1.TypeMeta `json:",inline"`
// Standard object's metadata.
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec ConsoleCLIDownloadSpec `json:"spec"`
}

// ConsoleCLIDownloadSpec is the desired cli download configuration.
type ConsoleCLIDownloadSpec struct {
// displayName is the display name of the CLI download.
DisplayName string `json:"displayName"`
// description is the description of the CLI download (can include markdown).
Description string `json:"description"`
// links is a list of objects that provide CLI download link details.
Links []Link `json:"links"`
}

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

type ConsoleCLIDownloadList struct {
metav1.TypeMeta `json:",inline"`
// Standard object's metadata.
metav1.ListMeta `json:"metadata"`
Items []ConsoleCLIDownload `json:"items"`
}
41 changes: 41 additions & 0 deletions console/v1/types_console_link.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package v1

import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

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

// ConsoleLink is an extension for customizing OpenShift web console links.
type ConsoleLink struct {
metav1.TypeMeta `json:",inline"`
// Standard object's metadata.
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec ConsoleLinkSpec `json:"spec"`
}

// ConsoleLinkSpec is the desired console link configuration.
type ConsoleLinkSpec struct {
Link `json:",inline"`
// location determines which location in the console the link will be appended to.
Location ConsoleLinkLocation `json:"location"`
}

// ConsoleLinkLocationSelector is a set of possible menu targets to which a link may be appended.
type ConsoleLinkLocation string

const (
// HelpMenu indicates that the link should appear in the help menu in the console.
HelpMenu ConsoleLinkLocation = "HelpMenu"
// UserMenu indicates that the link should appear in the user menu in the console.
UserMenu ConsoleLinkLocation = "UserMenu"
)

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

type ConsoleLinkList struct {
metav1.TypeMeta `json:",inline"`
// Standard object's metadata.
metav1.ListMeta `json:"metadata"`
Items []ConsoleLink `json:"items"`
}
55 changes: 55 additions & 0 deletions console/v1/types_console_notification.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
package v1

import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

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

// ConsoleNotification is the extension for configuring openshift web console notifications.
type ConsoleNotification struct {
metav1.TypeMeta `json:",inline"`
// Standard object's metadata.
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec ConsoleNotificationSpec `json:"spec"`
}

// ConsoleNotificationSpec is the desired console notification configuration.
type ConsoleNotificationSpec struct {
// text is the visible text of the notification.
Text string `json:"text"`
// location is the location of the notification in the console.
// +optional
Location ConsoleNotificationLocation `json:"location,omitempty"`
// link is an object that holds notification link details.
// +optional
Link *Link `json:"link,omitempty"`
// color is the color of the text for the notification as CSS data type color.
// +optional
Color string `json:"color,omitempty"`
// backgroundColor is the color of the background for the notification as CSS data type color.
// +optional
BackgroundColor string `json:"backgroundColor,omitempty"`
}

// ConsoleNotificationLocationSelector is a set of possible notification targets
// to which a notification may be appended.
type ConsoleNotificationLocation string

const (
// BannerTop indicates that the notification should appear at the top of the console.
BannerTop ConsoleNotificationLocation = "BannerTop"
// BannerBottom indicates that the notification should appear at the bottom of the console.
BannerBottom ConsoleNotificationLocation = "BannerBottom"
// BannerTopBottom indicates that the notification should appear both at the top and at the bottom of the console.
BannerTopBottom ConsoleNotificationLocation = "BannerTopBottom"
)

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

type ConsoleNotificationList struct {
metav1.TypeMeta `json:",inline"`
// Standard object's metadata.
metav1.ListMeta `json:"metadata"`
Items []ConsoleNotification `json:"items"`
}
Loading