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
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ COMPRESS ?= no
# CRD_OPTIONS ?= "crd:trivialVersions=true"
CRD_OPTIONS ?= "crd:allowDangerousTypes=true,crdVersions={v1}"
CODE_GENERATOR_IMAGE ?= ghcr.io/appscode/gengo:release-1.32
API_GROUPS ?= core:v1alpha1 identity:v1alpha1 management:v1alpha1 meta:v1alpha1 node:v1alpha1 ui:v1alpha1
API_GROUPS ?= core:v1alpha1 editor:v1alpha1 identity:v1alpha1 management:v1alpha1 meta:v1alpha1 node:v1alpha1 ui:v1alpha1

# Where to push the docker image.
REGISTRY ?= appscode
Expand Down
21 changes: 21 additions & 0 deletions apis/editor/doc.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/*
Copyright AppsCode Inc. and Contributors

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package editor

const (
GroupName = "editor.ui.k8s.appscode.com"
)
30 changes: 30 additions & 0 deletions apis/editor/install/install.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
Copyright AppsCode Inc. and Contributors

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package install

import (
"kmodules.xyz/resource-metadata/apis/editor/v1alpha1"

"k8s.io/apimachinery/pkg/runtime"
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
)

// Install registers the API group and adds types to a scheme
func Install(scheme *runtime.Scheme) {
utilruntime.Must(v1alpha1.AddToScheme(scheme))
utilruntime.Must(scheme.SetVersionPriority(v1alpha1.SchemeGroupVersion))
}
23 changes: 23 additions & 0 deletions apis/editor/v1alpha1/doc.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
Copyright AppsCode Inc. and Contributors

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

// Package v1alpha1 is the v1alpha1 version of the API.

// +k8s:deepcopy-gen=package,register
// +k8s:openapi-gen=true
// +k8s:defaulter-gen=TypeMeta
// +groupName=editor.ui.k8s.appscode.com
package v1alpha1
80 changes: 80 additions & 0 deletions apis/editor/v1alpha1/editortemplate_types.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
/*
Copyright AppsCode Inc. and Contributors

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package v1alpha1

import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
releasesapi "x-helm.dev/apimachinery/apis/releases/v1alpha1"
)

const (
ResourceKindEditorTemplate = "EditorTemplate"
ResourceEditorTemplate = "editortemplate"
ResourceEditorTemplates = "editortemplates"
)

// EditorTemplate loads the editor model, manifest and resources for an existing
// installation identified by its metadata. It is the aggregated-API equivalent
// of kubepack.dev/lib-app/pkg/editor.LoadResourceEditorModel (see
// chart_template.go loadEditorModel2).
//
// +genclient
// +genclient:nonNamespaced
// +genclient:onlyVerbs=create
// +k8s:openapi-gen=true
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// +kubebuilder:object:root=true
// +kubebuilder:resource:scope=Cluster
type EditorTemplate struct {
metav1.TypeMeta `json:",inline"`
// Request identifies the installation to load.
// +optional
Request *EditorTemplateRequest `json:"request,omitempty"`
// Response holds the loaded editor template.
// +optional
Response *EditorTemplateResponse `json:"response,omitempty"`
}

type EditorTemplateRequest struct {
releasesapi.ModelMetadata `json:",inline"`
// ChartRef optionally selects the chart source. When unset, the resource
// editor chart resolved from the metadata resource is used.
// +optional
ChartRef *releasesapi.ChartSourceFlatRef `json:"chartRef,omitempty"`
}

type EditorTemplateResponse struct {
// Manifest is the rendered manifest of the existing installation.
// +optional
Manifest string `json:"manifest,omitempty"`
// Values is the editor model (values) of the existing installation.
// +optional
Values *runtime.RawExtension `json:"values,omitempty"`
// Resources holds the individual resources of the existing installation.
// +optional
Resources []EditorTemplateResource `json:"resources,omitempty"`
}

type EditorTemplateResource struct {
// +optional
Filename string `json:"filename,omitempty"`
// +optional
Key string `json:"key,omitempty"`
// +optional
Data *runtime.RawExtension `json:"data,omitempty"`
}
Loading
Loading