You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dubbo.apache.org by zh...@apache.org on 2024/11/27 11:00:29 UTC
(dubbo-kubernetes) branch master updated: [operator] add helm api logic (#506)
This is an automated email from the ASF dual-hosted git repository.
zhongxjian pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/dubbo-kubernetes.git
The following commit(s) were added to refs/heads/master by this push:
new 64fa2638 [operator] add helm api logic (#506)
64fa2638 is described below
commit 64fa263825a3450843ad6e9fb53c0c1a2a1daca9
Author: mfordjody <11...@qq.com>
AuthorDate: Wed Nov 27 19:00:24 2024 +0800
[operator] add helm api logic (#506)
---
operator/cmd/cluster/install.go | 2 +-
operator/pkg/helm/helm.go | 60 +++++++++++++++++++++++++++++++++++++++++
2 files changed, 61 insertions(+), 1 deletion(-)
diff --git a/operator/cmd/cluster/install.go b/operator/cmd/cluster/install.go
index dbbc0089..88c45014 100644
--- a/operator/cmd/cluster/install.go
+++ b/operator/cmd/cluster/install.go
@@ -31,7 +31,7 @@ func InstallCmd(ctx cli.Context) *cobra.Command {
return nil
}
-func WithInstallCmdArgs(ctx cli.Context, rootArgs *RootArgs, iArgs *InstallArgs) *cobra.Command {
+func InstallCmdWithArgs(ctx cli.Context, rootArgs *RootArgs, iArgs *InstallArgs) *cobra.Command {
ic := &cobra.Command{
Use: "install",
Short: "Applies an Dubbo manifest, installing or reconfiguring Dubbo on a cluster.",
diff --git a/operator/pkg/helm/helm.go b/operator/pkg/helm/helm.go
new file mode 100644
index 00000000..e5326265
--- /dev/null
+++ b/operator/pkg/helm/helm.go
@@ -0,0 +1,60 @@
+package helm
+
+import (
+ "helm.sh/helm/v3/pkg/chart"
+ "helm.sh/helm/v3/pkg/chartutil"
+ "helm.sh/helm/v3/pkg/engine"
+ "io/fs"
+ "sort"
+ "strings"
+)
+
+const (
+ // NotesFileNameSuffix is the file name suffix for helm notes.
+ // see https://helm.sh/docs/chart_template_guide/notes_files/
+ NotesFileNameSuffix = ".txt"
+)
+
+func getFilesRecursive() {
+
+}
+
+func stripPrefix() {
+
+}
+
+func loaderChart(f fs.FS, root string) (*chart.Chart, error) {
+ return nil, nil
+}
+
+func readerChart(namespace string, chrt *chart.Chart) ([]string, error) {
+ var s []string
+ opts := chartutil.ReleaseOptions{
+ Namespace: namespace,
+ }
+ caps := *chartutil.DefaultCapabilities
+ helmVals, err := chartutil.ToRenderValues(chrt, nil, opts, &caps)
+ if err != nil {
+ return nil, nil
+ }
+ files, err := engine.Render(chrt, helmVals)
+ if err != nil {
+ return nil, err
+ }
+ keys := make([]string, 0, len(files))
+ for k := range files {
+ if strings.HasPrefix(k, NotesFileNameSuffix) {
+ }
+ keys = append(keys, k)
+ }
+ sort.Strings(keys)
+ chrt.CRDObjects()
+ if chrt.Metadata.Name == "base" {
+ }
+
+ return s, nil
+}
+
+func Reader() {
+
+}