Skip to content

Commit

Permalink
feat: Add Resources as optional to ModuleTemplate (#1910)
Browse files Browse the repository at this point in the history
* feat: Add Resources as optional to ModuleTempalte

* add api compatibility esception

* add docs
  • Loading branch information
c-pius authored Oct 4, 2024
1 parent af53cf5 commit c54809c
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 0 deletions.
1 change: 1 addition & 0 deletions api-version-compatibility-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,4 @@ operator.kyma-project.io_moduletemplates.yaml:
- .spec.properties.version
- .spec.properties.moduleName
- .spec.properties.customStateCheck.description
- .spec.properties.resources
14 changes: 14 additions & 0 deletions api/v1beta2/moduletemplate_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,12 @@ type ModuleTemplateSpec struct {

// CustomStateCheck is deprecated.
CustomStateCheck []*CustomStateCheck `json:"customStateCheck,omitempty"`

// Resources is a list of additional resources of the module that can be fetched, e.g., the raw manifest.
// +optional
// +listType=map
// +listMapKey=name
Resources []Resource `json:"resources,omitempty"`
}

type CustomStateCheck struct {
Expand All @@ -148,6 +154,14 @@ type ModuleTemplateList struct {
Items []ModuleTemplate `json:"items"`
}

type Resource struct {
// Name is the name of the resource.
Name string `json:"name"`
// Link is the URL to the resource.
// +kubebuilder:validation:Format=uri
Link string `json:"link"`
}

//nolint:gochecknoinits // registers ModuleTemplate CRD on startup
func init() {
SchemeBuilder.Register(&ModuleTemplate{}, &ModuleTemplateList{}, &Descriptor{})
Expand Down
20 changes: 20 additions & 0 deletions api/v1beta2/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 20 additions & 0 deletions config/crd/bases/operator.kyma-project.io_moduletemplates.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,26 @@ spec:
maxLength: 64
pattern: ^([a-z]{3,}(-[a-z]{3,})*)?$
type: string
resources:
description: Resources is a list of additional resources of the module
that can be fetched, e.g., the raw manifest.
items:
properties:
link:
description: Link is the URL to the resource.
format: uri
type: string
name:
description: Name is the name of the resource.
type: string
required:
- link
- name
type: object
type: array
x-kubernetes-list-map-keys:
- name
x-kubernetes-list-type: map
version:
description: Version identifies the version of the Module. Can be
empty, or a semantic version.
Expand Down
4 changes: 4 additions & 0 deletions docs/contributor/resources/03-moduletemplate.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,10 @@ By default, it will most likely be easiest to use [Kyma CLI](https://github.com/
The `mandatory` field indicates whether the module is installed in all runtime clusters without any interaction from the user.
Mandatory modules do not appear in the Kyma CR `.status` and `.spec.modules`, furthermore they have the same configuration across all runtime clusters.

### **.spec.resources**

The `resources` field is a list of additional resources of the module that can be fetched. As of now, the primary expected use case is for module teams to add a link to the raw manifest of the module.

## `operator.kyma-project.io` Labels

These are the synchronization labels available on the ModuleTemplate CR:
Expand Down

0 comments on commit c54809c

Please sign in to comment.