diff --git a/apis/installer/v1alpha1/kubedb_catalog_types.go b/apis/installer/v1alpha1/kubedb_catalog_types.go index 32eb4fe78..09bd16141 100644 --- a/apis/installer/v1alpha1/kubedb_catalog_types.go +++ b/apis/installer/v1alpha1/kubedb_catalog_types.go @@ -18,6 +18,7 @@ package v1alpha1 import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" ) const ( @@ -45,11 +46,12 @@ type KubedbCatalogSpec struct { //+optional FullnameOverride string `json:"fullnameOverride"` //+optional - Proxies RegistryProxies `json:"proxies"` - FeatureGates map[string]bool `json:"featureGates"` - Psp PSP `json:"psp"` - SkipDeprecated bool `json:"skipDeprecated"` - EnableVersions map[string][]string `json:"enableVersions"` + Proxies RegistryProxies `json:"proxies"` + FeatureGates map[string]bool `json:"featureGates"` + Psp PSP `json:"psp"` + SkipDeprecated bool `json:"skipDeprecated"` + EnableVersions map[string][]string `json:"enableVersions"` + CustomVersions map[string]*runtime.RawExtension `json:"customVersions"` } type RegistryProxies struct { diff --git a/apis/installer/v1alpha1/zz_generated.deepcopy.go b/apis/installer/v1alpha1/zz_generated.deepcopy.go index f74ae0ef1..edda91e94 100644 --- a/apis/installer/v1alpha1/zz_generated.deepcopy.go +++ b/apis/installer/v1alpha1/zz_generated.deepcopy.go @@ -579,6 +579,21 @@ func (in *KubedbCatalogSpec) DeepCopyInto(out *KubedbCatalogSpec) { (*out)[key] = outVal } } + if in.CustomVersions != nil { + in, out := &in.CustomVersions, &out.CustomVersions + *out = make(map[string]*runtime.RawExtension, len(*in)) + for key, val := range *in { + var outVal *runtime.RawExtension + if val == nil { + (*out)[key] = nil + } else { + in, out := &val, &outVal + *out = new(runtime.RawExtension) + (*in).DeepCopyInto(*out) + } + (*out)[key] = outVal + } + } return } diff --git a/catalog/kubedb/fmt/main.go b/catalog/kubedb/fmt/main.go index c26d615f0..f6ea83ed2 100644 --- a/catalog/kubedb/fmt/main.go +++ b/catalog/kubedb/fmt/main.go @@ -657,6 +657,10 @@ func main() { if err != nil { panic(err) } + err = os.Rename(filepath.Join(dir, "charts", "kubedb-catalog", "templates", "custom.yaml"), filepath.Join(dir, "charts", "kubedb-catalog", "new_templates", "custom.yaml")) + if err != nil { + panic(err) + } err = os.RemoveAll(filepath.Join(dir, "charts", "kubedb-catalog", "templates")) if err != nil { panic(err) diff --git a/charts/kubedb-catalog/README.md b/charts/kubedb-catalog/README.md index d0c0085cb..ca98e3f55 100644 --- a/charts/kubedb-catalog/README.md +++ b/charts/kubedb-catalog/README.md @@ -116,6 +116,7 @@ The following table lists the configurable parameters of the `kubedb-catalog` ch | enableVersions.Singlestore | | [] | | enableVersions.Solr | | [] | | enableVersions.ZooKeeper | | [] | +| customVersions | | {} | Specify each parameter using the `--set key=value[,key=value]` argument to `helm upgrade -i`. For example: diff --git a/charts/kubedb-catalog/templates/custom.yaml b/charts/kubedb-catalog/templates/custom.yaml new file mode 100644 index 000000000..d383181a8 --- /dev/null +++ b/charts/kubedb-catalog/templates/custom.yaml @@ -0,0 +1,4 @@ +{{ range $obj:= .Values.customVersions }} +{{ $obj | toYaml }} +--- +{{ end }} diff --git a/charts/kubedb-catalog/values.openapiv3_schema.yaml b/charts/kubedb-catalog/values.openapiv3_schema.yaml index e3cdf5bcb..ca26f7126 100644 --- a/charts/kubedb-catalog/values.openapiv3_schema.yaml +++ b/charts/kubedb-catalog/values.openapiv3_schema.yaml @@ -1,4 +1,9 @@ properties: + customVersions: + additionalProperties: + type: object + x-kubernetes-preserve-unknown-fields: true + type: object enableVersions: additionalProperties: items: @@ -144,6 +149,7 @@ properties: skipDeprecated: type: boolean required: +- customVersions - enableVersions - featureGates - psp diff --git a/charts/kubedb-catalog/values.yaml b/charts/kubedb-catalog/values.yaml index ae3d06567..6b307bcea 100644 --- a/charts/kubedb-catalog/values.yaml +++ b/charts/kubedb-catalog/values.yaml @@ -102,3 +102,5 @@ enableVersions: Singlestore: [] Solr: [] ZooKeeper: [] + +customVersions: {} diff --git a/charts/kubedb/values.openapiv3_schema.yaml b/charts/kubedb/values.openapiv3_schema.yaml index df1b55e0c..528d49050 100644 --- a/charts/kubedb/values.openapiv3_schema.yaml +++ b/charts/kubedb/values.openapiv3_schema.yaml @@ -2607,6 +2607,11 @@ properties: type: object kubedb-catalog: properties: + customVersions: + additionalProperties: + type: object + x-kubernetes-preserve-unknown-fields: true + type: object enableVersions: additionalProperties: items: @@ -2754,6 +2759,7 @@ properties: skipDeprecated: type: boolean required: + - customVersions - enableVersions - enabled - featureGates diff --git a/go.mod b/go.mod index 3f52e719b..9dab9e49e 100644 --- a/go.mod +++ b/go.mod @@ -23,11 +23,6 @@ require ( stash.appscode.dev/installer v0.12.2-0.20240420190034-95f958de0f1e ) -require ( - github.com/evanphx/json-patch v5.9.0+incompatible // indirect - golang.org/x/exp v0.0.0-20231226003508-02704c960a9b // indirect -) - require ( github.com/Masterminds/goutils v1.1.1 // indirect github.com/codegangsta/inject v0.0.0-20150114235600-33e0aa1cb7c0 // indirect @@ -39,6 +34,7 @@ require ( github.com/docker/docker-credential-helpers v0.7.0 // indirect github.com/dustin/go-humanize v1.0.1 // indirect github.com/emicklei/go-restful/v3 v3.12.0 // indirect + github.com/evanphx/json-patch v5.9.0+incompatible // indirect github.com/evanphx/json-patch/v5 v5.9.0 // indirect github.com/fatih/structs v1.1.0 // indirect github.com/go-logr/logr v1.4.1 // indirect @@ -74,6 +70,7 @@ require ( github.com/vbatts/tar-split v0.11.3 // indirect github.com/yudai/golcs v0.0.0-20170316035057-ecda9a501e82 // indirect golang.org/x/crypto v0.23.0 // indirect + golang.org/x/exp v0.0.0-20231226003508-02704c960a9b // indirect golang.org/x/net v0.25.0 // indirect golang.org/x/oauth2 v0.18.0 // indirect golang.org/x/sync v0.7.0 // indirect