Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Introduce ModuleTemplate Info #1928

Merged
merged 25 commits into from
Oct 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
382147c
add ModuleInfo as optional to ModuleTemplate
ruanxin Sep 30, 2024
a83f2e5
add spec.info document
ruanxin Oct 1, 2024
ed8cf87
Merge remote-tracking branch 'upstream/main' into add-info-field-to-mt
ruanxin Oct 1, 2024
7ec974f
Update api/v1beta2/moduletemplate_types.go
ruanxin Oct 2, 2024
33d59a2
Update api/v1beta2/moduletemplate_types.go
ruanxin Oct 2, 2024
607e31d
Update api/v1beta2/moduletemplate_types.go
ruanxin Oct 2, 2024
c954b9f
update crd
ruanxin Oct 2, 2024
04e26e0
add omitempty to keep consistent
ruanxin Oct 2, 2024
c4d9b65
Update docs/contributor/resources/03-moduletemplate.md
ruanxin Oct 2, 2024
b33bb10
add missing config
ruanxin Oct 2, 2024
ba8d9d2
Update docs/contributor/resources/03-moduletemplate.md
ruanxin Oct 2, 2024
08b70fe
Merge remote-tracking branch 'upstream/main' into add-info-field-to-mt
ruanxin Oct 2, 2024
0cf0829
Merge remote-tracking branch 'origin/add-info-field-to-mt' into add-i…
ruanxin Oct 2, 2024
f6f7bbb
Merge remote-tracking branch 'upstream/main' into add-info-field-to-mt
ruanxin Oct 2, 2024
d579d4a
Merge remote-tracking branch 'upstream/main' into add-info-field-to-mt
ruanxin Oct 2, 2024
d4e753d
add missing config
ruanxin Oct 2, 2024
3f5fae6
Merge remote-tracking branch 'upstream/main' into add-info-field-to-mt
ruanxin Oct 2, 2024
4ebfadf
only test one e2e
ruanxin Oct 2, 2024
26fb174
update k3d and k8s version
ruanxin Oct 4, 2024
7620183
bring back e2e
ruanxin Oct 4, 2024
5417f97
Merge remote-tracking branch 'upstream/main' into test-new-mt-spec-to…
ruanxin Oct 4, 2024
91ef60a
use 1.30.3 for all tests
ruanxin Oct 4, 2024
c5eafaa
Merge branch 'main' into test-new-mt-spec-to-merge
c-pius Oct 4, 2024
de4fe04
run make generate
c-pius Oct 4, 2024
62123d8
Merge branch 'main' into test-new-mt-spec-to-merge
c-pius Oct 4, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading