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: Use ModuleReleaseMeta in Kyma reconciliation loop instead of moduletemplate.channel #1947

Merged
merged 39 commits into from
Oct 16, 2024
Merged
Show file tree
Hide file tree
Changes from 31 commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
83c913d
Add implementation
nesmabadr Oct 9, 2024
f8cbad3
Add unit test
nesmabadr Oct 9, 2024
d4b5f5e
Adjust test
nesmabadr Oct 9, 2024
5f27fab
Adjust test
nesmabadr Oct 9, 2024
b9a4a85
Merge branch 'mrm_kyma_reconciliation' of https://github.com/nesmabad…
nesmabadr Oct 10, 2024
ac6b3d1
Merge branch 'main' into mrm_kyma_reconciliation
nesmabadr Oct 10, 2024
efd7fa9
Fix linting issue
nesmabadr Oct 10, 2024
6cb5f9e
Merge branch 'main' into mrm_kyma_reconciliation
nesmabadr Oct 11, 2024
6328b3a
Fix linting issue
nesmabadr Oct 11, 2024
64ac0f2
Merge branch 'mrm_kyma_reconciliation' of https://github.com/nesmabad…
nesmabadr Oct 11, 2024
44dc233
Merge branch 'main' into mrm_kyma_reconciliation
nesmabadr Oct 11, 2024
b3a9920
Merge branch 'main' into mrm_kyma_reconciliation
nesmabadr Oct 11, 2024
dfd5cbb
Add rbac for modulereleasemeta
nesmabadr Oct 11, 2024
690cb06
Merge branch 'mrm_kyma_reconciliation' of https://github.com/nesmabad…
nesmabadr Oct 11, 2024
610f499
Fix rbac
nesmabadr Oct 11, 2024
90eb7a0
Fix unit tests
nesmabadr Oct 11, 2024
ef73386
Fix role
nesmabadr Oct 11, 2024
e429203
Fix linting
nesmabadr Oct 11, 2024
3600c16
Fix unit test
nesmabadr Oct 11, 2024
63e3833
Fix role
nesmabadr Oct 11, 2024
8f99d52
Add E2E for ModuleReleaseMeta
nesmabadr Oct 14, 2024
3b91cec
Merge branch 'main' into mrm_kyma_reconciliation
nesmabadr Oct 14, 2024
3abcec3
Fix E2E test
nesmabadr Oct 14, 2024
c49ba2b
Fix E2E test
nesmabadr Oct 14, 2024
bc73b96
Your commit message here
nesmabadr Oct 14, 2024
066bba5
Add documentation
nesmabadr Oct 14, 2024
6112794
Fix non-blocking deletion test
nesmabadr Oct 14, 2024
2aef4af
Debug test
nesmabadr Oct 14, 2024
9fb6de1
Debug test
nesmabadr Oct 14, 2024
bf4db89
Add test case for old moduletemplate name with modulereleasemeta
nesmabadr Oct 15, 2024
641d862
Xin's comments
nesmabadr Oct 15, 2024
3171521
Xin's comments
nesmabadr Oct 15, 2024
175a7e0
Fix E2E test
nesmabadr Oct 15, 2024
130ffb8
Update docs/contributor/02-controllers.md
nesmabadr Oct 15, 2024
6187f69
Enhance doc
nesmabadr Oct 15, 2024
38e192b
Update docs/contributor/02-controllers.md
nesmabadr Oct 16, 2024
d2f50b6
Merge branch 'main' into mrm_kyma_reconciliation
nesmabadr Oct 16, 2024
bf69607
Update docs/contributor/02-controllers.md
nesmabadr Oct 16, 2024
b4bf47f
Merge branch 'main' into mrm_kyma_reconciliation
nesmabadr Oct 16, 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
Original file line number Diff line number Diff line change
@@ -0,0 +1,284 @@
name: Deploy template-operator With ModuleReleaseMeta
description: Deploys a test-specific template-operator and corresponding ModuleReleaseMeta.
runs:
using: composite
steps:
- name: Create Template Operator Module and apply ModuleTemplate and ModuleReleaseMeta
working-directory: template-operator
if: ${{ matrix.e2e-test == 'kyma-metrics' ||
matrix.e2e-test == 'non-blocking-deletion' ||
matrix.e2e-test == 'purge-controller' ||
matrix.e2e-test == 'purge-metrics' ||
matrix.e2e-test == 'kyma-deprovision-with-foreground-propagation' ||
matrix.e2e-test == 'kyma-deprovision-with-background-propagation' ||
matrix.e2e-test == 'module-consistency' ||
matrix.e2e-test == 'skip-manifest-reconciliation' ||
matrix.e2e-test == 'misconfigured-kyma-secret' ||
matrix.e2e-test == 'unmanage-module'
}}
shell: bash
run: |
make build-manifests
kyma alpha create module --module-config-file ./module-config.yaml --path . --registry localhost:5111 --insecure
sed -i 's/localhost:5111/k3d-kcp-registry.localhost:5000/g' ./template.yaml
sed -i 's/template-operator-regular/template-operator-1.0.1/g' ./template.yaml
kubectl get crds
kubectl apply -f template.yaml
kubectl apply -f module-release-meta.yaml
- name: Apply Template Operator Module and ModuleReleaseMeta for regular and fast channels
working-directory: lifecycle-manager
if: ${{ matrix.e2e-test == 'module-upgrade-channel-switch' ||
matrix.e2e-test == 'module-upgrade-new-version' ||
matrix.e2e-test == 'upgrade-under-deletion'
}}
shell: bash
run: |
sed -i 's/template-operator-fast/template-operator-2.4.2-e2e-test/g' tests/moduletemplates/moduletemplate_template_operator_v2_fast.yaml
sed -i 's/template-operator-regular/template-operator-1.1.1-e2e-test/g' tests/moduletemplates/moduletemplate_template_operator_v1_regular.yaml
sed -i 's/template-operator-regular/template-operator-2.4.2-e2e-test/g' tests/moduletemplates/moduletemplate_template_operator_v2_regular_new_version.yaml

kubectl apply -f tests/moduletemplates/moduletemplate_template_operator_v2_fast.yaml
kubectl apply -f tests/moduletemplates/moduletemplate_template_operator_v1_regular.yaml

cat <<EOF > mrm.yaml
apiVersion: operator.kyma-project.io/v1beta2
kind: ModuleReleaseMeta
metadata:
name: template-operator
namespace: kcp-system
spec:
channels:
- channel: fast
version: 2.4.2-e2e-test
- channel: regular
version: 1.1.1-e2e-test
moduleName: template-operator
EOF

kubectl apply -f mrm.yaml
- name: Create Template Operator Module for installation by version
working-directory: lifecycle-manager
if: ${{ matrix.e2e-test == 'module-install-by-version' }}
shell: bash
run: |
kubectl apply -f tests/moduletemplates/moduletemplate_template_operator_v2_fast.yaml
kubectl apply -f tests/moduletemplates/moduletemplate_template_operator_v1_regular.yaml
kubectl apply -f tests/moduletemplates/moduletemplate_template_operator_v2_direct_version.yaml
- name: Create Template Operator Module as Mandatory Module
working-directory: lifecycle-manager
if: ${{ matrix.e2e-test == 'mandatory-module' ||
matrix.e2e-test == 'mandatory-module-metrics'
}}
shell: bash
run: |
kubectl apply -f tests/moduletemplates/mandatory_moduletemplate_template_operator_v1.yaml
- name: Apply Template Operator Module V2 and ModuleReleaseMeta, fast channel
working-directory: ./lifecycle-manager
if: ${{ matrix.e2e-test == 'non-blocking-deletion' }}
shell: bash
run: |
sed -i 's/template-operator-fast/template-operator-2.4.2-e2e-test/g' tests/moduletemplates/moduletemplate_template_operator_v2_fast.yaml
kubectl apply -f tests/moduletemplates/moduletemplate_template_operator_v2_fast.yaml
cat <<EOF > mrm.yaml
apiVersion: operator.kyma-project.io/v1beta2
kind: ModuleReleaseMeta
metadata:
name: template-operator
namespace: kcp-system
spec:
channels:
- channel: fast
version: 2.4.2-e2e-test
- channel: regular
version: 1.0.1
moduleName: template-operator
EOF
kubectl apply -f mrm.yaml
- name: Create Template Operator Module with Deployment, with final state and final deletion state as `Warning` and apply
working-directory: template-operator
if: ${{ matrix.e2e-test == 'module-status-decoupling-with-deployment'}}
shell: bash
run: |
pushd config/overlays/deployment
echo \
"- op: replace
path: /spec/template/spec/containers/0/args/1
value: --final-state=Warning
- op: replace
path: /spec/template/spec/containers/0/args/2
value: --final-deletion-state=Warning" >> warning_patch.yaml
cat warning_patch.yaml
kustomize edit add patch --path warning_patch.yaml --kind Deployment
popd
make build-manifests
kyma alpha create module --module-config-file ./module-config.yaml --path . --registry localhost:5111 --insecure
sed -i 's/localhost:5111/k3d-kcp-registry.localhost:5000/g' ./template.yaml
sed -i 's/template-operator-regular/template-operator-1.0.1/g' ./template.yaml
kubectl get crds
kubectl apply -f template.yaml
kubectl apply -f module-release-meta.yaml
- name: Create Template Operator Module with StatefulSet, with final state and final deletion state as `Warning` and apply
working-directory: template-operator
if: ${{ matrix.e2e-test == 'module-status-decoupling-with-statefulset'}}
shell: bash
run: |
pushd config/overlays/statefulset
echo \
"- op: replace
path: /spec/template/spec/containers/0/args/1
value: --final-state=Warning
- op: replace
path: /spec/template/spec/containers/0/args/2
value: --final-deletion-state=Warning" >> warning_patch.yaml
cat warning_patch.yaml
kustomize edit add patch --path warning_patch.yaml --kind StatefulSet
popd
make build-statefulset-manifests
kyma alpha create module --module-config-file ./module-config.yaml --path . --registry localhost:5111 --insecure
sed -i 's/localhost:5111/k3d-kcp-registry.localhost:5000/g' ./template.yaml
sed -i 's/template-operator-regular/template-operator-1.0.1/g' ./template.yaml
kubectl get crds
kubectl apply -f template.yaml
kubectl apply -f module-release-meta.yaml
- name: Create non-working image patch for Template Operator Module and create associated module config file and applying ModuleReleaseMeta
working-directory: template-operator
if: ${{ matrix.e2e-test == 'module-status-decoupling-with-deployment'||
matrix.e2e-test == 'module-status-decoupling-with-statefulset'}}
shell: bash
run: |
echo "name: kyma-project.io/module/template-operator-misconfigured
channel: regular
version: v1.1.1
manifest: template-operator.yaml
security: sec-scanners-config.yaml
defaultCR: ./config/samples/default-sample-cr.yaml
annotations:
operator.kyma-project.io/doc-url: https://kyma-project.io" >> misconfigured-module-config.yaml

cat <<EOF > mrm.yaml
apiVersion: operator.kyma-project.io/v1beta2
kind: ModuleReleaseMeta
metadata:
name: template-operator-misconfigured
namespace: kcp-system
spec:
channels:
- channel: regular
version: 1.1.1
moduleName: template-operator-misconfigured
EOF

kubectl apply -f mrm.yaml
- name: Create Template Operator Module with Deployment, with non-working image and apply
working-directory: template-operator
if: ${{ matrix.e2e-test == 'module-status-decoupling-with-deployment'}}
shell: bash
run: |
pushd config/overlays/deployment
echo \
"- op: replace
path: /spec/template/spec/containers/0/image
value: non-working-path" >> image_patch.yaml
cat image_patch.yaml
kustomize edit add patch --path image_patch.yaml --kind Deployment
popd
make build-manifests
kyma alpha create module --module-config-file ./misconfigured-module-config.yaml --path . --registry localhost:5111 --insecure
sed -i 's/localhost:5111/k3d-kcp-registry.localhost:5000/g' ./template.yaml
sed -i 's/template-operator-misconfigured-regular/template-operator-misconfigured-1.1.1/g' ./template.yaml
kubectl get crds
kubectl apply -f template.yaml
- name: Create Template Operator Module with StatefulSet, with non-working image and apply
working-directory: template-operator
if: ${{ matrix.e2e-test == 'module-status-decoupling-with-statefulset'}}
shell: bash
run: |
pushd config/overlays/statefulset
echo \
"- op: replace
path: /spec/template/spec/containers/0/image
value: non-working-path" >> image_patch.yaml
cat image_patch.yaml
kustomize edit add patch --path image_patch.yaml --kind StatefulSet
popd
make build-statefulset-manifests
kyma alpha create module --module-config-file ./misconfigured-module-config.yaml --path . --registry localhost:5111 --insecure
sed -i 's/localhost:5111/k3d-kcp-registry.localhost:5000/g' ./template.yaml
sed -i 's/template-operator-misconfigured-regular/template-operator-misconfigured-1.1.1/g' ./template.yaml
kubectl get crds
kubectl apply -f template.yaml

- name: Create Template Operator Module without default CR and apply ModuleReleaseMeta
working-directory: template-operator
if: ${{ matrix.e2e-test == 'module-without-default-cr' }}
shell: bash
run: |
make build-manifests
echo "name: kyma-project.io/module/template-operator
channel: regular
version: v1.0.0
manifest: template-operator.yaml
security: sec-scanners-config.yaml
annotations:
operator.kyma-project.io/doc-url: https://kyma-project.io" >> module-config-no-cr.yaml
kyma alpha create module \
--module-config-file ./module-config-no-cr.yaml \
--path . \
--registry localhost:5111 \
--insecure
sed -i 's/localhost:5111/k3d-kcp-registry.localhost:5000/g' ./template.yaml
sed -i 's/template-operator-regular/template-operator-1.0.0/g' ./template.yaml
kubectl get crds
kubectl apply -f template.yaml
cat <<EOF > mrm.yaml
apiVersion: operator.kyma-project.io/v1beta2
kind: ModuleReleaseMeta
metadata:
name: template-operator
namespace: kcp-system
spec:
channels:
- channel: regular
version: 1.0.0
moduleName: template-operator
EOF

kubectl apply -f mrm.yaml

- name: Apply ModuleReleaseMeta and Template Operator Module in OCM format
working-directory: ./lifecycle-manager
if: ${{ matrix.e2e-test == 'ocm-compatible-module-template' }}
shell: bash
run: |
sed -i 's/template-operator-regular/template-operator-1.0.0-new-ocm-format/g' tests/moduletemplates/moduletemplate_template_operator_regular_new_ocm.yaml
kubectl apply -f tests/moduletemplates/moduletemplate_template_operator_regular_new_ocm.yaml
cat <<EOF > mrm.yaml
apiVersion: operator.kyma-project.io/v1beta2
kind: ModuleReleaseMeta
metadata:
name: template-operator
namespace: kcp-system
spec:
channels:
- channel: regular
version: 1.0.0-new-ocm-format
moduleName: template-operator
EOF

kubectl apply -f mrm.yaml

- name: Apply ModuleReleaseMeta with ModuleTemplate with name <modulename>-<channel>
working-directory: template-operator
if: ${{ matrix.e2e-test == 'modulereleasemeta-with-old-moduletemplate-name' }}
shell: bash
run: |
make build-manifests
kyma alpha create module --module-config-file ./module-config.yaml --path . --registry localhost:5111 --insecure
sed -i 's/localhost:5111/k3d-kcp-registry.localhost:5000/g' ./template.yaml
kubectl apply -f template.yaml
kubectl apply -f module-release-meta.yaml





104 changes: 104 additions & 0 deletions .github/workflows/test-e2e-with-modulereleasemeta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
name: TestSuite E2E with ModuleReleaseMeta
nesmabadr marked this conversation as resolved.
Show resolved Hide resolved

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:
types: [ opened, edited, synchronize, reopened, ready_for_review ]
jobs:
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 With ModuleReleaseMeta
needs: wait-for-image-build
strategy:
fail-fast: false
matrix:
e2e-test:
- watcher-enqueue
- kyma-deprovision-with-foreground-propagation
- kyma-deprovision-with-background-propagation
- module-status-decoupling-with-statefulset
- module-status-decoupling-with-deployment
- kyma-metrics
- module-without-default-cr
- module-consistency
- non-blocking-deletion
- upgrade-under-deletion
- purge-controller
- purge-metrics
- module-upgrade-channel-switch
- module-upgrade-new-version
- unmanage-module
- skip-manifest-reconciliation
- ca-certificate-rotation
- self-signed-certificate-rotation
- mandatory-module
- mandatory-module-metrics
- misconfigured-kyma-secret
- rbac-privileges
- ocm-compatible-module-template
- modulereleasemeta-with-obsolete-moduletemplate
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- name: Checkout lifecycle-manager
uses: actions/checkout@v4
with:
path: lifecycle-manager

- name: Checkout template-operator
uses: actions/checkout@v4
with:
repository: kyma-project/template-operator
path: template-operator

- name: Get configuration
uses: ./lifecycle-manager/.github/actions/get-configuration
id: configuration

- name: Setup tools
uses: ./lifecycle-manager/.github/actions/setup-tools
with:
k8s_version: ${{ steps.configuration.outputs.k8s_version }}
istio_version: ${{ steps.configuration.outputs.istio_version }}
k3d_version: ${{ steps.configuration.outputs.k3d_version }}
go-version-file: lifecycle-manager/go.mod
cache-dependency-path: lifecycle-manager/go.sum

- name: Setup test clusters
uses: ./lifecycle-manager/.github/actions/setup-test-clusters
with:
k8s_version: ${{ steps.configuration.outputs.k8s_version }}
cert_manager_version: ${{ steps.configuration.outputs.cert_manager_version }}

- name: Deploy lifecycle-manager
uses: ./lifecycle-manager/.github/actions/deploy-lifecycle-manager-e2e
with:
klm_version_tag: ${{ steps.configuration.outputs.klm_version_tag }}
klm_image_repo: ${{ steps.configuration.outputs.klm_image_repo }}

- name: Deploy template-operator
uses: ./lifecycle-manager/.github/actions/deploy-template-operator-with-modulereleasemeta

- name: Run '${{ matrix.e2e-test }}' test
working-directory: lifecycle-manager
run: |
make -C tests/e2e ${{ matrix.e2e-test }}
Loading
Loading