Skip to content

Commit

Permalink
feat: Introduce ModuleTemplate Info (#1928)
Browse files Browse the repository at this point in the history
* add ModuleInfo as optional to ModuleTemplate

* add spec.info document

* Update api/v1beta2/moduletemplate_types.go

Co-authored-by: Christoph Schwägerl <acc.pius@mailbox.org>

* Update api/v1beta2/moduletemplate_types.go

Co-authored-by: Christoph Schwägerl <acc.pius@mailbox.org>

* Update api/v1beta2/moduletemplate_types.go

Co-authored-by: Christoph Schwägerl <acc.pius@mailbox.org>

* update crd

* add omitempty to keep consistent

* Update docs/contributor/resources/03-moduletemplate.md

Co-authored-by: Christoph Schwägerl <acc.pius@mailbox.org>

* add missing config

* Update docs/contributor/resources/03-moduletemplate.md

Co-authored-by: Małgorzata Świeca <malgorzata.swieca@sap.com>

* add missing config

* only test one e2e

* update k3d and k8s version

* bring back e2e

* use 1.30.3 for all tests

* run make generate

---------

Co-authored-by: Christoph Schwägerl <acc.pius@mailbox.org>
Co-authored-by: Małgorzata Świeca <malgorzata.swieca@sap.com>
Co-authored-by: Christoph Schwägerl <c.schwaegerl@sap.com>
  • Loading branch information
4 people authored Oct 4, 2024
1 parent 4e356e0 commit c772e54
Show file tree
Hide file tree
Showing 7 changed files with 116 additions and 3 deletions.
4 changes: 2 additions & 2 deletions .github/actions/get-configuration/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ runs:
id: define-variables
shell: bash
run: |
echo "k8s_version=${{ github.event.inputs.k8s_version || '1.29.6' }}" >> $GITHUB_OUTPUT
echo "k8s_version=${{ github.event.inputs.k8s_version || '1.30.3' }}" >> $GITHUB_OUTPUT
echo "istio_version=1.20.3" >> $GITHUB_OUTPUT
echo "k3d_version=5.6.0" >> $GITHUB_OUTPUT
echo "k3d_version=5.7.4" >> $GITHUB_OUTPUT
echo "cert_manager_version=1.15.0" >> $GITHUB_OUTPUT
echo "klm_version_tag=PR-${{ github.event.pull_request.number }}" >> $GITHUB_OUTPUT
echo "klm_image_repo=dev" >> $GITHUB_OUTPUT
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ IMG := $(IMG_NAME):$(DOCKER_TAG)
BUILD_VERSION := from_makefile

# ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary.
ENVTEST_K8S_VERSION = 1.28.0
ENVTEST_K8S_VERSION = 1.30.3

# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set)
ifeq (,$(shell go env GOBIN))
Expand Down
1 change: 1 addition & 0 deletions api-version-compatibility-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,5 @@ operator.kyma-project.io_moduletemplates.yaml:
- .spec.properties.moduleName
- .spec.properties.customStateCheck.description
- .spec.properties.resources
- .spec.properties.info
- .spec.properties.associatedResources
26 changes: 26 additions & 0 deletions api/v1beta2/moduletemplate_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,11 +133,37 @@ type ModuleTemplateSpec struct {
// +listMapKey=name
Resources []Resource `json:"resources,omitempty"`

// Info contains metadata about the module.
// +optional
Info ModuleInfo `json:"info,omitempty"`

// AssociatedResources is a list of module related resources that usually must be cleaned when uninstalling a module. Informational purpose only.
// +optional
AssociatedResources []apimetav1.GroupVersionKind `json:"associatedResources,omitempty"`
}

type ModuleInfo struct {
// Repository is the link to the repository of the module.
Repository string `json:"repository"`

// Documentation is the link to the documentation of the module.
Documentation string `json:"documentation"`

// Icons is a list of icons of the module.
// +optional
// +listType=map
// +listMapKey=name
Icons []ModuleIcon `json:"icons,omitempty"`
}

type ModuleIcon struct {
// Name is the name of the icon.
Name string `json:"name"`

// Link is the link to the icon.
Link string `json:"link"`
}

type CustomStateCheck struct {
// JSONPath specifies the JSON path to the state variable in the Module CR
JSONPath string `json:"jsonPath" yaml:"jsonPath"`
Expand Down
36 changes: 36 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.

32 changes: 32 additions & 0 deletions config/crd/bases/operator.kyma-project.io_moduletemplates.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,38 @@ spec:
charts and kustomize renderers are deprecated and ignored.
type: object
x-kubernetes-preserve-unknown-fields: true
info:
description: Info contains metadata about the module.
properties:
documentation:
description: Documentation is the link to the documentation of
the module.
type: string
icons:
description: Icons is a list of icons of the module.
items:
properties:
link:
description: Link is the link to the icon.
type: string
name:
description: Name is the name of the icon.
type: string
required:
- link
- name
type: object
type: array
x-kubernetes-list-map-keys:
- name
x-kubernetes-list-type: map
repository:
description: Repository is the link to the repository of the module.
type: string
required:
- documentation
- repository
type: object
mandatory:
description: |-
Mandatory indicates whether the module is mandatory. It is used to enforce the installation of the module with
Expand Down
18 changes: 18 additions & 0 deletions docs/contributor/resources/03-moduletemplate.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,24 @@ spec:

If not specified, the **namespace** of the resource mentioned in **.spec.data** will be controlled by the `sync-namespace` flag; otherwise, it will be respected. All other attributes (including **.metadata.name**, **apiVersion**, and **kind**) are taken over as stated. Note that since it behaves similarly to a `template`, any subresources, such as **status**, are ignored, even if specified in the field.

### **.spec.info**

The **info** field contains module metadata, including the repository URL, documentation link, and icons. For example:

```
spec:
info:
repository: https://github.com/example/repo
documentation: https://docs.example.com
icons:
- name: example-icon
link: https://example.com/icon.png
```

- repository: The link to the repository of the module.
- documentation: The link to the documentation of the module.
- icons: A list of icons of the module, each with a name and link.

### **.spec.customStateCheck**

> **CAUTION:** This field was deprecated at the end of July 2024 and will be deleted in the next ModuleTemplate API version. As of the deletion day, you can define the custom state only in a module's custom resource.
Expand Down

0 comments on commit c772e54

Please sign in to comment.