KusionStack / kusion

Declarative Intent Driven Platform Orchestrator for Internal Developer Platform (IDP).
https://kusionstack.io
Apache License 2.0
881 stars 78 forks source link

All resources should supported #1276

Closed novohool closed 3 weeks ago

novohool commented 2 months ago

What would you like to be added?

K8s is a set of standardized projects. All resources are defined on K8s. Can we consider a method to dynamically generate resource libraries so that Kusion supports all K8s resources?

Why is this needed?

Currently there are too few supported resources, especially crd resources

liu-hm19 commented 2 months ago

@novohool Hi, thanks for your advice!

Recently, the community has provided a Kusion Module called k8s_manifest, which allows users to specify the paths to the Kubernetes manifest YAML files and Kusion can convert the specified paths of K8s manifests into Kusion's Spec. So that users can reuse Kusion's preview, apply, and watch ability, as well as the management for application Release on the raw K8s manifests.

The related documentation can be found here. And the codes for the k8s_manifest module can be found here.

I would like to know if this Kusion Module mechanism can meet the requirements for supporting all types of K8s resources including CRD with Kusion. If you have any other ideas, please feel free to discuss with us at any time!

novohool commented 2 months ago

@novohool Hi, thanks for your advice!

Recently, the community has provided a Kusion Module called k8s_manifest, which allows users to specify the paths to the Kubernetes manifest YAML files and Kusion can convert the specified paths of K8s manifests into Kusion's Spec. So that users can reuse Kusion's preview, apply, and watch ability, as well as the management for application Release on the raw K8s manifests.

The related documentation can be found here. And the codes for the k8s_manifest module can be found here.

I would like to know if this Kusion Module mechanism can meet the requirements for supporting all types of K8s resources including CRD with Kusion. If you have any other ideas, please feel free to discuss with us at any time!

As for manifests, I think they should not be provided by users, because most of them can be obtained directly on

liu-hm19 commented 2 months ago

@novohool Yes, thanks for your advice 👍 We are also considering adding support for the k8s_manifest module to apply the K8s resources obtained through a URL. Users can fill in the paths configuration item with the URL address of the manifest, for example:

import kam.v1.app_configuration as ac
import k8s_manifest

test: ac.AppConfiguration {
    accessories: {
        "k8s_manifests": k8s_manifest.K8sManifest {
            paths: [
                "https://github.com/istio/istio/blob/master/manifests/charts/base/crds/crd-all.gen.yaml"
            ]
        }
    }
}

If you have time and interest, welcome to contribute to the k8s_manifest module in the catalog repo : )

As for the manifests obtained through kubectl api, it seems that it cannot be supported properly through Kusion Module mechanism. If you have specific application scenarios or requirements, please feel free to supplement at any time.

novohool commented 2 months ago

If it is really necessary to import it, building it into the module is also a solution

from crd_manifest import istio.io_1.23.0  as IstioManifests
...
"crd_manifests": crd_manifest.IstioManifests
SparkYuan commented 3 weeks ago

If it is really necessary to import it, building it into the module is also a solution

from crd_manifest import istio.io_1.23.0  as IstioManifests
...
"crd_manifests": crd_manifest.IstioManifests

Thanks for your advice. We have released the K8sManifest module and here is the user guide