diff --git a/cyclops-ctrl/api/v1alpha1/module_types.go b/cyclops-ctrl/api/v1alpha1/module_types.go index 3789d0a3..646c2130 100644 --- a/cyclops-ctrl/api/v1alpha1/module_types.go +++ b/cyclops-ctrl/api/v1alpha1/module_types.go @@ -30,6 +30,7 @@ type ModuleSpec struct { TargetNamespace string `json:"targetNamespace"` TemplateRef TemplateRef `json:"template"` Values apiextensionsv1.JSON `json:"values"` + SkipCRDs bool `json:"skipCRDs,omitempty"` } type ModuleValue struct { diff --git a/cyclops-ctrl/internal/modulecontroller/module_controller.go b/cyclops-ctrl/internal/modulecontroller/module_controller.go index 476371db..5f7bfc01 100644 --- a/cyclops-ctrl/internal/modulecontroller/module_controller.go +++ b/cyclops-ctrl/internal/modulecontroller/module_controller.go @@ -215,14 +215,17 @@ func (r *ModuleReconciler) SetupWithManager(mgr ctrl.Manager) error { } func (r *ModuleReconciler) moduleToResources(template *models.Template, module *cyclopsv1alpha1.Module) ([]string, []cyclopsv1alpha1.GroupVersionResource, error) { - crdInstallErrors := r.applyCRDs(template) + var crdInstallErrors []string + if !module.Spec.SkipCRDs { + crdInstallErrors = r.applyCRDs(template) + } - installErrors, childrenGVRs, err := r.generateResources(r.kubernetesClient, *module, template) - if err != nil { - return nil, nil, err - } + installErrors, childrenGVRs, err := r.generateResources(r.kubernetesClient, *module, template) + if err != nil { + return nil, nil, err + } - return append(crdInstallErrors, installErrors...), childrenGVRs, nil + return append(crdInstallErrors, installErrors...), childrenGVRs, nil } func (r *ModuleReconciler) generateResources( diff --git a/cyclops-ui/src/components/pages/NewModule/NewModule.tsx b/cyclops-ui/src/components/pages/NewModule/NewModule.tsx index cd65a9f5..0d08bc38 100644 --- a/cyclops-ui/src/components/pages/NewModule/NewModule.tsx +++ b/cyclops-ui/src/components/pages/NewModule/NewModule.tsx @@ -13,6 +13,7 @@ import { Modal, Spin, notification, + Switch, } from "antd"; import axios from "axios"; import { findMaps, flattenObjectKeys, mapsToArray } from "../../../utils/form"; @@ -117,6 +118,7 @@ const NewModule = () => { const handleSubmit = (values: any) => { const moduleName = values["cyclops_module_name"]; const moduleNamespace = values["cyclops_module_namespace"]; + const skipCRDs = values["cyclops_module_skip_crds"]; values = findMaps(config.root.properties, values, initialValuesRaw); @@ -125,6 +127,7 @@ const NewModule = () => { name: moduleName, namespace: moduleNamespace, values: values, + skipCRDs: skipCRDs, template: { repo: template.repo, path: template.path, @@ -576,6 +579,21 @@ const NewModule = () => { ))} +
+ Skip CRDs creation +
+ + } + > +