Skip to content

Commit

Permalink
add new EnableModuleConfig flag
Browse files Browse the repository at this point in the history
  • Loading branch information
amritanshusikdar committed Mar 20, 2024
1 parent 5b24ec6 commit d71405e
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 24 deletions.
29 changes: 15 additions & 14 deletions cmd/kyma/alpha/create/module/moduleconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,21 @@ import (
)

type Config struct {
Name string `yaml:"name" comment:"required, the name of the Module"`
Version string `yaml:"version" comment:"required, the version of the Module"`
Channel string `yaml:"channel" comment:"required, channel that should be used in the ModuleTemplate"`
ManifestPath string `yaml:"manifest" comment:"required, relative path or remote URL to the manifests"`
Mandatory bool `yaml:"mandatory" comment:"optional, default=false, indicates whether the module is mandatory to be installed on all clusters"`
DefaultCRPath string `yaml:"defaultCR" comment:"optional, relative path or remote URL to a YAML file containing the default CR for the module"`
ResourceName string `yaml:"resourceName" comment:"optional, default={NAME}-{CHANNEL}, the name for the ModuleTemplate that will be created"`
Namespace string `yaml:"namespace" comment:"optional, default=kcp-system, the namespace where the ModuleTemplate will be deployed"`
Security string `yaml:"security" comment:"optional, name of the security scanners config file"`
Internal bool `yaml:"internal" comment:"optional, default=false, determines whether the ModuleTemplate should have the internal flag or not"`
Beta bool `yaml:"beta" comment:"optional, default=false, determines whether the ModuleTemplate should have the beta flag or not"`
Labels map[string]string `yaml:"labels" comment:"optional, additional labels for the ModuleTemplate"`
Annotations map[string]string `yaml:"annotations" comment:"optional, additional annotations for the ModuleTemplate"`
CustomStateChecks []v1beta2.CustomStateCheck `yaml:"customStateCheck" comment:"optional, specifies custom state check for module"`
Name string `yaml:"name" comment:"required, the name of the Module"`
Version string `yaml:"version" comment:"required, the version of the Module"`
Channel string `yaml:"channel" comment:"required, channel that should be used in the ModuleTemplate"`
ManifestPath string `yaml:"manifest" comment:"required, relative path or remote URL to the manifests"`
Mandatory bool `yaml:"mandatory" comment:"optional, default=false, indicates whether the module is mandatory to be installed on all clusters"`
DefaultCRPath string `yaml:"defaultCR" comment:"optional, relative path or remote URL to a YAML file containing the default CR for the module"`
ResourceName string `yaml:"resourceName" comment:"optional, default={NAME}-{CHANNEL}, the name for the ModuleTemplate that will be created"`
Namespace string `yaml:"namespace" comment:"optional, default=kcp-system, the namespace where the ModuleTemplate will be deployed"`
Security string `yaml:"security" comment:"optional, name of the security scanners config file"`
Internal bool `yaml:"internal" comment:"optional, default=false, determines whether the ModuleTemplate should have the internal flag or not"`
Beta bool `yaml:"beta" comment:"optional, default=false, determines whether the ModuleTemplate should have the beta flag or not"`
Labels map[string]string `yaml:"labels" comment:"optional, additional labels for the ModuleTemplate"`
Annotations map[string]string `yaml:"annotations" comment:"optional, additional annotations for the ModuleTemplate"`
CustomStateChecks []v1beta2.CustomStateCheck `yaml:"customStateCheck" comment:"optional, specifies custom state check for module"`
EnableModuleConfig bool `yaml:"enableModuleConfig" comment:"optional, default=false, to let the LifecycleManager know which module CR should be synced back to the KCP"`
}

const (
Expand Down
21 changes: 11 additions & 10 deletions pkg/module/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,19 +55,20 @@ spec:
)

type moduleTemplateData struct {
ResourceName string // K8s resource name of the generated ModuleTemplate
Namespace string
Descriptor compdesc.ComponentDescriptorVersion // descriptor info for the template
Channel string
Data string // contents for the spec.data section of the template taken from the defaults.yaml file in the mod folder
Labels map[string]string
Annotations map[string]string
CustomStateChecks []v1beta2.CustomStateCheck
Mandatory bool
ResourceName string // K8s resource name of the generated ModuleTemplate
Namespace string
Descriptor compdesc.ComponentDescriptorVersion // descriptor info for the template
Channel string
Data string // contents for the spec.data section of the template taken from the defaults.yaml file in the mod folder
Labels map[string]string
Annotations map[string]string
CustomStateChecks []v1beta2.CustomStateCheck
Mandatory bool
EnableModuleConfig bool
}

func Template(remote ocm.ComponentVersionAccess, moduleTemplateName, namespace, channel string, data []byte,
labels, annotations map[string]string, customsStateChecks []v1beta2.CustomStateCheck, mandatory bool) ([]byte,
labels, annotations map[string]string, customsStateChecks []v1beta2.CustomStateCheck, mandatory bool, enableModuleConfig bool) ([]byte,
error) {
descriptor := remote.GetDescriptor()
ref, err := oci.ParseRef(descriptor.Name)
Expand Down

0 comments on commit d71405e

Please sign in to comment.