diff --git a/console/OWNERS b/console/OWNERS new file mode 100644 index 00000000000..f6d5d3f5f62 --- /dev/null +++ b/console/OWNERS @@ -0,0 +1,3 @@ +reviewers: + - benjaminapetersen + - spadgett diff --git a/console/install.go b/console/install.go new file mode 100644 index 00000000000..147d023b7b7 --- /dev/null +++ b/console/install.go @@ -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} +} diff --git a/console/v1/doc.go b/console/v1/doc.go new file mode 100644 index 00000000000..c08b5b519b2 --- /dev/null +++ b/console/v1/doc.go @@ -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 diff --git a/console/v1/register.go b/console/v1/register.go new file mode 100644 index 00000000000..383c896138c --- /dev/null +++ b/console/v1/register.go @@ -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 +} diff --git a/console/v1/types.go b/console/v1/types.go new file mode 100644 index 00000000000..3dea7005aba --- /dev/null +++ b/console/v1/types.go @@ -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"` +} diff --git a/console/v1/types_console_cli_download.go b/console/v1/types_console_cli_download.go new file mode 100644 index 00000000000..00844a03c65 --- /dev/null +++ b/console/v1/types_console_cli_download.go @@ -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"` +} diff --git a/console/v1/types_console_link.go b/console/v1/types_console_link.go new file mode 100644 index 00000000000..11cd6b2d67b --- /dev/null +++ b/console/v1/types_console_link.go @@ -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"` +} diff --git a/console/v1/types_console_notification.go b/console/v1/types_console_notification.go new file mode 100644 index 00000000000..b4347fe3a37 --- /dev/null +++ b/console/v1/types_console_notification.go @@ -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"` +} diff --git a/console/v1/zz_generated.deepcopy.go b/console/v1/zz_generated.deepcopy.go new file mode 100644 index 00000000000..df09edd21e2 --- /dev/null +++ b/console/v1/zz_generated.deepcopy.go @@ -0,0 +1,264 @@ +// +build !ignore_autogenerated + +// Code generated by deepcopy-gen. DO NOT EDIT. + +package v1 + +import ( + runtime "k8s.io/apimachinery/pkg/runtime" +) + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ConsoleCLIDownload) DeepCopyInto(out *ConsoleCLIDownload) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ConsoleCLIDownload. +func (in *ConsoleCLIDownload) DeepCopy() *ConsoleCLIDownload { + if in == nil { + return nil + } + out := new(ConsoleCLIDownload) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ConsoleCLIDownload) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ConsoleCLIDownloadList) DeepCopyInto(out *ConsoleCLIDownloadList) { + *out = *in + out.TypeMeta = in.TypeMeta + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]ConsoleCLIDownload, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ConsoleCLIDownloadList. +func (in *ConsoleCLIDownloadList) DeepCopy() *ConsoleCLIDownloadList { + if in == nil { + return nil + } + out := new(ConsoleCLIDownloadList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ConsoleCLIDownloadList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ConsoleCLIDownloadSpec) DeepCopyInto(out *ConsoleCLIDownloadSpec) { + *out = *in + if in.Links != nil { + in, out := &in.Links, &out.Links + *out = make([]Link, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ConsoleCLIDownloadSpec. +func (in *ConsoleCLIDownloadSpec) DeepCopy() *ConsoleCLIDownloadSpec { + if in == nil { + return nil + } + out := new(ConsoleCLIDownloadSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ConsoleLink) DeepCopyInto(out *ConsoleLink) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + out.Spec = in.Spec + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ConsoleLink. +func (in *ConsoleLink) DeepCopy() *ConsoleLink { + if in == nil { + return nil + } + out := new(ConsoleLink) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ConsoleLink) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ConsoleLinkList) DeepCopyInto(out *ConsoleLinkList) { + *out = *in + out.TypeMeta = in.TypeMeta + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]ConsoleLink, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ConsoleLinkList. +func (in *ConsoleLinkList) DeepCopy() *ConsoleLinkList { + if in == nil { + return nil + } + out := new(ConsoleLinkList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ConsoleLinkList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ConsoleLinkSpec) DeepCopyInto(out *ConsoleLinkSpec) { + *out = *in + out.Link = in.Link + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ConsoleLinkSpec. +func (in *ConsoleLinkSpec) DeepCopy() *ConsoleLinkSpec { + if in == nil { + return nil + } + out := new(ConsoleLinkSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ConsoleNotification) DeepCopyInto(out *ConsoleNotification) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ConsoleNotification. +func (in *ConsoleNotification) DeepCopy() *ConsoleNotification { + if in == nil { + return nil + } + out := new(ConsoleNotification) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ConsoleNotification) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ConsoleNotificationList) DeepCopyInto(out *ConsoleNotificationList) { + *out = *in + out.TypeMeta = in.TypeMeta + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]ConsoleNotification, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ConsoleNotificationList. +func (in *ConsoleNotificationList) DeepCopy() *ConsoleNotificationList { + if in == nil { + return nil + } + out := new(ConsoleNotificationList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ConsoleNotificationList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ConsoleNotificationSpec) DeepCopyInto(out *ConsoleNotificationSpec) { + *out = *in + if in.Link != nil { + in, out := &in.Link, &out.Link + *out = new(Link) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ConsoleNotificationSpec. +func (in *ConsoleNotificationSpec) DeepCopy() *ConsoleNotificationSpec { + if in == nil { + return nil + } + out := new(ConsoleNotificationSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Link) DeepCopyInto(out *Link) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Link. +func (in *Link) DeepCopy() *Link { + if in == nil { + return nil + } + out := new(Link) + in.DeepCopyInto(out) + return out +} diff --git a/console/v1/zz_generated.swagger_doc_generated.go b/console/v1/zz_generated.swagger_doc_generated.go new file mode 100644 index 00000000000..c81196a9a86 --- /dev/null +++ b/console/v1/zz_generated.swagger_doc_generated.go @@ -0,0 +1,108 @@ +package v1 + +// This file contains a collection of methods that can be used from go-restful to +// generate Swagger API documentation for its models. Please read this PR for more +// information on the implementation: https://github.com/emicklei/go-restful/pull/215 +// +// TODOs are ignored from the parser (e.g. TODO(andronat):... || TODO:...) if and only if +// they are on one line! For multiple line or blocks that you want to ignore use ---. +// Any context after a --- is ignored. +// +// Those methods can be generated by using hack/update-swagger-docs.sh + +// AUTO-GENERATED FUNCTIONS START HERE +var map_Link = map[string]string{ + "": "Represents a standard link that could be generated in HTML", + "text": "text is the display text for the link", + "href": "href is the absolute secure URL for the link (must use https)", +} + +func (Link) SwaggerDoc() map[string]string { + return map_Link +} + +var map_ConsoleCLIDownload = map[string]string{ + "": "ConsoleCLIDownload is an extension for configuring openshift web console command line interface (CLI) downloads.", + "metadata": "Standard object's metadata.", +} + +func (ConsoleCLIDownload) SwaggerDoc() map[string]string { + return map_ConsoleCLIDownload +} + +var map_ConsoleCLIDownloadList = map[string]string{ + "metadata": "Standard object's metadata.", +} + +func (ConsoleCLIDownloadList) SwaggerDoc() map[string]string { + return map_ConsoleCLIDownloadList +} + +var map_ConsoleCLIDownloadSpec = map[string]string{ + "": "ConsoleCLIDownloadSpec is the desired cli download configuration.", + "displayName": "displayName is the display name of the CLI download.", + "description": "description is the description of the CLI download (can include markdown).", + "links": "links is a list of objects that provide CLI download link details.", +} + +func (ConsoleCLIDownloadSpec) SwaggerDoc() map[string]string { + return map_ConsoleCLIDownloadSpec +} + +var map_ConsoleLink = map[string]string{ + "": "ConsoleLink is an extension for customizing OpenShift web console links.", + "metadata": "Standard object's metadata.", +} + +func (ConsoleLink) SwaggerDoc() map[string]string { + return map_ConsoleLink +} + +var map_ConsoleLinkList = map[string]string{ + "metadata": "Standard object's metadata.", +} + +func (ConsoleLinkList) SwaggerDoc() map[string]string { + return map_ConsoleLinkList +} + +var map_ConsoleLinkSpec = map[string]string{ + "": "ConsoleLinkSpec is the desired console link configuration.", + "location": "location determines which location in the console the link will be appended to.", +} + +func (ConsoleLinkSpec) SwaggerDoc() map[string]string { + return map_ConsoleLinkSpec +} + +var map_ConsoleNotification = map[string]string{ + "": "ConsoleNotification is the extension for configuring openshift web console notifications.", + "metadata": "Standard object's metadata.", +} + +func (ConsoleNotification) SwaggerDoc() map[string]string { + return map_ConsoleNotification +} + +var map_ConsoleNotificationList = map[string]string{ + "metadata": "Standard object's metadata.", +} + +func (ConsoleNotificationList) SwaggerDoc() map[string]string { + return map_ConsoleNotificationList +} + +var map_ConsoleNotificationSpec = map[string]string{ + "": "ConsoleNotificationSpec is the desired console notification configuration.", + "text": "text is the visible text of the notification.", + "location": "location is the location of the notification in the console.", + "link": "link is an object that holds notification link details.", + "color": "color is the color of the text for the notification as CSS data type color.", + "backgroundColor": "backgroundColor is the color of the background for the notification as CSS data type color.", +} + +func (ConsoleNotificationSpec) SwaggerDoc() map[string]string { + return map_ConsoleNotificationSpec +} + +// AUTO-GENERATED FUNCTIONS END HERE diff --git a/hack/lib/init.sh b/hack/lib/init.sh index ecda5d0cb8c..9b2c2e7d6de 100644 --- a/hack/lib/init.sh +++ b/hack/lib/init.sh @@ -13,6 +13,7 @@ API_GROUP_VERSIONS="\ apps/v1 \ authorization/v1 \ build/v1 \ +console/v1 \ config/v1 \ image/v1 \ kubecontrolplane/v1 \ diff --git a/hack/update-deepcopy.sh b/hack/update-deepcopy.sh index c159baea754..b9a2a21ba34 100755 --- a/hack/update-deepcopy.sh +++ b/hack/update-deepcopy.sh @@ -10,6 +10,7 @@ verify="${VERIFY:-}" ${CODEGEN_PKG}/generate-groups.sh "deepcopy" \ github.com/openshift/api/generated \ github.com/openshift/api \ - "apps:v1 authorization:v1 build:v1 config:v1 image:v1,docker10,dockerpre012 kubecontrolplane:v1 legacyconfig:v1 network:v1 oauth:v1 openshiftcontrolplane:v1 operator:v1 operator:v1alpha1 osin:v1 project:v1 quota:v1 route:v1 security:v1 servicecertsigner:v1alpha1 template:v1 user:v1 webconsole:v1" \ + "apps:v1 authorization:v1 build:v1 config:v1 console:v1 image:v1,docker10,dockerpre012 kubecontrolplane:v1 legacyconfig:v1 network:v1 oauth:v1 openshiftcontrolplane:v1 operator:v1 operator:v1alpha1 osin:v1 project:v1 quota:v1 route:v1 security:v1 servicecertsigner:v1alpha1 template:v1 user:v1 webconsole:v1" \ --go-header-file ${SCRIPT_ROOT}/hack/empty.txt \ ${verify} +