Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use meta ResourceEditor #280

Merged
merged 1 commit into from
Jan 18, 2024
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 go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ require (
kmodules.xyz/custom-resources v0.29.0
kmodules.xyz/go-containerregistry v0.0.12
kmodules.xyz/monitoring-agent-api v0.29.0
kmodules.xyz/resource-metadata v0.18.2-0.20240118082955-d3f44ca9bc03
kmodules.xyz/resource-metadata v0.18.2-0.20240118143554-f415526b8139
kmodules.xyz/resource-metrics v0.29.0
kmodules.xyz/sets v0.29.0
kubeops.dev/scanner v0.0.16
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -3456,8 +3456,8 @@ kmodules.xyz/monitoring-agent-api v0.29.0 h1:gpFl6OZrlMLb/ySMHdREI9EwGtnJ91oZBn9
kmodules.xyz/monitoring-agent-api v0.29.0/go.mod h1:iNbvaMTgVFOI5q2LJtGK91j4Dmjv4ZRiRdasGmWLKQI=
kmodules.xyz/offshoot-api v0.29.0 h1:GHLhxxT9jU1N8+FvOCCeJNyU5g0duYS46UGrs6AHNLY=
kmodules.xyz/offshoot-api v0.29.0/go.mod h1:5NxhBblXoDHWStx9HCDJR2KFTwYjEZ7i1Id3jelIunw=
kmodules.xyz/resource-metadata v0.18.2-0.20240118082955-d3f44ca9bc03 h1:fnVoqjoufs9zq0pbNb/fGBLwbTfaUIQOnGdWawD7MrY=
kmodules.xyz/resource-metadata v0.18.2-0.20240118082955-d3f44ca9bc03/go.mod h1:I9HeSgkshwzwUy0IDhp4yIfRFbFQJ21syeSf4NsB04o=
kmodules.xyz/resource-metadata v0.18.2-0.20240118143554-f415526b8139 h1:5aMsW8E+Cgvp5jgec/a7j8pQ2zfD00TyiZTuLu+Vw+0=
kmodules.xyz/resource-metadata v0.18.2-0.20240118143554-f415526b8139/go.mod h1:I9HeSgkshwzwUy0IDhp4yIfRFbFQJ21syeSf4NsB04o=
kmodules.xyz/resource-metrics v0.29.0 h1:YBSVCbGdAugUqZK4igHu3fPhxvpYar4xejE6njryNM4=
kmodules.xyz/resource-metrics v0.29.0/go.mod h1:OuG/QobZ7o8GFHl/u3lqaUR0fDZDegxtV8Vdh+MNBD4=
kmodules.xyz/sets v0.29.0 h1:ZX/qOECzUob95JhhRtngJElHSlJ1UNNdwK4hTEy+nl0=
Expand Down
1 change: 0 additions & 1 deletion pkg/apiserver/apiserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@ func init() {
policyinstall.Install(Scheme)
costinstall.Install(Scheme)
rsinstall.Install(Scheme)
Scheme.AddKnownTypes(rsapi.SchemeGroupVersion, &uiapi.ResourceEditorList{}, &uiapi.ResourceEditor{})
uiinstall.Install(Scheme)
rscoreinstall.Install(Scheme)
mgmtinstall.Install(Scheme)
Expand Down
10 changes: 5 additions & 5 deletions pkg/registry/meta/resourceeditor/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ func (r *Storage) GetSingularName() string {

// Getter
func (r *Storage) New() runtime.Object {
return &uiapi.ResourceEditor{}
return &rsapi.ResourceEditor{}
}

func (r *Storage) Destroy() {}
Expand All @@ -87,7 +87,7 @@ func (r *Storage) Get(ctx context.Context, name string, options *metav1.GetOptio

// Lister
func (r *Storage) NewList() runtime.Object {
return &uiapi.ResourceEditorList{}
return &rsapi.ResourceEditorList{}
}

func (r *Storage) List(ctx context.Context, options *metainternalversion.ListOptions) (runtime.Object, error) {
Expand All @@ -111,20 +111,20 @@ func (r *Storage) List(ctx context.Context, options *metainternalversion.ListOpt
objs = objs[:options.Limit]
}

items := make([]uiapi.ResourceEditor, 0, len(objs))
items := make([]rsapi.ResourceEditor, 0, len(objs))
for _, obj := range objs {
if options.LabelSelector != nil && !options.LabelSelector.Matches(labels.Set(obj.GetLabels())) {
continue
}
items = append(items, *complete(obj.DeepCopy()))
}

return &uiapi.ResourceEditorList{Items: items}, nil
return &rsapi.ResourceEditorList{Items: items}, nil
}

var podNamespace = meta_util.PodNamespace()

func complete(obj *uiapi.ResourceEditor) *uiapi.ResourceEditor {
func complete(obj *rsapi.ResourceEditor) *rsapi.ResourceEditor {
if obj.Spec.UI == nil {
return obj
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ func addKnownTypes(scheme *runtime.Scheme) error {
&ResourceTableDefinitionList{},
&ResourceBlockDefinition{},
&ResourceBlockDefinitionList{},
&ResourceEditor{},
&ResourceEditorList{},
&ResourceOutline{},
&ResourceOutlineList{},
&ResourceLayout{},
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*
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 uiapi "kmodules.xyz/resource-metadata/apis/ui/v1alpha1"

type (
ResourceEditor = uiapi.ResourceEditor
ResourceEditorList = uiapi.ResourceEditorList
)
2 changes: 1 addition & 1 deletion vendor/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1952,7 +1952,7 @@ kmodules.xyz/monitoring-agent-api/client
# kmodules.xyz/offshoot-api v0.29.0
## explicit; go 1.21.5
kmodules.xyz/offshoot-api/api/v1
# kmodules.xyz/resource-metadata v0.18.2-0.20240118082955-d3f44ca9bc03
# kmodules.xyz/resource-metadata v0.18.2-0.20240118143554-f415526b8139
## explicit; go 1.21.5
kmodules.xyz/resource-metadata/apis/core/install
kmodules.xyz/resource-metadata/apis/core/v1alpha1
Expand Down
Loading