From 2f5d3ac7c6c2b3789f792e4d9be19e688d7223ea Mon Sep 17 00:00:00 2001 From: Imtiaz Uddin <59226374+Imtiaz246@users.noreply.github.com> Date: Sun, 8 Oct 2023 10:51:13 +0600 Subject: [PATCH] Generate and add api for cluster status (#263) Signed-off-by: Tamal Saha Signed-off-by: Imtiaz Uddin Co-authored-by: Tamal Saha --- apis/cost/v1alpha1/openapi_generated.go | 31 +++++ apis/identity/v1alpha1/openapi_generated.go | 31 +++++ apis/policy/v1alpha1/openapi_generated.go | 31 +++++ artifacts/clusterstatus/cs.yaml | 2 + go.mod | 2 +- go.sum | 4 +- pkg/apiserver/apiserver.go | 2 + pkg/cmds/server/start.go | 1 + pkg/registry/meta/clusterstatus/fluxcd.go | 107 +++++++++++++++++ pkg/registry/meta/clusterstatus/status.go | 111 ++++++++++++++++++ pkg/registry/meta/clusterstatus/storage.go | 75 ++++++++++++ .../meta/resourcecalculator/storage.go | 2 +- .../apis/meta/v1alpha1/clusterstatus_types.go | 3 +- .../apis/meta/v1alpha1/openapi_generated.go | 8 +- .../meta/v1alpha1/zz_generated.deepcopy.go | 1 - .../v1alpha1/projects.yaml | 9 ++ .../v1alpha1/projectquotas.yaml | 9 ++ .../v1alpha1/resourcecalculators.yaml | 9 ++ vendor/modules.txt | 2 +- 19 files changed, 425 insertions(+), 15 deletions(-) create mode 100644 artifacts/clusterstatus/cs.yaml create mode 100644 pkg/registry/meta/clusterstatus/fluxcd.go create mode 100644 pkg/registry/meta/clusterstatus/status.go create mode 100644 pkg/registry/meta/clusterstatus/storage.go diff --git a/apis/cost/v1alpha1/openapi_generated.go b/apis/cost/v1alpha1/openapi_generated.go index 49db34716..0cb6afdb9 100644 --- a/apis/cost/v1alpha1/openapi_generated.go +++ b/apis/cost/v1alpha1/openapi_generated.go @@ -339,6 +339,7 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA "k8s.io/apimachinery/pkg/runtime.Unknown": schema_k8sio_apimachinery_pkg_runtime_Unknown(ref), "k8s.io/apimachinery/pkg/util/intstr.IntOrString": schema_apimachinery_pkg_util_intstr_IntOrString(ref), "k8s.io/apimachinery/pkg/version.Info": schema_k8sio_apimachinery_pkg_version_Info(ref), + "kmodules.xyz/client-go/api/v1.CAPIClusterInfo": schema_kmodulesxyz_client_go_api_v1_CAPIClusterInfo(ref), "kmodules.xyz/client-go/api/v1.CertificatePrivateKey": schema_kmodulesxyz_client_go_api_v1_CertificatePrivateKey(ref), "kmodules.xyz/client-go/api/v1.CertificateSpec": schema_kmodulesxyz_client_go_api_v1_CertificateSpec(ref), "kmodules.xyz/client-go/api/v1.ClusterMetadata": schema_kmodulesxyz_client_go_api_v1_ClusterMetadata(ref), @@ -16800,6 +16801,36 @@ func schema_k8sio_apimachinery_pkg_version_Info(ref common.ReferenceCallback) co } } +func schema_kmodulesxyz_client_go_api_v1_CAPIClusterInfo(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "provider": { + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + "namespace": { + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + "clusterName": { + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + } +} + func schema_kmodulesxyz_client_go_api_v1_CertificatePrivateKey(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ diff --git a/apis/identity/v1alpha1/openapi_generated.go b/apis/identity/v1alpha1/openapi_generated.go index d4eb77b62..ef01a3d14 100644 --- a/apis/identity/v1alpha1/openapi_generated.go +++ b/apis/identity/v1alpha1/openapi_generated.go @@ -339,6 +339,7 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA "k8s.io/apimachinery/pkg/runtime.Unknown": schema_k8sio_apimachinery_pkg_runtime_Unknown(ref), "k8s.io/apimachinery/pkg/util/intstr.IntOrString": schema_apimachinery_pkg_util_intstr_IntOrString(ref), "k8s.io/apimachinery/pkg/version.Info": schema_k8sio_apimachinery_pkg_version_Info(ref), + "kmodules.xyz/client-go/api/v1.CAPIClusterInfo": schema_kmodulesxyz_client_go_api_v1_CAPIClusterInfo(ref), "kmodules.xyz/client-go/api/v1.CertificatePrivateKey": schema_kmodulesxyz_client_go_api_v1_CertificatePrivateKey(ref), "kmodules.xyz/client-go/api/v1.CertificateSpec": schema_kmodulesxyz_client_go_api_v1_CertificateSpec(ref), "kmodules.xyz/client-go/api/v1.ClusterMetadata": schema_kmodulesxyz_client_go_api_v1_ClusterMetadata(ref), @@ -16801,6 +16802,36 @@ func schema_k8sio_apimachinery_pkg_version_Info(ref common.ReferenceCallback) co } } +func schema_kmodulesxyz_client_go_api_v1_CAPIClusterInfo(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "provider": { + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + "namespace": { + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + "clusterName": { + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + } +} + func schema_kmodulesxyz_client_go_api_v1_CertificatePrivateKey(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ diff --git a/apis/policy/v1alpha1/openapi_generated.go b/apis/policy/v1alpha1/openapi_generated.go index 79aafba9e..22e4aa017 100644 --- a/apis/policy/v1alpha1/openapi_generated.go +++ b/apis/policy/v1alpha1/openapi_generated.go @@ -339,6 +339,7 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA "k8s.io/apimachinery/pkg/runtime.Unknown": schema_k8sio_apimachinery_pkg_runtime_Unknown(ref), "k8s.io/apimachinery/pkg/util/intstr.IntOrString": schema_apimachinery_pkg_util_intstr_IntOrString(ref), "k8s.io/apimachinery/pkg/version.Info": schema_k8sio_apimachinery_pkg_version_Info(ref), + "kmodules.xyz/client-go/api/v1.CAPIClusterInfo": schema_kmodulesxyz_client_go_api_v1_CAPIClusterInfo(ref), "kmodules.xyz/client-go/api/v1.CertificatePrivateKey": schema_kmodulesxyz_client_go_api_v1_CertificatePrivateKey(ref), "kmodules.xyz/client-go/api/v1.CertificateSpec": schema_kmodulesxyz_client_go_api_v1_CertificateSpec(ref), "kmodules.xyz/client-go/api/v1.ClusterMetadata": schema_kmodulesxyz_client_go_api_v1_ClusterMetadata(ref), @@ -16802,6 +16803,36 @@ func schema_k8sio_apimachinery_pkg_version_Info(ref common.ReferenceCallback) co } } +func schema_kmodulesxyz_client_go_api_v1_CAPIClusterInfo(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "provider": { + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + "namespace": { + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + "clusterName": { + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + } +} + func schema_kmodulesxyz_client_go_api_v1_CertificatePrivateKey(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ diff --git a/artifacts/clusterstatus/cs.yaml b/artifacts/clusterstatus/cs.yaml new file mode 100644 index 000000000..cca0f2e66 --- /dev/null +++ b/artifacts/clusterstatus/cs.yaml @@ -0,0 +1,2 @@ +apiVersion: meta.k8s.appscode.com/v1alpha1 +kind: ClusterStatus diff --git a/go.mod b/go.mod index e875a36da..4d27c203e 100644 --- a/go.mod +++ b/go.mod @@ -46,7 +46,7 @@ require ( kmodules.xyz/custom-resources v0.25.2 kmodules.xyz/go-containerregistry v0.0.11 kmodules.xyz/monitoring-agent-api v0.25.4 - kmodules.xyz/resource-metadata v0.17.25-0.20231006102558-311a1a2eaa10 + kmodules.xyz/resource-metadata v0.17.25-0.20231008042713-ef9e7bdbcfb9 kmodules.xyz/resource-metrics v0.25.3 kmodules.xyz/sets v0.25.0 kubeops.dev/scanner v0.0.15-0.20230929084557-c991a6514ff9 diff --git a/go.sum b/go.sum index fb33d5bd3..562351c81 100644 --- a/go.sum +++ b/go.sum @@ -2141,8 +2141,8 @@ kmodules.xyz/monitoring-agent-api v0.25.4 h1:OwkvtV23QhUy3f7o9lxPWaAW3jiJMGAMPPR kmodules.xyz/monitoring-agent-api v0.25.4/go.mod h1:3LhrLDGQKQXhxYcjA/WNaO4HPpopYQzOutsEp2i3008= kmodules.xyz/offshoot-api v0.25.4 h1:IjJNvkphcdYUG8XO/pBwXpuP8W+jxAWJZ3yH8vgI/as= kmodules.xyz/offshoot-api v0.25.4/go.mod h1:PUk4EuJFhhyQykCflHj7EgXcljGIqs9vi0IN0RpxtY4= -kmodules.xyz/resource-metadata v0.17.25-0.20231006102558-311a1a2eaa10 h1:D1HcIuYxmHG44nQY6r9dm9qKU+pKtPUDiekJaRjbu+o= -kmodules.xyz/resource-metadata v0.17.25-0.20231006102558-311a1a2eaa10/go.mod h1:tyLxzAVkhlL3/jFdcQcX1RZ8i8h9bs+AJur5RcuaW40= +kmodules.xyz/resource-metadata v0.17.25-0.20231008042713-ef9e7bdbcfb9 h1:CNuwviXfHRSi8m8pgYc5CVLvd3jTghDRKgsixbE1ei8= +kmodules.xyz/resource-metadata v0.17.25-0.20231008042713-ef9e7bdbcfb9/go.mod h1:tyLxzAVkhlL3/jFdcQcX1RZ8i8h9bs+AJur5RcuaW40= kmodules.xyz/resource-metrics v0.25.3 h1:g9EjNfYRrUSnbA4r+bUQefQ5Ban6I6rpKjnB3ER+Yew= kmodules.xyz/resource-metrics v0.25.3/go.mod h1:H7YLdUQJXUSzf5cNI4IYWU4Wsmrua/jpw7gqDnE3BwM= kmodules.xyz/sets v0.25.0 h1:belY/3trp/M/CKc1TEteA40jb2uCIdwKHhjpvrIxG+8= diff --git a/pkg/apiserver/apiserver.go b/pkg/apiserver/apiserver.go index c2f3c0f2f..632e27957 100644 --- a/pkg/apiserver/apiserver.go +++ b/pkg/apiserver/apiserver.go @@ -43,6 +43,7 @@ import ( coststorage "kubeops.dev/ui-server/pkg/registry/cost/reports" whoamistorage "kubeops.dev/ui-server/pkg/registry/identity/whoami" "kubeops.dev/ui-server/pkg/registry/meta/chartpresetquery" + clusterstatusstorage "kubeops.dev/ui-server/pkg/registry/meta/clusterstatus" "kubeops.dev/ui-server/pkg/registry/meta/render" "kubeops.dev/ui-server/pkg/registry/meta/renderdashboard" "kubeops.dev/ui-server/pkg/registry/meta/rendermenu" @@ -273,6 +274,7 @@ func (c completedConfig) New(ctx context.Context) (*UIServer, error) { v1alpha1storage := map[string]rest.Storage{} v1alpha1storage[rsapi.ResourceChartPresetQueries] = chartpresetquery.NewStorage(ctrlClient) + v1alpha1storage[rsapi.ResourceClusterStatuses] = clusterstatusstorage.NewStorage(ctrlClient) v1alpha1storage[rsapi.ResourceRenderDashboards] = renderdashboard.NewStorage(ctrlClient, oc) v1alpha1storage[rsapi.ResourceRenderRawGraphs] = renderrawgraph.NewStorage(ctrlClient) v1alpha1storage[rsapi.ResourceRenders] = render.NewStorage(ctrlClient, oc, rbacAuthorizer) diff --git a/pkg/cmds/server/start.go b/pkg/cmds/server/start.go index 9c69f3f98..4adf0b793 100644 --- a/pkg/cmds/server/start.go +++ b/pkg/cmds/server/start.go @@ -149,6 +149,7 @@ func (o *UIServerOptions) Config() (*apiserver.Config, error) { fmt.Sprintf("/apis/%s/%s", rsapi.SchemeGroupVersion, "usermenus"), fmt.Sprintf("/apis/%s/%s", rsapi.SchemeGroupVersion, rsapi.ResourceChartPresetQueries), + fmt.Sprintf("/apis/%s/%s", rsapi.SchemeGroupVersion, rsapi.ResourceClusterStatuses), fmt.Sprintf("/apis/%s/%s", rsapi.SchemeGroupVersion, rsapi.ResourceMenus), fmt.Sprintf("/apis/%s/%s", rsapi.SchemeGroupVersion, rsapi.ResourceRenderDashboards), fmt.Sprintf("/apis/%s/%s", rsapi.SchemeGroupVersion, rsapi.ResourceRenderMenus), diff --git a/pkg/registry/meta/clusterstatus/fluxcd.go b/pkg/registry/meta/clusterstatus/fluxcd.go new file mode 100644 index 000000000..4f0cc8efe --- /dev/null +++ b/pkg/registry/meta/clusterstatus/fluxcd.go @@ -0,0 +1,107 @@ +/* +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 clusterstatus + +import ( + "context" + + apps "k8s.io/api/apps/v1" + apierrors "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/api/meta" + "k8s.io/apimachinery/pkg/runtime/schema" + "sigs.k8s.io/controller-runtime/pkg/client" +) + +const ( + KeyACEManaged = "byte.builders/managed" +) + +type FluxCDStatus struct { + Installed bool `json:"installed"` + Ready bool `json:"ready"` + Managed bool `json:"managed"` + Message string `json:"message,omitempty"` +} + +func getFluxCDStatus(kc client.Client) (FluxCDStatus, error) { + status := FluxCDStatus{} + if err := checkFluxCRDRegistered(kc.RESTMapper()); err != nil { + if apierrors.IsNotFound(err) || meta.IsNoMatchError(err) { + status.Installed = false + status.Message = "FluxCD CRDs HelmReleases and HelmRepositories are not registered" + return status, nil + } + return status, err + } + + var deployments apps.DeploymentList + err := kc.List(context.Background(), &deployments, client.MatchingLabels{ + "app.kubernetes.io/instance": "flux-system", + "app.kubernetes.io/part-of": "flux", + "control-plane": "controller", + }) + if err != nil { + return status, err + } + if len(deployments.Items) == 0 { + status.Installed = false + status.Message = "FluxCD deployments do not exist" + return status, nil + } + + for _, deploy := range deployments.Items { + if deploy.Name == "source-controller" { + status.Installed = true + status.Managed = isFluxCDManaged(deploy.Spec.Template.Labels) + + if deploy.Status.ReadyReplicas == 0 { + status.Ready = false + status.Message = "No ready replica found for deployment 'source-controller'" + return status, nil + } + } else if deploy.Name == "helm-controller" { + if deploy.Status.ReadyReplicas == 0 { + status.Ready = false + status.Message = "No ready replica found for deployment 'helm-controller'" + } + } + } + status.Ready = true + + return status, nil +} + +func isFluxCDManaged(podLabels map[string]string) bool { + _, exists := podLabels[KeyACEManaged] + return exists +} + +func checkFluxCRDRegistered(mapper meta.RESTMapper) error { + if _, err := mapper.RESTMappings(schema.GroupKind{ + Group: "helm.toolkit.fluxcd.io", + Kind: "HelmRelease", + }); err != nil { + return err + } + if _, err := mapper.RESTMappings(schema.GroupKind{ + Group: "source.toolkit.fluxcd.io", + Kind: "HelmRepository", + }); err != nil { + return err + } + return nil +} diff --git a/pkg/registry/meta/clusterstatus/status.go b/pkg/registry/meta/clusterstatus/status.go new file mode 100644 index 000000000..50542121f --- /dev/null +++ b/pkg/registry/meta/clusterstatus/status.go @@ -0,0 +1,111 @@ +/* +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 clusterstatus + +import ( + "context" + + "gomodules.xyz/pointer" + clustermeta "kmodules.xyz/client-go/cluster" + rsapi "kmodules.xyz/resource-metadata/apis/meta/v1alpha1" + uiapi "kmodules.xyz/resource-metadata/apis/ui/v1alpha1" + "sigs.k8s.io/controller-runtime/pkg/client" +) + +const ( + MessageFluxCDMissing = "FluxCD is not installed or not ready. Please, reconnect to install/update the component." + MessageRequiredComponentsMissing = "One or more core components are not ready. Please, reconnect to update the components." +) + +func generateClusterStatusResponse(kc client.Client) *rsapi.ClusterStatusResponse { + var csr rsapi.ClusterStatusResponse + var err error + + clusterManager := clustermeta.DetectClusterManager(kc) + csr.ClusterManagers = clusterManager.Strings() + if clusterManager.ManagedByOCMMulticlusterControlplane() { + csr.Phase = rsapi.ClusterPhaseActive + return &csr + } + + csr.ClusterAPI, err = clustermeta.DetectCAPICluster(kc) + if err != nil { + return &csr + } + + ready, msg, err := checkClusterReadiness(kc) + if err != nil { + csr.Phase = rsapi.ClusterPhaseInactive + csr.Reason = rsapi.ClusterNotFound + csr.Message = err.Error() + return &csr + } else if !ready { + csr.Phase = rsapi.ClusterPhaseNotReady + csr.Reason = rsapi.MissingComponent + csr.Message = msg + return &csr + } + csr.Phase = rsapi.ClusterPhaseActive + + return &csr +} + +func checkClusterReadiness(kc client.Client) (bool, string, error) { + ready, err := isFluxCDReady(kc) + if err != nil { + return false, "", err + } + + if !ready { + return false, MessageFluxCDMissing, nil + } + + ready, err = areRequiredFeatureSetsReady(kc) + if err != nil { + return false, "", err + } + if !ready { + return false, MessageRequiredComponentsMissing, nil + } + return true, "", nil +} + +func areRequiredFeatureSetsReady(kc client.Client) (bool, error) { + var featureSets uiapi.FeatureSetList + err := kc.List(context.TODO(), &featureSets) + if err != nil { + return false, err + } + if len(featureSets.Items) == 0 { + return false, nil + } + + for _, fs := range featureSets.Items { + if len(fs.Spec.RequiredFeatures) > 0 && !pointer.Bool(fs.Status.Ready) { + return false, nil + } + } + return true, nil +} + +func isFluxCDReady(kc client.Client) (bool, error) { + status, err := getFluxCDStatus(kc) + if err != nil { + return false, err + } + return status.Ready, nil +} diff --git a/pkg/registry/meta/clusterstatus/storage.go b/pkg/registry/meta/clusterstatus/storage.go new file mode 100644 index 000000000..5f9aa0a93 --- /dev/null +++ b/pkg/registry/meta/clusterstatus/storage.go @@ -0,0 +1,75 @@ +/* +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 clusterstatus + +import ( + "context" + + 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" + rsapi "kmodules.xyz/resource-metadata/apis/meta/v1alpha1" + "sigs.k8s.io/controller-runtime/pkg/client" +) + +type Storage struct { + kc client.Client + convertor rest.TableConvertor +} + +var ( + _ rest.GroupVersionKindProvider = &Storage{} + _ rest.Scoper = &Storage{} + _ rest.Storage = &Storage{} + _ rest.Creater = &Storage{} +) + +func NewStorage(kc client.Client) *Storage { + return &Storage{ + kc: kc, + convertor: rest.NewDefaultTableConvertor(schema.GroupResource{ + Group: rsapi.SchemeGroupVersion.Group, + Resource: rsapi.ResourceClusterStatuses, + }), + } +} + +func (r *Storage) GroupVersionKind(_ schema.GroupVersion) schema.GroupVersionKind { + return rsapi.SchemeGroupVersion.WithKind(rsapi.ResourceKindClusterStatus) +} + +func (r *Storage) NamespaceScoped() bool { + return false +} + +func (r *Storage) New() runtime.Object { + return &rsapi.ClusterStatus{} +} + +func (r *Storage) Destroy() {} + +func (r *Storage) Create(ctx context.Context, obj runtime.Object, createValidation rest.ValidateObjectFunc, options *metav1.CreateOptions) (runtime.Object, error) { + in := obj.(*rsapi.ClusterStatus) + in.Response = generateClusterStatusResponse(r.kc) + + return in, nil +} + +func (r *Storage) ConvertToTable(ctx context.Context, object runtime.Object, tableOptions runtime.Object) (*metav1.Table, error) { + return r.convertor.ConvertToTable(ctx, object, tableOptions) +} diff --git a/pkg/registry/meta/resourcecalculator/storage.go b/pkg/registry/meta/resourcecalculator/storage.go index 1ec4e3e83..1d98b44d0 100644 --- a/pkg/registry/meta/resourcecalculator/storage.go +++ b/pkg/registry/meta/resourcecalculator/storage.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package resourceCalculator +package resourcecalculator import ( "context" diff --git a/vendor/kmodules.xyz/resource-metadata/apis/meta/v1alpha1/clusterstatus_types.go b/vendor/kmodules.xyz/resource-metadata/apis/meta/v1alpha1/clusterstatus_types.go index e034a2486..52f8433bd 100644 --- a/vendor/kmodules.xyz/resource-metadata/apis/meta/v1alpha1/clusterstatus_types.go +++ b/vendor/kmodules.xyz/resource-metadata/apis/meta/v1alpha1/clusterstatus_types.go @@ -35,8 +35,7 @@ const ( // +genclient:onlyVerbs=create // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object type ClusterStatus struct { - metav1.TypeMeta `json:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty"` + metav1.TypeMeta `json:",inline"` // +optional Response *ClusterStatusResponse `json:"response,omitempty"` } diff --git a/vendor/kmodules.xyz/resource-metadata/apis/meta/v1alpha1/openapi_generated.go b/vendor/kmodules.xyz/resource-metadata/apis/meta/v1alpha1/openapi_generated.go index dd76d74d2..ef8712248 100644 --- a/vendor/kmodules.xyz/resource-metadata/apis/meta/v1alpha1/openapi_generated.go +++ b/vendor/kmodules.xyz/resource-metadata/apis/meta/v1alpha1/openapi_generated.go @@ -14752,12 +14752,6 @@ func schema_resource_metadata_apis_meta_v1alpha1_ClusterStatus(ref common.Refere Format: "", }, }, - "metadata": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), - }, - }, "response": { SchemaProps: spec.SchemaProps{ Ref: ref("kmodules.xyz/resource-metadata/apis/meta/v1alpha1.ClusterStatusResponse"), @@ -14767,7 +14761,7 @@ func schema_resource_metadata_apis_meta_v1alpha1_ClusterStatus(ref common.Refere }, }, Dependencies: []string{ - "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta", "kmodules.xyz/resource-metadata/apis/meta/v1alpha1.ClusterStatusResponse"}, + "kmodules.xyz/resource-metadata/apis/meta/v1alpha1.ClusterStatusResponse"}, } } diff --git a/vendor/kmodules.xyz/resource-metadata/apis/meta/v1alpha1/zz_generated.deepcopy.go b/vendor/kmodules.xyz/resource-metadata/apis/meta/v1alpha1/zz_generated.deepcopy.go index 1e2d52ef4..18bbd6505 100644 --- a/vendor/kmodules.xyz/resource-metadata/apis/meta/v1alpha1/zz_generated.deepcopy.go +++ b/vendor/kmodules.xyz/resource-metadata/apis/meta/v1alpha1/zz_generated.deepcopy.go @@ -93,7 +93,6 @@ func (in *ChartPresetQuery) DeepCopyObject() runtime.Object { func (in *ClusterStatus) DeepCopyInto(out *ClusterStatus) { *out = *in out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) if in.Response != nil { in, out := &in.Response, &out.Response *out = new(ClusterStatusResponse) diff --git a/vendor/kmodules.xyz/resource-metadata/hub/resourceeditors/core.k8s.appscode.com/v1alpha1/projects.yaml b/vendor/kmodules.xyz/resource-metadata/hub/resourceeditors/core.k8s.appscode.com/v1alpha1/projects.yaml index 67f31b30d..f3fd723d1 100644 --- a/vendor/kmodules.xyz/resource-metadata/hub/resourceeditors/core.k8s.appscode.com/v1alpha1/projects.yaml +++ b/vendor/kmodules.xyz/resource-metadata/hub/resourceeditors/core.k8s.appscode.com/v1alpha1/projects.yaml @@ -15,3 +15,12 @@ spec: name: projects scope: Cluster version: v1alpha1 + ui: + editor: + name: corek8sappscodecom-project-editor + sourceRef: + apiGroup: source.toolkit.fluxcd.io + kind: HelmRepository + name: bytebuilders-ui + version: v0.4.18 + enforceQuota: false diff --git a/vendor/kmodules.xyz/resource-metadata/hub/resourceeditors/management.k8s.appscode.com/v1alpha1/projectquotas.yaml b/vendor/kmodules.xyz/resource-metadata/hub/resourceeditors/management.k8s.appscode.com/v1alpha1/projectquotas.yaml index 8be35901a..7fda968e5 100644 --- a/vendor/kmodules.xyz/resource-metadata/hub/resourceeditors/management.k8s.appscode.com/v1alpha1/projectquotas.yaml +++ b/vendor/kmodules.xyz/resource-metadata/hub/resourceeditors/management.k8s.appscode.com/v1alpha1/projectquotas.yaml @@ -15,3 +15,12 @@ spec: name: projectquotas scope: Cluster version: v1alpha1 + ui: + editor: + name: managementk8sappscodecom-projectquota-editor + sourceRef: + apiGroup: source.toolkit.fluxcd.io + kind: HelmRepository + name: bytebuilders-ui + version: v0.4.18 + enforceQuota: false diff --git a/vendor/kmodules.xyz/resource-metadata/hub/resourceeditors/meta.k8s.appscode.com/v1alpha1/resourcecalculators.yaml b/vendor/kmodules.xyz/resource-metadata/hub/resourceeditors/meta.k8s.appscode.com/v1alpha1/resourcecalculators.yaml index 49272aed7..618f070af 100644 --- a/vendor/kmodules.xyz/resource-metadata/hub/resourceeditors/meta.k8s.appscode.com/v1alpha1/resourcecalculators.yaml +++ b/vendor/kmodules.xyz/resource-metadata/hub/resourceeditors/meta.k8s.appscode.com/v1alpha1/resourcecalculators.yaml @@ -15,3 +15,12 @@ spec: name: resourcecalculators scope: Namespaced version: v1alpha1 + ui: + editor: + name: metak8sappscodecom-resourcecalculator-editor + sourceRef: + apiGroup: source.toolkit.fluxcd.io + kind: HelmRepository + name: bytebuilders-ui + version: v0.4.18 + enforceQuota: false diff --git a/vendor/modules.txt b/vendor/modules.txt index 51decfa50..38af978f7 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -1800,7 +1800,7 @@ kmodules.xyz/monitoring-agent-api/client # kmodules.xyz/offshoot-api v0.25.4 ## explicit; go 1.18 kmodules.xyz/offshoot-api/api/v1 -# kmodules.xyz/resource-metadata v0.17.25-0.20231006102558-311a1a2eaa10 +# kmodules.xyz/resource-metadata v0.17.25-0.20231008042713-ef9e7bdbcfb9 ## explicit; go 1.18 kmodules.xyz/resource-metadata/apis/core/install kmodules.xyz/resource-metadata/apis/core/v1alpha1