Skip to content

Commit

Permalink
Implement basic api for resourceManifests (#357)
Browse files Browse the repository at this point in the history
Signed-off-by: Arnob kumar saha <[email protected]>
ArnobKumarSaha authored Jan 27, 2025
1 parent 2b514f3 commit b6b9cd4
Showing 2,223 changed files with 620,631 additions and 411 deletions.
91 changes: 88 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
@@ -52,12 +52,13 @@ require (
kmodules.xyz/go-containerregistry v0.0.12
kmodules.xyz/monitoring-agent-api v0.30.4
kmodules.xyz/offshoot-api v0.30.1
kmodules.xyz/resource-metadata v0.24.2
kmodules.xyz/resource-metadata v0.24.3-0.20250127043106-3dc2cd2a29af
kmodules.xyz/resource-metrics v0.30.5
kmodules.xyz/resource-metrics/utils v0.30.4
kmodules.xyz/sets v0.29.0
kubeops.dev/falco-ui-server v0.0.4
kubeops.dev/scanner v0.0.18
kubepack.dev/lib-app v0.1.0
kubepack.dev/lib-helm v0.29.13
open-cluster-management.io/api v0.15.0
sigs.k8s.io/cli-utils v0.37.2
@@ -68,54 +69,105 @@ require (
)

require (
cloud.google.com/go v0.115.0 // indirect
cloud.google.com/go/auth v0.7.2 // indirect
cloud.google.com/go/auth/oauth2adapt v0.2.3 // indirect
cloud.google.com/go/compute/metadata v0.5.0 // indirect
cloud.google.com/go/iam v1.1.10 // indirect
cloud.google.com/go/monitoring v1.20.1 // indirect
cloud.google.com/go/storage v1.41.0 // indirect
cloud.google.com/go/trace v1.10.11 // indirect
filippo.io/edwards25519 v1.1.0 // indirect
github.com/AdaLogics/go-fuzz-headers v0.0.0-20230811130428-ced1acdcaa24 // indirect
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.12.0 // indirect
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 // indirect
github.com/Azure/azure-sdk-for-go/sdk/internal v1.9.0 // indirect
github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v1.3.1 // indirect
github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 // indirect
github.com/Azure/go-autorest v14.2.0+incompatible // indirect
github.com/Azure/go-autorest/autorest/to v0.4.0 // indirect
github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2 // indirect
github.com/BurntSushi/toml v1.4.0 // indirect
github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp v1.20.0 // indirect
github.com/GoogleCloudPlatform/opentelemetry-operations-go/exporter/metric v0.44.0 // indirect
github.com/GoogleCloudPlatform/opentelemetry-operations-go/internal/resourcemapping v0.44.0 // indirect
github.com/MakeNowJust/heredoc v1.0.0 // indirect
github.com/Masterminds/goutils v1.1.1 // indirect
github.com/Masterminds/semver/v3 v3.3.0 // indirect
github.com/Masterminds/squirrel v1.5.4 // indirect
github.com/NYTimes/gziphandler v1.1.1 // indirect
github.com/OneOfOne/xxhash v1.2.8 // indirect
github.com/PuerkitoBio/purell v1.2.1 // indirect
github.com/agnivade/levenshtein v1.1.1 // indirect
github.com/alessio/shellescape v1.4.2 // indirect
github.com/antlr/antlr4/runtime/Go/antlr/v4 v4.0.0-20230305170008-8188dc5388df // indirect
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 // indirect
github.com/aws/aws-sdk-go v1.51.14 // indirect
github.com/aws/aws-sdk-go v1.54.15 // indirect
github.com/aws/aws-sdk-go-v2 v1.27.0 // indirect
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.6.1 // indirect
github.com/aws/aws-sdk-go-v2/config v1.27.15 // indirect
github.com/aws/aws-sdk-go-v2/credentials v1.17.15 // indirect
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.3 // indirect
github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.16.9 // indirect
github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.7 // indirect
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.7 // indirect
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.0 // indirect
github.com/aws/aws-sdk-go-v2/internal/v4a v1.3.3 // indirect
github.com/aws/aws-sdk-go-v2/service/ecr v1.27.4 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.11.2 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.3.5 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.9 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.17.3 // indirect
github.com/aws/aws-sdk-go-v2/service/s3 v1.51.4 // indirect
github.com/aws/aws-sdk-go-v2/service/sso v1.20.8 // indirect
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.24.2 // indirect
github.com/aws/aws-sdk-go-v2/service/sts v1.28.9 // indirect
github.com/aws/smithy-go v1.20.2 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/blang/semver/v4 v4.0.0 // indirect
github.com/cenkalti/backoff/v4 v4.3.0 // indirect
github.com/cert-manager/cert-manager v1.15.4 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/chai2010/gettext-go v1.0.3 // indirect
github.com/containerd/containerd v1.7.21 // indirect
github.com/containerd/errdefs v0.1.0 // indirect
github.com/containerd/log v0.1.0 // indirect
github.com/containerd/platforms v0.2.1 // indirect
github.com/containerd/stargz-snapshotter/estargz v0.15.1 // indirect
github.com/coreos/go-semver v0.3.1 // indirect
github.com/coreos/go-systemd/v22 v22.5.0 // indirect
github.com/cyphar/filepath-securejoin v0.3.4 // indirect
github.com/dapr/go-sdk v1.8.0 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/distribution/reference v0.6.0 // indirect
github.com/docker/cli v27.1.1+incompatible // indirect
github.com/docker/distribution v2.8.3+incompatible // indirect
github.com/docker/docker v27.0.3+incompatible // indirect
github.com/docker/docker-credential-helpers v0.8.2 // indirect
github.com/docker/go-connections v0.5.0 // indirect
github.com/docker/go-metrics v0.0.1 // indirect
github.com/dominikbraun/graph v0.23.0 // indirect
github.com/dustin/go-humanize v1.0.1 // indirect
github.com/emicklei/go-restful/v3 v3.12.1 // indirect
github.com/envoyproxy/gateway v1.1.2 // indirect
github.com/evanphx/json-patch v5.9.0+incompatible // indirect
github.com/evanphx/json-patch/v5 v5.9.0 // indirect
github.com/exponent-io/jsonpath v0.0.0-20210407135951-1de76d718b3f // indirect
github.com/fatih/camelcase v1.0.0 // indirect
github.com/fatih/color v1.17.0 // indirect
github.com/fatih/structs v1.1.0 // indirect
github.com/felixge/httpsnoop v1.0.4 // indirect
github.com/fluxcd/pkg/apis/acl v0.3.0 // indirect
github.com/fluxcd/pkg/apis/kustomize v1.5.0 // indirect
github.com/fluxcd/pkg/apis/meta v1.5.0 // indirect
github.com/fluxcd/pkg/oci v0.37.1 // indirect
github.com/fluxcd/pkg/version v0.4.0 // indirect
github.com/fsnotify/fsnotify v1.7.0 // indirect
github.com/fvbommel/sortorder v1.1.0 // indirect
github.com/gabriel-vasile/mimetype v1.4.3 // indirect
github.com/ghodss/yaml v1.0.0 // indirect
github.com/go-errors/errors v1.5.1 // indirect
github.com/go-gorp/gorp/v3 v3.1.0 // indirect
github.com/go-ini/ini v1.67.0 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-openapi/jsonpointer v0.21.0 // indirect
@@ -124,6 +176,7 @@ require (
github.com/go-sql-driver/mysql v1.8.1 // indirect
github.com/gobwas/glob v0.2.3 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang-jwt/jwt/v5 v5.2.1 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/google/btree v1.1.2 // indirect
@@ -134,43 +187,61 @@ require (
github.com/google/go-containerregistry v0.19.2 // indirect
github.com/google/s2a-go v0.1.7 // indirect
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect
github.com/google/wire v0.6.0 // indirect
github.com/googleapis/enterprise-certificate-proxy v0.3.2 // indirect
github.com/googleapis/gax-go/v2 v2.13.0 // indirect
github.com/gorilla/mux v1.8.1 // indirect
github.com/gorilla/websocket v1.5.1 // indirect
github.com/gosuri/uitable v0.0.4 // indirect
github.com/gregjones/httpcache v0.0.0-20190611155906-901d90724c79 // indirect
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/hashicorp/golang-lru v0.5.4 // indirect
github.com/hexops/gotextdiff v1.0.3 // indirect
github.com/huandu/xstrings v1.5.0 // indirect
github.com/imdario/mergo v1.0.0 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/jmespath/go-jmespath v0.4.1-0.20220621161143-b0104c826a24 // indirect
github.com/jmoiron/sqlx v1.3.5 // indirect
github.com/jonboulle/clockwork v0.4.0 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/jpillora/backoff v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/compress v1.17.9 // indirect
github.com/klauspost/cpuid/v2 v2.2.7 // indirect
github.com/kylelemons/godebug v1.1.0 // indirect
github.com/lann/builder v0.0.0-20180802200727-47ae307949d0 // indirect
github.com/lann/ps v0.0.0-20150810152359-62de8c46ede0 // indirect
github.com/lib/pq v1.10.9 // indirect
github.com/liggitt/tabwriter v0.0.0-20181228230101-89fcab3d43de // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mattn/go-runewidth v0.0.15 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
github.com/mitchellh/copystructure v1.2.0 // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/mitchellh/go-wordwrap v1.0.1 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/mitchellh/reflectwalk v1.0.2 // indirect
github.com/moby/locker v1.0.1 // indirect
github.com/moby/spdystream v0.2.0 // indirect
github.com/moby/term v0.5.0 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/monochromegane/go-gitignore v0.0.0-20200626010858-205db1a8cc00 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f // indirect
github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f // indirect
github.com/onsi/gomega v1.34.1 // indirect
github.com/open-policy-agent/frameworks/constraint v0.0.0-20240802234259-aa99306df54e // indirect
github.com/open-policy-agent/opa v0.68.0 // indirect
github.com/opencontainers/go-digest v1.0.0 // indirect
github.com/opencontainers/image-spec v1.1.0 // indirect
github.com/peterbourgon/diskv v2.0.1+incompatible // indirect
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/prometheus/client_model v0.6.1 // indirect
github.com/prometheus/common v0.55.0 // indirect
@@ -179,6 +250,9 @@ require (
github.com/rancher/rancher/pkg/client v0.0.0-20240710123941-93e332156bbe // indirect
github.com/rancher/wrangler/v3 v3.0.0 // indirect
github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect
github.com/rivo/uniseg v0.4.7 // indirect
github.com/rubenv/sql-migrate v1.6.1 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/sergi/go-diff v1.3.1 // indirect
github.com/shopspring/decimal v1.4.0 // indirect
github.com/sirupsen/logrus v1.9.3 // indirect
@@ -193,7 +267,6 @@ require (
github.com/yashtewari/glob-intersection v0.2.0 // indirect
github.com/yudai/gojsondiff v1.0.0 // indirect
github.com/yudai/golcs v0.0.0-20170316035057-ecda9a501e82 // indirect
go.etcd.io/bbolt v1.3.10 // indirect
go.etcd.io/etcd/api/v3 v3.6.0-alpha.0 // indirect
go.etcd.io/etcd/client/pkg/v3 v3.5.14 // indirect
go.etcd.io/etcd/client/v3 v3.5.14 // indirect
@@ -215,6 +288,7 @@ require (
go.starlark.net v0.0.0-20240520160348-046347dcd104 // indirect
go.uber.org/multierr v1.11.0 // indirect
go.uber.org/zap v1.27.0 // indirect
gocloud.dev v0.37.0 // indirect
golang.org/x/crypto v0.31.0 // indirect
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 // indirect
golang.org/x/net v0.33.0 // indirect
@@ -223,13 +297,17 @@ require (
golang.org/x/term v0.27.0 // indirect
golang.org/x/text v0.21.0 // indirect
golang.org/x/time v0.6.0 // indirect
golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 // indirect
gomodules.xyz/atomic-writer v0.0.2 // indirect
gomodules.xyz/bits v0.0.0-20241124114357-b668409c1b67 // indirect
gomodules.xyz/blobfs v0.1.14 // indirect
gomodules.xyz/clock v0.0.0-20200817085942-06523dba733f // indirect
gomodules.xyz/encoding v0.0.8 // indirect
gomodules.xyz/flags v0.1.3 // indirect
gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect
gomodules.xyz/jsonpatch/v3 v3.0.1 // indirect
gomodules.xyz/mergo v0.3.13 // indirect
gomodules.xyz/orderedmap v0.1.0 // indirect
gomodules.xyz/wait v0.2.0 // indirect
google.golang.org/api v0.189.0 // indirect
google.golang.org/genproto v0.0.0-20240722135656-d784300faade // indirect
@@ -246,12 +324,17 @@ require (
k8s.io/cli-runtime v0.30.2 // indirect
k8s.io/component-helpers v0.30.2 // indirect
k8s.io/kms v0.30.3 // indirect
k8s.io/kube-aggregator v0.30.2 // indirect
k8s.io/kubectl v0.30.2 // indirect
kmodules.xyz/apply v0.29.0 // indirect
kubedb.dev/apimachinery v0.51.0 // indirect
kubeops.dev/external-dns-operator v0.0.9 // indirect
kubeops.dev/petset v0.0.7 // indirect
kubeops.dev/sidekick v0.0.10 // indirect
kubepack.dev/kubepack v0.29.2-0.20250112054702-b0d39a0fbb50 // indirect
kubevault.dev/apimachinery v0.19.0 // indirect
moul.io/http2curl/v2 v2.3.1-0.20221024080105-10c404f653f7 // indirect
oras.land/oras-go v1.2.5 // indirect
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.30.3 // indirect
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
sigs.k8s.io/kustomize/api v0.17.2 // indirect
@@ -279,3 +362,5 @@ replace github.com/prometheus/common => github.com/prometheus/common v0.44.0
replace github.com/google/cel-go => github.com/google/cel-go v0.17.8

replace go.etcd.io/etcd/client/v3 => go.etcd.io/etcd/client/v3 v3.5.10

replace helm.sh/helm/v3 => github.com/x-helm/helm/v3 v3.15.1-0.20240519042544-f489f30bb34d
265 changes: 259 additions & 6 deletions go.sum

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions pkg/apiserver/apiserver.go
Original file line number Diff line number Diff line change
@@ -61,6 +61,7 @@ import (
"kubeops.dev/ui-server/pkg/registry/meta/resourceeditor"
"kubeops.dev/ui-server/pkg/registry/meta/resourcegraph"
"kubeops.dev/ui-server/pkg/registry/meta/resourcelayout"
"kubeops.dev/ui-server/pkg/registry/meta/resourcemanifests"
"kubeops.dev/ui-server/pkg/registry/meta/resourceoutline"
"kubeops.dev/ui-server/pkg/registry/meta/resourceoutlinefilter"
"kubeops.dev/ui-server/pkg/registry/meta/resourcequery"
@@ -115,6 +116,7 @@ import (
metricsserver "sigs.k8s.io/controller-runtime/pkg/metrics/server"
gwv1 "sigs.k8s.io/gateway-api/apis/v1"
chartsapi "x-helm.dev/apimachinery/apis/charts/v1alpha1"
xhelmapi "x-helm.dev/apimachinery/apis/drivers/v1alpha1"
)

var (
@@ -140,6 +142,7 @@ func init() {
utilruntime.Must(clientgoscheme.AddToScheme(Scheme))
utilruntime.Must(appcatalogapi.AddToScheme(Scheme))
utilruntime.Must(openvizapi.AddToScheme(Scheme))
utilruntime.Must(xhelmapi.AddToScheme(Scheme))
utilruntime.Must(fluxsrc.AddToScheme(Scheme))
utilruntime.Must(gwv1.Install(Scheme))
utilruntime.Must(monitoringv1.AddToScheme(Scheme))
@@ -336,6 +339,7 @@ func (c completedConfig) New(ctx context.Context) (*UIServer, error) {
v1alpha1storage[rsapi.ResourceResourceGraphs] = resourcegraph.NewStorage(ctrlClient)
v1alpha1storage[rsapi.ResourceResourceLayouts] = resourcelayout.NewStorage(ctrlClient)
v1alpha1storage[rsapi.ResourceResourceOutlines] = resourceoutline.NewStorage()
v1alpha1storage[rsapi.ResourceResourceManifests] = resourcemanifests.NewStorage(ctrlClient)
v1alpha1storage[rsapi.ResourceResourceOutlineFilters] = resourceoutlinefilter.NewStorage(ctrlClient)
v1alpha1storage[rsapi.ResourceGatewayInfos] = gatewayinfo.NewStorage(ctrlClient)
v1alpha1storage[uiapi.ResourceClusterProfiles] = clusterprofilestorage.NewStorage(ctrlClient)
1 change: 1 addition & 0 deletions pkg/cmds/server/start.go
Original file line number Diff line number Diff line change
@@ -157,6 +157,7 @@ func (o *UIServerOptions) Config() (*apiserver.Config, error) {
fmt.Sprintf("/apis/%s/%s", rsapi.SchemeGroupVersion, rsapi.ResourceResourceGraphs),
fmt.Sprintf("/apis/%s/%s", rsapi.SchemeGroupVersion, rsapi.ResourceResourceLayouts),
fmt.Sprintf("/apis/%s/%s", rsapi.SchemeGroupVersion, rsapi.ResourceResourceOutlines),
fmt.Sprintf("/apis/%s/%s", rsapi.SchemeGroupVersion, rsapi.ResourceResourceManifests),
fmt.Sprintf("/apis/%s/%s", rsapi.SchemeGroupVersion, rsapi.ResourceResourceOutlineFilters),
fmt.Sprintf("/apis/%s/%s", rsapi.SchemeGroupVersion, rsapi.ResourceResourceQueries),
fmt.Sprintf("/apis/%s/%s", rsapi.SchemeGroupVersion, rsapi.ResourceResourceTableDefinitions),
121 changes: 121 additions & 0 deletions pkg/registry/meta/resourcemanifests/storage.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
/*
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 resourcemanifests

import (
"context"
"encoding/json"
"fmt"
"strings"

apierrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apiserver/pkg/registry/rest"
kmapi "kmodules.xyz/client-go/api/v1"
rsapi "kmodules.xyz/resource-metadata/apis/meta/v1alpha1"
"kubepack.dev/lib-app/pkg/editor"
"kubepack.dev/lib-helm/pkg/repo"
"sigs.k8s.io/controller-runtime/pkg/client"
releasesapi "x-helm.dev/apimachinery/apis/releases/v1alpha1"
)

type Storage struct {
kc client.Client
}

var (
_ rest.GroupVersionKindProvider = &Storage{}
_ rest.Scoper = &Storage{}
_ rest.Storage = &Storage{}
_ rest.Creater = &Storage{}
_ rest.SingularNameProvider = &Storage{}
)

func NewStorage(kc client.Client) *Storage {
return &Storage{
kc: kc,
}
}

func (r *Storage) GroupVersionKind(_ schema.GroupVersion) schema.GroupVersionKind {
return rsapi.SchemeGroupVersion.WithKind(rsapi.ResourceKindResourceManifests)
}

func (r *Storage) NamespaceScoped() bool {
return false
}

func (r *Storage) GetSingularName() string {
return strings.ToLower(rsapi.ResourceKindResourceManifests)
}

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

func (r *Storage) Destroy() {}

var DefaultCache = repo.DefaultDiskCache()

func NewRegistry(kc client.Client) repo.IRegistry {
return repo.NewRegistry(kc, DefaultCache)
}

func (r *Storage) Create(ctx context.Context, obj runtime.Object, createValidation rest.ValidateObjectFunc, options *metav1.CreateOptions) (runtime.Object, error) {
manifests, ok := obj.(*rsapi.ResourceManifests)
if !ok {
return nil, fmt.Errorf("invalid object type: %T", obj)
}
if manifests.Request == nil {
return nil, apierrors.NewBadRequest("missing apirequest")
}

reg := NewRegistry(r.kc)
metadata := releasesapi.ModelMetadata{Metadata: releasesapi.Metadata{
Resource: kmapi.ResourceID{
Group: manifests.Request.Group,
Version: manifests.Request.Version,
Kind: manifests.Request.Kind,
},
Release: releasesapi.ObjectMeta{
Name: manifests.Request.Name,
Namespace: manifests.Request.Namespace,
},
}}
tpl, err := editor.LoadResourceEditorModel(r.kc, reg, metadata)
if err != nil {
return nil, err
}

mp := make(map[string]runtime.RawExtension)
for _, resource := range tpl.Resources {
kmapi.NewObjectID(resource.Data).OID()
rawJSON, err := json.Marshal(resource.Data)
if err != nil {
fmt.Printf("Error marshalling unstructured object: %v\n", err)
return nil, err
}
mp[string(kmapi.NewObjectID(resource.Data).OID())] = runtime.RawExtension{Raw: rawJSON}
}
manifests.Response = rsapi.ResourceManifestsResponse{
Objects: mp,
}
return manifests, nil
}
202 changes: 202 additions & 0 deletions vendor/cloud.google.com/go/LICENSE
189 changes: 189 additions & 0 deletions vendor/cloud.google.com/go/iam/CHANGES.md
202 changes: 202 additions & 0 deletions vendor/cloud.google.com/go/iam/LICENSE
40 changes: 40 additions & 0 deletions vendor/cloud.google.com/go/iam/README.md
672 changes: 672 additions & 0 deletions vendor/cloud.google.com/go/iam/apiv1/iampb/iam_policy.pb.go

Large diffs are not rendered by default.

187 changes: 187 additions & 0 deletions vendor/cloud.google.com/go/iam/apiv1/iampb/options.pb.go
1,180 changes: 1,180 additions & 0 deletions vendor/cloud.google.com/go/iam/apiv1/iampb/policy.pb.go

Large diffs are not rendered by default.

17 changes: 17 additions & 0 deletions vendor/cloud.google.com/go/iam/credentials/apiv1/auxiliary.go

Large diffs are not rendered by default.

Large diffs are not rendered by default.

122 changes: 122 additions & 0 deletions vendor/cloud.google.com/go/iam/credentials/apiv1/doc.go

Large diffs are not rendered by default.

23 changes: 23 additions & 0 deletions vendor/cloud.google.com/go/iam/credentials/apiv1/version.go
387 changes: 387 additions & 0 deletions vendor/cloud.google.com/go/iam/iam.go
18 changes: 18 additions & 0 deletions vendor/cloud.google.com/go/iam/internal/version.go
2,952 changes: 2,952 additions & 0 deletions vendor/cloud.google.com/go/internal/.repo-metadata-full.json

Large diffs are not rendered by default.

29 changes: 29 additions & 0 deletions vendor/cloud.google.com/go/internal/README.md
55 changes: 55 additions & 0 deletions vendor/cloud.google.com/go/internal/annotate.go
46 changes: 46 additions & 0 deletions vendor/cloud.google.com/go/internal/gen_info.sh
108 changes: 108 additions & 0 deletions vendor/cloud.google.com/go/internal/optional/optional.go
76 changes: 76 additions & 0 deletions vendor/cloud.google.com/go/internal/retry.go
275 changes: 275 additions & 0 deletions vendor/cloud.google.com/go/internal/trace/trace.go
19 changes: 19 additions & 0 deletions vendor/cloud.google.com/go/internal/version/update_version.sh
71 changes: 71 additions & 0 deletions vendor/cloud.google.com/go/internal/version/version.go
Loading

0 comments on commit b6b9cd4

Please sign in to comment.