Skip to content

Commit

Permalink
Merge branch 'mrm_kyma_reconciliation' of https://github.com/nesmabad…
Browse files Browse the repository at this point in the history
…r/lifecycle-manager into mrm_kyma_reconciliation
  • Loading branch information
nesmabadr committed Oct 11, 2024
2 parents 6328b3a + 6cb5f9e commit f88eeb3
Show file tree
Hide file tree
Showing 9 changed files with 52 additions and 26 deletions.
14 changes: 9 additions & 5 deletions .github/workflows/build-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ on:
required: false
type: string
default: ""

pull_request_target:
types: [ opened, edited, synchronize, reopened, ready_for_review ]
permissions:
id-token: write # This is required for requesting the JWT token
contents: read # This is required for actions/checkout
Expand All @@ -29,11 +30,14 @@ jobs:
run: |
if [[ "${{ inputs.tag }}" != "" ]]; then
echo "tag=${{ inputs.tag }}" >> $GITHUB_OUTPUT
elif [[ "${{ github.event_name }}" == "push" ]]; then
echo "tag=latest" >> $GITHUB_OUTPUT
else
{
echo 'tag<<TAGS'
echo 'PR-${{ github.event.pull_request.number }}'
echo '${{ github.event.pull_request.head.sha }}'
echo 'TAGS'
} >> "$GITHUB_OUTPUT"
fi
- name: Echo the tag
run: echo ${{ steps.get_tag.outputs.tag }}
build-image:
needs: compute-tag
uses: kyma-project/test-infra/.github/workflows/image-builder.yml@main
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/create-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ jobs:
env:
ITERATIONS: 40
SLEEP_SECONDS: 30
run: ./.github/scripts/release/wait_for_image.sh ${{ env.IMAGE_REPO }}:${{ github.event.inputs.name }} $ITERATIONS $SLEEP_SECONDS
run: ./.github/scripts/release/wait_for_image.sh ${{ env.IMAGE_REPO }}:${{ github.event.inputs.name }} ${{ env.ITERATIONS }} ${{ env.SLEEP_SECONDS }}
- name: Publish release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
23 changes: 18 additions & 5 deletions .github/workflows/test-e2e.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,33 @@
name: TestSuite E2E

env:
IMAGE_REPO: europe-docker.pkg.dev/kyma-project/dev/lifecycle-manager
on:
workflow_dispatch:
inputs:
k8s_version:
description: With Kubernetes version
required: false
pull_request_target:
pull_request:
types: [ opened, edited, synchronize, reopened, ready_for_review ]
jobs:
build-image:
name: Build Image
uses: ./.github/workflows/build-image.yml
wait-for-image-build:
name: Wait for image build
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Wait for the Docker image
timeout-minutes: 20
env:
ITERATIONS: 40
SLEEP_SECONDS: 30
run: ./.github/scripts/release/wait_for_image.sh ${{ env.IMAGE_REPO }}:${{ github.event.pull_request.head.sha }} ${{ env.ITERATIONS }} ${{ env.SLEEP_SECONDS}}
e2e-integration:
name: E2E
needs: build-image
needs: wait-for-image-build
strategy:
fail-fast: false
matrix:
Expand Down
3 changes: 3 additions & 0 deletions api/v1beta1/moduletemplate_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ type ModuleTemplate struct {
type ModuleTemplateSpec struct {
// Channel is the targeted channel of the ModuleTemplate. It will be used to directly assign a Template
// to a target channel. It has to be provided at any given time.
// Deprecated: This field is deprecated and will be removed in a future release.
// +optional
// +kubebuilder:deprecatedversion
// +kubebuilder:validation:Pattern:=^[a-z]+$
// +kubebuilder:validation:MaxLength:=32
// +kubebuilder:validation:MinLength:=3
Expand Down
3 changes: 3 additions & 0 deletions api/v1beta2/moduletemplate_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ func (d *Descriptor) DeepCopyObject() machineryruntime.Object {
type ModuleTemplateSpec struct {
// Channel is the targeted channel of the ModuleTemplate. It will be used to directly assign a Template
// to a target channel. It has to be provided at any given time.
// Deprecated: This field is deprecated and will be removed in a future release.
// +optional
// +kubebuilder:deprecatedversion
// +kubebuilder:validation:Pattern:=^[a-z]+$
// +kubebuilder:validation:MaxLength:=32
// +kubebuilder:validation:MinLength:=3
Expand Down
14 changes: 7 additions & 7 deletions config/crd/bases/operator.kyma-project.io_moduletemplates.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ spec:
description: |-
Channel is the targeted channel of the ModuleTemplate. It will be used to directly assign a Template
to a target channel. It has to be provided at any given time.
Deprecated: This field is deprecated and will be removed in a future release.
maxLength: 32
minLength: 3
pattern: ^[a-z]+$
Expand Down Expand Up @@ -119,7 +120,6 @@ spec:
- remote
type: string
required:
- channel
- descriptor
- target
type: object
Expand Down Expand Up @@ -180,6 +180,7 @@ spec:
description: |-
Channel is the targeted channel of the ModuleTemplate. It will be used to directly assign a Template
to a target channel. It has to be provided at any given time.
Deprecated: This field is deprecated and will be removed in a future release.
maxLength: 32
minLength: 3
pattern: ^[a-z]+$
Expand Down Expand Up @@ -259,19 +260,19 @@ spec:
description: Name is the name of the icon.
type: string
required:
- link
- name
- link
- name
type: object
type: array
x-kubernetes-list-map-keys:
- name
- name
x-kubernetes-list-type: map
repository:
description: Repository is the link to the repository of the module.
type: string
required:
- documentation
- repository
- documentation
- repository
type: object
mandatory:
description: |-
Expand Down Expand Up @@ -310,7 +311,6 @@ spec:
pattern: ^((0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(-[a-zA-Z-][0-9a-zA-Z-]*)?)?$
type: string
required:
- channel
- descriptor
type: object
type: object
Expand Down
8 changes: 5 additions & 3 deletions docs/contributor/resources/03-moduletemplate.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@ kubectl get crd moduletemplates.operator.kyma-project.io -o yaml

## Configuration

### **.spec.channel**
### **.spec.channel** (Deprecated)

The channel that a ModuleTemplate CR is registered in. It is used alongside the channel attributes of the Kyma CR to match up a module and a channel.
The `channel` field previously indicated the channel in which a ModuleTemplate CR was registered. It was used alongside the channel attributes of the Kyma CR to match a module with a specific channel.

**Note:** This field is now deprecated and will be removed in a future release. It has been decided that ModuleTemplates are now tied directly to versions, rather than being associated with channels.

For the following ModuleTemplate CR:

Expand All @@ -27,7 +29,7 @@ spec:
channel: regular
```
the module will be referenced by any Kyma CR asking for it in the `regular` channel.
the module was referenced by any Kyma CR asking for it in the `regular` channel.

### **.spec.data**

Expand Down
3 changes: 2 additions & 1 deletion pkg/templatelookup/modulereleasemeta_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ package templatelookup_test
import (
"testing"

"github.com/stretchr/testify/require"

"github.com/kyma-project/lifecycle-manager/api/v1beta2"
"github.com/kyma-project/lifecycle-manager/pkg/templatelookup"
"github.com/stretchr/testify/require"
)

func Test_GetChannelVersionForModule_WhenEmptyChannels(t *testing.T) {
Expand Down
8 changes: 4 additions & 4 deletions pkg/templatelookup/regular.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,12 @@ func (t *TemplateLookup) PopulateModuleTemplateInfo(ctx context.Context,
module AvailableModule, namespace, kymaChannel string,
) ModuleTemplateInfo {
moduleReleaseMeta, err := GetModuleReleaseMeta(ctx, t, module.Name, namespace)
if err != nil && !util.IsNotFound(err) {
return ModuleTemplateInfo{Err: err}
if util.IsNotFound(err) {
return t.populateModuleTemplateInfoWithoutModuleReleaseMeta(ctx, module, kymaChannel)
}

if util.IsNotFound(err) || moduleReleaseMeta.Name == "" {
return t.populateModuleTemplateInfoWithoutModuleReleaseMeta(ctx, module, kymaChannel)
if err != nil && !util.IsNotFound(err) {
return ModuleTemplateInfo{Err: err}
}

return t.populateModuleTemplateInfoUsingModuleReleaseMeta(ctx, module, moduleReleaseMeta, kymaChannel, namespace)
Expand Down

0 comments on commit f88eeb3

Please sign in to comment.