1 // Copyright 2020 Datawire. All rights reserved 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 package v1 16 17 import ( 18 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" 19 20 ambv2 "github.com/emissary-ingress/emissary/v3/pkg/api/getambassador.io/v2" 21 ) 22 23 // DevPortal is the Schema for the DevPortals API 24 // 25 // DevPortal resources specify the `what` and `how` is shown in a DevPortal: 26 // 27 // 1. `what` is in a DevPortal can be controlled with 28 // 29 // - a `selector`, that can be used for filtering `Mappings`. 30 // 31 // - a `docs` listing of (services, url) 32 // 33 // 2. `how` is a pointer to some `contents` (a checkout of a Git repository 34 // with go-templates/markdown/css). 35 // 36 // Multiple `DevPortal`s can exist in the cluster, and the Dev Portal server 37 // will show them at different endpoints. A `DevPortal` resource with a special 38 // name, `ambassador`, will be used for configuring the default Dev Portal 39 // (served at `/docs/` by default). 40 // 41 // +kubebuilder:object:root=true 42 // +kubebuilder:resource:path=devportals,scope=Namespaced 43 type DevPortal struct { 44 metav1.TypeMeta `json:""` 45 metav1.ObjectMeta `json:"metadata,omitempty"` 46 47 Spec ambv2.DevPortalSpec `json:"spec,omitempty"` 48 49 // dumbWorkaround is a dumb workaround for a bug in conversion-gen that it doesn't pay 50 // attention to +k8s:conversion-fn=drop or +k8s:conversion-gen=false when checking if it can 51 // do the direct-assignment or direct-conversion optimizations, and therefore might disobey 52 // the +k8s:conversion-fn=drop on metav1.TypeMeta. 53 // 54 // +k8s:conversion-gen=false 55 dumbWorkaround byte `json:"-"` //nolint:unused // dumb workaround 56 } 57 58 // DevPortalList contains a list of DevPortals. 59 // 60 // +kubebuilder:object:root=true 61 type DevPortalList struct { 62 metav1.TypeMeta `json:""` 63 metav1.ListMeta `json:"metadata,omitempty"` 64 Items []DevPortal `json:"items"` 65 } 66 67 func init() { 68 SchemeBuilder.Register(&DevPortal{}, &DevPortalList{}) 69 } 70