Skip to content

Commit

Permalink
feat: monorepo setup for lifecycle-operator, scheduler and runtimes (#…
Browse files Browse the repository at this point in the history
…1857)

Co-authored-by: RealAnna <89971034+RealAnna@users.noreply.github.com>
Co-authored-by: Giovanni Liva <giovanni.liva@dynatrace.com>
  • Loading branch information
3 people committed Aug 29, 2023
1 parent 75baefd commit 84e243a
Show file tree
Hide file tree
Showing 50 changed files with 181 additions and 359 deletions.
4 changes: 2 additions & 2 deletions .github/actions/deploy-klt-on-cluster/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ runs:
run: |
echo "Installing KLT using manifests"
sed -i 's/imagePullPolicy: Always/imagePullPolicy: Never/g' ~/download/artifacts/lifecycle-operator-manifest-test/release.yaml
sed -i 's/ghcr.io\/keptn\/functions-runtime:.*/localhost:5000\/keptn\/functions-runtime:${{ inputs.runtime_tag }}/g' \
sed -i 's/ghcr.io\/keptn\/deno-runtime:.*/localhost:5000\/keptn\/deno-runtime:${{ inputs.runtime_tag }}/g' \
~/download/artifacts/lifecycle-operator-manifest-test/release.yaml
sed -i 's/ghcr.io\/keptn\/python-runtime:.*/localhost:5000\/keptn\/python-runtime:${{ inputs.runtime_tag }}/g' \
~/download/artifacts/lifecycle-operator-manifest-test/release.yaml
Expand Down Expand Up @@ -100,7 +100,7 @@ runs:
--set metricsOperator.manager.imagePullPolicy=Never \
--set metricsOperator.manager.image.tag=${{ inputs.runtime_tag }} \
--set metricsOperator.manager.image.repository="localhost:5000/keptn/metrics-operator" \
--set lifecycleOperator.manager.env.functionRunnerImage=localhost:5000/keptn/functions-runtime:${{ inputs.runtime_tag }} \
--set lifecycleOperator.manager.env.functionRunnerImage=localhost:5000/keptn/deno-runtime:${{ inputs.runtime_tag }} \
--set lifecycleOperator.manager.env.pythonRunnerImage=localhost:5000/keptn/python-runtime:${{ inputs.runtime_tag }} \
--set certificateOperator.manager.imagePullPolicy=Never \
--set certificateOperator.manager.image.tag=${{ inputs.runtime_tag }} \
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/CI.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,10 @@ jobs:
folder: "metrics-operator/"
- name: "scheduler"
folder: "scheduler/"
- name: "functions-runtime"
folder: "functions-runtime/"
- name: "deno-runtime"
folder: "runtimes/deno-runtime/"
- name: "python-runtime"
folder: "python-runtime/"
folder: "runtimes/python-runtime/"
- name: "certificate-operator"
folder: "klt-cert-manager/"
steps:
Expand Down Expand Up @@ -186,14 +186,14 @@ jobs:
run: make controller-gen

- name: Generate release.yaml
if: matrix.config.name != 'functions-runtime' && matrix.config.name != 'python-runtime'
if: matrix.config.name != 'deno-runtime' && matrix.config.name != 'python-runtime'
working-directory: ./${{ matrix.config.folder }}
env:
CHART_APPVERSION: dev-${{ env.DATETIME }}
run: make release-manifests

- name: Upload release.yaml for tests
if: matrix.config.name != 'functions-runtime' && matrix.config.name != 'python-runtime'
if: matrix.config.name != 'deno-runtime' && matrix.config.name != 'python-runtime'
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.config.name }}-manifest-test
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/integration-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ on:
workflow_call:
inputs:
runtime_tag:
description: "Tag for the functions runner image"
description: "Tag for the deno and python runner images"
type: "string"
required: true
helm-install:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/load-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ on:
workflow_call:
inputs:
runtime_tag:
description: "Tag for the functions runner image"
description: "Tag for the runner images"
type: "string"
required: true
env:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/performance-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ on:
workflow_call:
inputs:
runtime_tag:
description: "Tag for the functions runner image"
description: "Tag for the runner images"
type: "string"
required: true
env:
Expand Down
245 changes: 41 additions & 204 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ env:
# renovate: datasource=github-releases depName=kubernetes-sigs/controller-tools
CONTROLLER_TOOLS_VERSION: "v0.12.1"
SCHEDULER_COMPATIBLE_K8S_VERSION: "v0.24.3"
PUBLISHABLE_ITEMS: '[".", "lifecycle-operator", "metrics-operator", "klt-cert-manager", "runtimes/deno-runtime", "runtimes/python-runtime"]'

jobs:
release-please:
Expand Down Expand Up @@ -45,71 +46,53 @@ jobs:
default-branch: main
signoff: "keptn-bot <86361500+keptn-bot@users.noreply.github.com>"

- name: Release Info
run: |
echo "Release KLT: ${{ steps.release.outputs.release_created }}"
echo "Release KLT Cert Manager: ${{ steps.release.outputs.klt-cert-manager--release_created }}"
echo "Release KLT Metrics Operator: ${{ steps.release.outputs.metrics-operator--release_created }}"
echo "Anything to release: ${{ steps.release.outputs.releases_created }}"
echo "Paths to be released: ${{ steps.release.outputs.paths_released }}"
- name: Create build matrix
- name: Create release matrix
id: build-matrix
uses: actions/github-script@v6
env:
RELEASE_KLT: ${{ steps.release.outputs.release_created }}
RELEASE_CERT_MANAGER: ${{ steps.release.outputs.klt-cert-manager--release_created }}
RELEASE_METRICS_OPERATOR: ${{ steps.release.outputs.metrics-operator--release_created }}
CHANGED_ITEMS: ${{ steps.release.outputs.paths_released }}
KLT_TAG: ${{ steps.release.outputs.tag_name }}
CERT_MANAGER_TAG: ${{ steps.release.outputs.klt-cert-manager--tag_name }}
METRICS_OPERATOR_TAG: ${{ steps.release.outputs.metrics-operator--tag_name }}
ARTIFACT_TAG_NAME: ${{ steps.release.outputs[format('{0}--tag_name', steps.release.outputs.paths_released[0])] }}
with:
script: |
const { RELEASE_KLT, RELEASE_CERT_MANAGER, RELEASE_METRICS_OPERATOR, KLT_TAG, CERT_MANAGER_TAG, METRICS_OPERATOR_TAG } = process.env
var result = []
if (RELEASE_KLT === "true") {
result.push(...[
{
name: "lifecycle-operator",
folder: "lifecycle-operator/",
tagName: KLT_TAG
},
{
name: "scheduler",
folder: "scheduler/",
tagName: KLT_TAG
},
{
name: "functions-runtime",
folder: "functions-runtime/",
tagName: KLT_TAG
},
{
name: "python-runtime",
folder: "python-runtime/",
tagName: KLT_TAG
const changedItems = JSON.parse(process.env.CHANGED_ITEMS || '[]');
console.log("changed items", changedItems);
const eligibleItems = JSON.parse(process.env.PUBLISHABLE_ITEMS || '[]');
console.log("eligible items", eligibleItems);
const itemsToPublish = changedItems.filter(i => eligibleItems.includes(i));
console.log("items to publish", itemsToPublish);
console.log("setting up build matrix...");
const releaseMatrix = itemsToPublish.map(item => {
switch (item) {
case "lifecycle-operator":
return [
{
name: item,
folder: item,
tagName: process.env.ARTIFACT_TAG_NAME
},
{
name: "scheduler",
folder: "scheduler/",
tagName: process.env.ARTIFACT_TAG_NAME
}
];
case "metrics-operator":
case "klt-cert-manager":
case "runtimes/deno-runtime":
case "runtimes/python-runtime":
return [{
name: item,
folder: item,
tagName: process.env.ARTIFACT_TAG_NAME
}];
case ".":
default:
return [];
}
])
}
if (RELEASE_CERT_MANAGER === "true") {
result.push({
name: "certificate-operator",
folder: "klt-cert-manager/",
tagName: CERT_MANAGER_TAG
})
}
if (RELEASE_METRICS_OPERATOR === "true") {
result.push({
name: "metrics-operator",
folder: "metrics-operator/",
tagName: METRICS_OPERATOR_TAG
})
}
return { config: result }
});
return releaseMatrix;
build-release:
if: needs.release-please.outputs.releases-created == 'true'
Expand Down Expand Up @@ -200,152 +183,6 @@ jobs:
tag_name: ${{ matrix.config.tagName }}
files: ./sbom-${{ matrix.config.name }}.spdx.json

release-manifests:
if: needs.release-please.outputs.releases-created == 'true'
needs:
- release-please
- build-release
runs-on: ubuntu-22.04
steps:
- name: Install monitor action
uses: GitHubSecurityLab/actions-permissions/monitor@v1

- name: Checkout
uses: actions/checkout@v3

- name: Cache build tools lifecycle-operator
if: needs.release-please.outputs.klt-release-created == 'true'
id: cache-build-tools-lifecycle-operator
uses: actions/cache@v3
with:
path: ./lifecycle-operator/bin
key: build-tools-${{ github.ref_name }}

- name: Cache build tools metrics-operator
if: needs.release-please.outputs.metrics-operator-release-created == 'true'
id: cache-build-tools-metrics-operator
uses: actions/cache@v3
with:
path: ./metrics-operator/bin
key: build-tools-${{ github.ref_name }}

- name: Cache build tools scheduler
if: needs.release-please.outputs.klt-release-created == 'true'
id: cache-build-tools-scheduler
uses: actions/cache@v3
with:
path: ./scheduler/bin
key: build-tools-${{ github.ref_name }}

- name: Cache build tools cert-manager
if: needs.release-please.outputs.cert-manager-release-created == 'true'
id: cache-build-tools-klt-cert-manager
uses: actions/cache@v3
with:
path: ./klt-cert-manager/bin
key: build-tools-${{ github.ref_name }}

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}
check-latest: true

- name: Create KLT manifest
if: needs.release-please.outputs.klt-release-created == 'true'
env:
RELEASE_REGISTRY: ghcr.io/keptn
CHART_APPVERSION: ${{ needs.release-please.outputs.klt-tag-name }}
run: |
cd scheduler
make release-manifests
cd ../lifecycle-operator
make controller-gen release-manifests
cd ../klt-cert-manager
make controller-gen release-manifests
cd ../metrics-operator
make controller-gen release-manifests
cd ..
echo "---" >> lifecycle-operator/config/rendered/release.yaml
echo "---" >> scheduler/config/rendered/release.yaml
echo "---" >> klt-cert-manager/config/rendered/release.yaml
cat >> namespace.yaml << EOF
---
apiVersion: v1
kind: Namespace
metadata:
name: keptn-lifecycle-toolkit-system
---
EOF
cat namespace.yaml \
lifecycle-operator/config/rendered/release.yaml \
scheduler/config/rendered/release.yaml \
klt-cert-manager/config/rendered/release.yaml \
metrics-operator/config/rendered/release.yaml > klt-manifest.yaml
- name: Create Cert-Manager manifest
if: needs.release-please.outputs.cert-manager-release-created == 'true'
env:
RELEASE_REGISTRY: ghcr.io/keptn
CHART_APPVERSION: ${{ needs.release-please.outputs.cert-manager-tag-name }}
run: |
cd klt-cert-manager
make controller-gen release-manifests
cd ..
echo "---" >> klt-cert-manager/config/rendered/release.yaml
cat >> namespace.yaml << EOF
---
apiVersion: v1
kind: Namespace
metadata:
name: keptn-lifecycle-toolkit-system
---
EOF
cat namespace.yaml \
klt-cert-manager/config/rendered/release.yaml > cert-manager-manifest.yaml
- name: Create Metrics Operator manifest
if: needs.release-please.outputs.metrics-operator-release-created == 'true'
env:
RELEASE_REGISTRY: ghcr.io/keptn
CHART_APPVERSION: ${{ needs.release-please.outputs.metrics-operator-tag-name }}
run: |
cd metrics-operator
make controller-gen release-manifests
cd ..
echo "---" >> metrics-operator/config/rendered/release.yaml
cat >> namespace.yaml << EOF
---
apiVersion: v1
kind: Namespace
metadata:
name: keptn-lifecycle-toolkit-system
---
EOF
cat namespace.yaml \
metrics-operator/config/rendered/release.yaml > metrics-operator-manifest.yaml
- name: Attach KLT release assets
if: needs.release-please.outputs.klt-release-created == 'true'
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ needs.release-please.outputs.klt-tag-name }}
files: klt-manifest.yaml

- name: Attach Cert-Manager release assets
if: needs.release-please.outputs.cert-manager-release-created == 'true'
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ needs.release-please.outputs.cert-manager-tag-name }}
files: cert-manager-manifest.yaml

- name: Attach Metrics Operator release assets
if: needs.release-please.outputs.metrics-operator-release-created == 'true'
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ needs.release-please.outputs.metrics-operator-tag-name }}
files: metrics-operator-manifest.yaml

update-docs:
name: Update Documentation
needs:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/security-scans.yml
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ jobs:
matrix:
image:
- "functions-runtime"
- "deno-runtime"
- "python-runtime"
- "lifecycle-operator"
- "metrics-operator"
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/validate-semantic-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,13 @@ jobs:
test
deps
scopes: |
main
helm-chart
scheduler
lifecycle-operator
cert-manager
metrics-operator
functions-runtime
deno-runtime
python-runtime
dashboards
examples
Expand Down
4 changes: 0 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ integration-test: # to run a single test by name use --test eg. --test=expose-ke
kubectl kuttl test --start-kind=false ./test/integration/ --config=kuttl-test.yaml
kubectl kuttl test --start-kind=false ./test/testcertificate/ --config=kuttl-test.yaml



.PHONY: integration-test-local #these tests should run on a real cluster!
integration-test-local: install-prometheus
kubectl kuttl test --start-kind=false ./test/integration/ --config=kuttl-test-local.yaml
Expand All @@ -51,8 +49,6 @@ install-prometheus:
kubectl wait --for=condition=available deployment/kube-state-metrics -n monitoring --timeout=120s
kubectl wait pod/prometheus-k8s-0 --for=condition=ready --timeout=120s -n monitoring



.PHONY: cleanup-manifests
cleanup-manifests:
rm -rf manifests
Expand Down
Loading

0 comments on commit 84e243a

Please sign in to comment.