diff --git a/.github/labeler.yml b/.github/labeler.yml index 55d9de5316..86b3ad8b49 100644 --- a/.github/labeler.yml +++ b/.github/labeler.yml @@ -2,8 +2,8 @@ documentation: - docs/**/* - "**/*.md" -operator: - - operator/**/* +lifecycle-operator: + - lifecycle-operator/**/* scheduler: - scheduler/**/* diff --git a/.github/scripts/generate-crd-docs/crd-docs-generator-config.yaml b/.github/scripts/generate-crd-docs/crd-docs-generator-config.yaml index 0a1fdff5dc..3dd0d4bb40 100644 --- a/.github/scripts/generate-crd-docs/crd-docs-generator-config.yaml +++ b/.github/scripts/generate-crd-docs/crd-docs-generator-config.yaml @@ -1,7 +1,7 @@ processor: useRawDocstring: true ignoreTypes: - - "nomatch" # this needs to be in place as a workaround to avoid generation bugs + - "EmptyStatus$" ignoreFields: - "TypeMeta$" - "EmptyStatus$" diff --git a/.github/scripts/generate-crd-docs/generate-crd-docs.sh b/.github/scripts/generate-crd-docs/generate-crd-docs.sh index 91d3c37aef..bb00b948d4 100755 --- a/.github/scripts/generate-crd-docs/generate-crd-docs.sh +++ b/.github/scripts/generate-crd-docs/generate-crd-docs.sh @@ -2,15 +2,15 @@ # CRD docs auto generation script # -# This script goes through all API definitions in the operator/apis folder +# This script goes through all API definitions in the lifecycle-operator/apis folder # and generates docs from code for each API group and version # # Inputs: None # renovate: datasource=github-releases depName=elastic/crd-ref-docs -GENERATOR_VERSION=master +GENERATOR_VERSION=v0.0.9 API_DOMAIN="keptn.sh" -OPERATOR_API_ROOT='operator/apis/' +OPERATOR_API_ROOT='lifecycle-operator/apis/' METRICS_API_ROOT='metrics-operator/api/' TEMPLATE_DIR='.github/scripts/generate-crd-docs/templates' RENDERER='markdown' diff --git a/.github/scripts/generate-helm-docs.sh b/.github/scripts/generate-helm-docs.sh index 4e847f550a..f6abcc9d3b 100755 --- a/.github/scripts/generate-helm-docs.sh +++ b/.github/scripts/generate-helm-docs.sh @@ -9,7 +9,7 @@ # Node >=16 # renovate: datasource=github-releases depName=bitnami-labs/readme-generator-for-helm -GENERATOR_VERSION="2.5.0" +GENERATOR_VERSION="2.5.1" echo "Checking if readme generator is installed already..." if [[ $(npm list -g | grep -c "readme-generator-for-helm@${GENERATOR_VERSION}") -eq 0 ]]; then diff --git a/.github/workflows/CI.yaml b/.github/workflows/CI.yaml index 88c9a686c0..058551c13e 100644 --- a/.github/workflows/CI.yaml +++ b/.github/workflows/CI.yaml @@ -77,7 +77,7 @@ jobs: matrix: config: - name: "lifecycle-operator" - folder: "operator/" + folder: "lifecycle-operator/" - name: "metrics-operator" folder: "metrics-operator/" - name: "scheduler" @@ -119,7 +119,7 @@ jobs: matrix: config: - name: "lifecycle-operator" - folder: "operator/" + folder: "lifecycle-operator/" - name: "metrics-operator" folder: "metrics-operator/" - name: "scheduler" diff --git a/.github/workflows/component-test.yml b/.github/workflows/component-test.yml index be2529fcee..b0874ad90e 100644 --- a/.github/workflows/component-test.yml +++ b/.github/workflows/component-test.yml @@ -19,11 +19,11 @@ jobs: with: go-version: ${{ env.GO_VERSION }} cache: true - cache-dependency-path: 'operator/go.sum' + cache-dependency-path: 'lifecycle-operator/go.sum' check-latest: true - name: Execute Component Tests - working-directory: operator + working-directory: lifecycle-operator run: make component-test - name: Report code coverage diff --git a/.github/workflows/e2e-test.yml b/.github/workflows/e2e-test.yml index 22d6ec9e4f..2b1f4401c1 100644 --- a/.github/workflows/e2e-test.yml +++ b/.github/workflows/e2e-test.yml @@ -20,7 +20,7 @@ jobs: matrix: config: - name: "lifecycle-operator" - folder: "operator/" + folder: "lifecycle-operator/" - name: "scheduler" folder: "scheduler/" steps: diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index 077871e169..9a2bcad8fd 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -28,7 +28,7 @@ jobs: matrix: config: - name: "lifecycle-operator" - folder: "operator/" + folder: "lifecycle-operator/" - name: "metrics-operator" folder: "metrics-operator/" - name: "scheduler" @@ -43,6 +43,8 @@ jobs: with: go-version: ${{ env.GO_VERSION }} check-latest: true + cache: true + cache-dependency-path: '${{ matrix.config.folder }}go.sum' - name: golangci-lint uses: golangci/golangci-lint-action@v3 diff --git a/.github/workflows/helm-checks.yaml b/.github/workflows/helm-checks.yaml index acdbd7d4b5..7e0f0dc2cd 100644 --- a/.github/workflows/helm-checks.yaml +++ b/.github/workflows/helm-checks.yaml @@ -55,7 +55,7 @@ jobs: matrix: config: - name: "lifecycle-operator" - folder: "operator/" + folder: "lifecycle-operator/" - name: "metrics-operator" folder: "metrics-operator/" - name: "scheduler" diff --git a/.github/workflows/htmltest.yaml b/.github/workflows/htmltest.yaml index 3caeea3ced..fd794fbc3c 100644 --- a/.github/workflows/htmltest.yaml +++ b/.github/workflows/htmltest.yaml @@ -38,7 +38,7 @@ jobs: with: path: | docs/tmp/.hugo - key: ${{ runner.os }}-hugo + key: ${{ runner.os }}-hugo-${{ hashFiles('docs/go.sum') }} - name: Check HTML run: make htmltest diff --git a/.github/workflows/markdown-checks.yaml b/.github/workflows/markdown-checks.yaml index c51a653aa5..2e0847c5bc 100644 --- a/.github/workflows/markdown-checks.yaml +++ b/.github/workflows/markdown-checks.yaml @@ -7,15 +7,15 @@ on: - '[0-9]+.[1-9][0-9]*.x' paths: - '**.md' - - 'operator/apis' - - 'metrics-operator/api' + - 'lifecycle-operator/apis/**' + - 'metrics-operator/api/**' pull_request: branches: - 'main' - '[0-9]+.[1-9][0-9]*.x' paths: - '**.md' - - 'operator/apis/**' + - 'lifecycle-operator/apis/**' - 'metrics-operator/api/**' env: @@ -76,6 +76,7 @@ jobs: with: go-version: ${{ env.GO_VERSION }} check-latest: true + cache: false - name: Copy old docs run: | diff --git a/.github/workflows/performance-test.yml b/.github/workflows/performance-test.yml index b5384ab281..a3f4577cc9 100644 --- a/.github/workflows/performance-test.yml +++ b/.github/workflows/performance-test.yml @@ -26,7 +26,7 @@ jobs: runtime_tag: ${{ inputs.runtime_tag }} - name: Execute Performance Tests - working-directory: operator + working-directory: lifecycle-operator run: | make performance-test diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 778fbd197a..a2ac774c4f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -25,6 +25,8 @@ jobs: klt-tag-name: ${{ steps.release.outputs.tag_name }} cert-manager-release-created: ${{ steps.release.outputs.klt-cert-manager--release_created }} cert-manager-tag-name: ${{ steps.release.outputs.klt-cert-manager--tag_name }} + metrics-operator-release-created: ${{ steps.release.outputs.metrics-operator--release_created }} + metrics-operator-tag-name: ${{ steps.release.outputs.metrics-operator--tag_name }} releases-created: ${{ steps.release.outputs.releases_created }} build-matrix: ${{ steps.build-matrix.outputs.result }} steps: @@ -42,10 +44,11 @@ jobs: - 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 "Anything to release: ${{ steps.release.outputs.releases_created }}" - echo "Paths to be released: ${{ steps.release.outputs.paths_released }}" + 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 id: build-matrix @@ -53,56 +56,57 @@ jobs: 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 }} 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 }} with: script: | - const { RELEASE_KLT, RELEASE_CERT_MANAGER, KLT_TAG, CERT_MANAGER_TAG } = process.env - const kltMatrix = [ - { - name: "lifecycle-operator", - folder: "operator/", - tagName: KLT_TAG - }, - { - name: "metrics-operator", - folder: "metrics-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 certManagerMatrix = [ - { + 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 + } + ]) + } + + if (RELEASE_CERT_MANAGER === "true") { + result.push({ name: "certificate-operator", folder: "klt-cert-manager/", tagName: CERT_MANAGER_TAG - } - ] - - let result = {} - if (RELEASE_KLT === "true" && RELEASE_CERT_MANAGER === "true") { - result = { config: [...kltMatrix, ...certManagerMatrix]} - } else if (RELEASE_KLT === "true") { - result = { config: kltMatrix } - } else if (RELEASE_CERT_MANAGER === "true") { - result = { config: certManagerMatrix } + }) } - return result + + if (RELEASE_METRICS_OPERATOR === "true") { + result.push({ + name: "metrics-operator", + folder: "metrics-operator/", + tagName: METRICS_OPERATOR_TAG + }) + } + + return { config: result } build-release: if: needs.release-please.outputs.releases-created == 'true' @@ -144,7 +148,8 @@ jobs: run: | # Remove artifact prefix from tag so that we get clean image tags temp="${IMAGE_TAG##klt-}" - echo "IMAGE_TAG=${temp##cert-manager-}" >> "$GITHUB_OUTPUT" + temp="${temp##cert-manager-}" + echo "IMAGE_TAG=${temp##metrics-operator-}" >> "$GITHUB_OUTPUT" - name: Build Docker Image id: docker_build_image @@ -199,16 +204,16 @@ jobs: - name: Checkout uses: actions/checkout@v3 - - name: Cache build tools operator + - name: Cache build tools lifecycle-operator if: needs.release-please.outputs.klt-release-created == 'true' - id: cache-build-tools-operator + id: cache-build-tools-lifecycle-operator uses: actions/cache@v3 with: - path: ./operator/bin + path: ./lifecycle-operator/bin key: build-tools-${{ github.ref_name }} - name: Cache build tools metrics-operator - if: needs.release-please.outputs.klt-release-created == 'true' + if: needs.release-please.outputs.metrics-operator-release-created == 'true' id: cache-build-tools-metrics-operator uses: actions/cache@v3 with: @@ -245,14 +250,14 @@ jobs: run: | cd scheduler make release-manifests - cd ../operator + 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 "---" >> operator/config/rendered/release.yaml + 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 @@ -264,7 +269,7 @@ jobs: --- EOF cat namespace.yaml \ - operator/config/rendered/release.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 @@ -279,7 +284,37 @@ jobs: make controller-gen release-manifests cd .. echo "---" >> klt-cert-manager/config/rendered/release.yaml - cat klt-cert-manager/config/rendered/release.yaml > cert-manager-manifest.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' @@ -295,6 +330,13 @@ jobs: 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: diff --git a/.github/workflows/security-scans.yml b/.github/workflows/security-scans.yml index 5309d79910..f97f9c1de5 100644 --- a/.github/workflows/security-scans.yml +++ b/.github/workflows/security-scans.yml @@ -146,8 +146,8 @@ jobs: go install github.com/yannh/kubeconform/cmd/kubeconform@${{ matrix.version }} echo "::endgroup::" - cd operator/config/default - sed -i 's/\- ..\/crd//' kustomization.yaml && kustomize build ./ > /tmp/operator-manifest.yaml + cd lifecycle-operator/config/default + sed -i 's/\- ..\/crd//' kustomization.yaml && kustomize build ./ > /tmp/lifecycle-operator-manifest.yaml cd ../crd && kustomize build ./ > /tmp/crds.yaml cd ../../../metrics-operator/config/default sed -i 's/\- ..\/crd//' kustomization.yaml && kustomize build ./ > /tmp/metrics-operator-manifest.yaml @@ -159,9 +159,9 @@ jobs: mkdir -p /tmp/schema && cd /tmp/schema python3 ../openapi2jsonschema.py ../crds.yaml cd .. && \ - echo "---" >> operator-manifest.yaml && \ + echo "---" >> lifecycle-operator-manifest.yaml && \ echo "---" >> scheduler-manifest.yaml && \ - cat operator-manifest.yaml scheduler-manifest.yaml metrics-operator-manifest.yaml > manifest.yaml + cat lifecycle-operator-manifest.yaml scheduler-manifest.yaml metrics-operator-manifest.yaml > manifest.yaml kubeconform \ -schema-location default \ -schema-location './schema/{{ .ResourceKind }}_{{ .ResourceAPIVersion }}.json' \ @@ -221,7 +221,7 @@ jobs: fail-fast: false matrix: artifact: - - "operator" + - "lifecycle-operator" - "metrics-operator" - "scheduler" - "klt-cert-manager" diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index 5e25639c30..a2c48f9a62 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -20,7 +20,7 @@ jobs: This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. stale-pr-message: | - This issue has been automatically marked as stale because it has not had recent activity. It will be + This PR has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. stale-good-first-issues: @@ -36,7 +36,7 @@ jobs: include-only-assigned: true remove-stale-when-updated: true only-issue-labels: 'good first issue' - stale-issue-label: '' + stale-issue-label: 'update-requested' - uses: actions/stale@v8 with: diff --git a/.github/workflows/validate-semantic-pr.yml b/.github/workflows/validate-semantic-pr.yml index 6d266e2039..16a2a7c7e6 100644 --- a/.github/workflows/validate-semantic-pr.yml +++ b/.github/workflows/validate-semantic-pr.yml @@ -35,7 +35,7 @@ jobs: scopes: | helm-chart scheduler - operator + lifecycle-operator cert-manager metrics-operator functions-runtime diff --git a/.gitignore b/.gitignore index 1f6b1f65c2..653ba8c78e 100644 --- a/.gitignore +++ b/.gitignore @@ -25,7 +25,7 @@ kubeconfig manifests/ /scheduler/config/rendered/release.yaml -/operator/config/rendered/release.yaml +/lifecycle-operator/config/rendered/release.yaml /metrics-operator/config/rendered/release.yaml /klt-cert-manager/config/rendered/release.yaml # macOS diff --git a/.sonarcloud.properties b/.sonarcloud.properties index df1bdabccd..ae9cf34867 100644 --- a/.sonarcloud.properties +++ b/.sonarcloud.properties @@ -2,8 +2,8 @@ sonar.projectKey=keptn_lifecycle-toolkit sonar.projectName=lifecycle-toolkit sonar.cpd.exclusions= **/*_test.go,\ scheduler/test/e2e/fake/**/*.go,\ - operator/apis/lifecycle/v1alpha1/**/*.go,\ - operator/apis/lifecycle/v1alpha2/**/*.go,\ + lifecycle-operator/apis/lifecycle/v1alpha1/**/*.go,\ + lifecycle-operator/apis/lifecycle/v1alpha2/**/*.go,\ metrics-operator/api/v1alpha1/**/*.go,\ metrics-operator/api/v1alpha2/**/*.go,\ metrics-operator/api/v1alpha3/**/*.go,\ diff --git a/.yamllint b/.yamllint index ddb236d18e..ecdd76fd14 100644 --- a/.yamllint +++ b/.yamllint @@ -7,10 +7,10 @@ ignore: | **/rendered/release.yaml examples/support/observability/config/prometheus dashboards/grafana - operator/config/crd/bases/* + lifecycle-operator/config/crd/bases/* metrics-operator/config/crd/bases/* klt-cert-manager/config/crd/bases/* - operator/config/rbac/role.yaml + lifecycle-operator/config/rbac/role.yaml metrics-operator/config/rbac/role.yaml klt-cert-manager/config/rbac/role.yaml helm/chart/templates diff --git a/Makefile b/Makefile index 642fc000a2..9f1f5e2b40 100644 --- a/Makefile +++ b/Makefile @@ -85,22 +85,22 @@ helm-package: .PHONY: build-release-manifests build-release-manifests: - $(MAKE) -C operator generate + $(MAKE) -C lifecycle-operator generate $(MAKE) -C klt-cert-manager generate $(MAKE) -C metrics-operator generate - $(MAKE) -C operator release-manifests RELEASE_REGISTRY=$(RELEASE_REGISTRY) TAG=$(TAG) ARCH=$(ARCH) CHART_APPVERSION=$(CHART_APPVERSION) + $(MAKE) -C lifecycle-operator release-manifests RELEASE_REGISTRY=$(RELEASE_REGISTRY) TAG=$(TAG) ARCH=$(ARCH) CHART_APPVERSION=$(CHART_APPVERSION) $(MAKE) -C scheduler release-manifests RELEASE_REGISTRY=$(RELEASE_REGISTRY) TAG=$(TAG) ARCH=$(ARCH) CHART_APPVERSION=$(CHART_APPVERSION) $(MAKE) -C klt-cert-manager release-manifests RELEASE_REGISTRY=$(RELEASE_REGISTRY) TAG=$(TAG) ARCH=$(ARCH) CHART_APPVERSION=$(CHART_APPVERSION) $(MAKE) -C metrics-operator release-manifests RELEASE_REGISTRY=$(RELEASE_REGISTRY) TAG=$(TAG) ARCH=$(ARCH) CHART_APPVERSION=$(CHART_APPVERSION) .PHONY: build-deploy-operator build-deploy-operator: - $(MAKE) -C operator release-local.$(ARCH) RELEASE_REGISTRY=$(RELEASE_REGISTRY) TAG=$(TAG) - $(MAKE) -C operator push-local RELEASE_REGISTRY=$(RELEASE_REGISTRY) TAG=$(TAG) - $(MAKE) -C operator release-manifests RELEASE_REGISTRY=$(RELEASE_REGISTRY) CHART_APPVERSION=$(TAG) ARCH=$(ARCH) + $(MAKE) -C lifecycle-operator release-local.$(ARCH) RELEASE_REGISTRY=$(RELEASE_REGISTRY) TAG=$(TAG) + $(MAKE) -C lifecycle-operator push-local RELEASE_REGISTRY=$(RELEASE_REGISTRY) TAG=$(TAG) + $(MAKE) -C lifecycle-operator release-manifests RELEASE_REGISTRY=$(RELEASE_REGISTRY) CHART_APPVERSION=$(TAG) ARCH=$(ARCH) - kubectl apply -f operator/config/rendered/release.yaml + kubectl apply -f lifecycle-operator/config/rendered/release.yaml .PHONY: build-deploy-metrics-operator build-deploy-metrics-operator: diff --git a/README.md b/README.md index 2a91d3f105..2244badd01 100644 --- a/README.md +++ b/README.md @@ -6,10 +6,13 @@ ![version](https://img.shields.io/github/v/release/keptn/lifecycle-toolkit) [![GitHub Discussions](https://img.shields.io/github/discussions/keptn/lifecycle-toolkit)](https://github.com/keptn/lifecycle-toolkit/discussions) -The goal of this toolkit is to introduce a more “cloud-native” approach for pre- and post-deployment, as well as the -concept of application health checks. -It is an incubating project, under the umbrella of -the [Keptn Application Lifecycle working group](https://github.com/keptn/wg-app-lifecycle). +The Keptn Lifecycle Toolkit (KLT) provides a “cloud-native” approach +for managing the application release lifecycle +with pre- and post-deployment evaluations and tasks. +It also supports application health checks, +metrics, and observability. +It is an incubating project, under the umbrella of the +[Keptn Application Lifecycle working group](https://github.com/keptn/wg-app-lifecycle). Status of the different features: @@ -17,10 +20,13 @@ Status of the different features: Observability: expose [OTel](https://opentelemetry.io/) metrics and traces of your deployment. - ![status](https://img.shields.io/badge/status-alpha-orange) K8s Custom Metrics: expose your Observability platform via the [Custom Metric API](https://github.com/kubernetes/design-proposals-archive/blob/main/instrumentation/custom-metrics-api.md). -- ![status](https://img.shields.io/badge/status-alpha-orange) +- ![status](https://img.shields.io/badge/status-beta-yellow) Release lifecycle: handle pre- and post-checks of your Application deployment. - ![status](https://img.shields.io/badge/status-stable-brightgreen) - Certificate Manager: automatically configure TLS certificates for + Certificate Manager: automatically configure TLS certificates with the + [Keptn Certificate Manager](https://lifecycle.keptn.sh/docs/concepts/architecture/cert-manager/). + You can instead + [configure your own certificate manager](https://lifecycle.keptn.sh/docs/install/cert-manager/) to provide [secure communication with the Kube API](https://kubernetes.io/docs/concepts/security/controlling-access/#transport-security). +The status follows the +[Kubernetes API versioning schema](https://kubernetes.io/docs/reference/using-api/#api-versioning). -The status follows the [Kubernetes API versioning schema](https://kubernetes.io/docs/reference/using-api/#api-versioning). - -For more info about the features, please refer to our [documentation](https://lifecycle.keptn.sh/docs/). +For more info about the features, please refer to our +[documentation](https://lifecycle.keptn.sh/docs/). +The documentation also includes information about +installing the Keptn Lifecycle Toolkit +and migrating to it from +[Keptn v1](https://keptn.sh/docs/). ## Watch the KubeCon 2022 Detroit Demo @@ -83,89 +94,22 @@ for more info. ## Goals -The Keptn Lifecycle Toolkit aims to support Cloud Native teams with: +The Keptn Lifecycle Toolkit provides Cloud Native teams with +the following capabilities: - Pre-requisite evaluation before deploying workloads and applications -- Finding out when an application (not workload) is ready and working +- Finding out when an application (not just a workload) is ready and working - Checking the Application Health in a declarative (cloud-native) way -- Standardized way for pre- and post-deployment tasks +- Standardized way to run pre- and post-deployment tasks - Provide out-of-the-box Observability of the deployment cycle ![Operator Maturity Model with third level circled in](./assets/operator-maturity.jpg) -The Keptn Lifecycle Toolkit could be seen as a general purpose and -declarative [Level 3 operator](https://operatorframework.io/operator-capabilities/) for your Application. -For this reason, the Keptn Lifecycle Toolkit is agnostic to deployment tools that are used and works with any GitOps -solution. - -## How to use - -The Keptn Lifecycle Toolkit monitors manifests that have been applied against the Kubernetes API and reacts if it finds -a workload with special annotations/labels. -For this, you should annotate your [Workload](https://kubernetes.io/docs/concepts/workloads/) with (at least) the -following annotations: - -```yaml -keptn.sh/app: myAwesomeAppName -keptn.sh/workload: myAwesomeWorkload -keptn.sh/version: myAwesomeWorkloadVersion -``` - -Alternatively, you can use -Kubernetes [Recommended Labels](https://kubernetes.io/docs/concepts/overview/working-with-objects/common-labels/) to -annotate your workload: - -```yaml -app.kubernetes.io/part-of: myAwesomeAppName -app.kubernetes.io/name: myAwesomeWorkload -app.kubernetes.io/version: myAwesomeWorkloadVersion -``` - -In general, the Keptn Annotations/Labels take precedence over the Kubernetes recommended labels. -If there is no version -annotation/label and there is only one container in the pod, the Lifecycle Toolkit will take the image tag as version ( -if it is not "latest"). - -In case you want to run pre- and post-deployment checks, further annotations are necessary: - -```yaml -keptn.sh/pre-deployment-tasks: verify-infrastructure-problems -keptn.sh/post-deployment-tasks: slack-notification,performance-test -``` - -The value of these annotations are -Keptn [CRDs](https://kubernetes.io/docs/concepts/extend-kubernetes/api-extension/custom-resources/) -called [KeptnTaskDefinition](#keptntaskdefinition)s. -These CRDs contains re-usable "functions" that can -executed before and after the deployment. -In this example, before the deployment starts, a check for open problems in -your infrastructure -is performed. -If everything is fine, the deployment continues and afterward, a slack notification is sent with the -result of -the deployment and a pipeline to run performance tests is invoked. -Otherwise, the deployment is kept in a pending state -until -the infrastructure is capable to accept deployments again. - -A more comprehensive example can be found in our [examples folder](./examples/sample-app/) where we -use [Podtato-Head](https://github.com/podtato-head/podtato-head) to run some simple pre-deployment checks. - -To run the example, use the following commands: - -```bash -cd ./examples/podtatohead-deployment/ -kubectl apply -f . -``` - -Afterward, you can monitor the status of the deployment using - -```bash -kubectl get keptnworkloadinstance -n podtato-kubectl -w -``` - -The deployment for a Workload will stay in a `Pending` state until the respective pre-deployment check is completed. -Afterward, the deployment will start and when it is `Succeeded`, the post-deployment checks will start. +The Keptn Lifecycle Toolkit can be seen as a general purpose and declarative +[Level 3 operator](https://operatorframework.io/operator-capabilities/) +for your Application. +For this reason, the Keptn Lifecycle Toolkit is agnostic to deployment tools +that are used and works with any GitOps solution. ## Architecture @@ -174,29 +118,34 @@ The Keptn Lifecycle Toolkit is composed of the following components: - Keptn Lifecycle Operator - Keptn Scheduler -The Keptn Lifecycle Operator contains several controllers for Keptn CRDs and a Mutating Webhook. -The Keptn Scheduler ensures that Pods are started only after the pre-deployment checks have finished. - -A Kubernetes Manifest, which is annotated with Keptn specific annotations, gets applied to the Kubernetes Cluster. -Afterward, the Keptn Scheduler gets injected (via Mutating Webhook), and Kubernetes Events for Pre-Deployment are sent -to the event stream. -The Event Controller watches for events and triggers a Kubernetes Job to fullfil the Pre-Deployment. -After the Pre-Deployment has finished, the Keptn Scheduler schedules the Pod to be deployed. -The KeptnApp and KeptnWorkload Controllers watch for the workload resources to finish and then generate a -Post-Deployment Event. -After the Post-Deployment checks, SLOs can be validated using an interface for retrieving SLI data from a provider, +The Keptn Lifecycle Operator contains several controllers for Keptn CRDs +and a Mutating Webhook. +The Keptn Scheduler ensures that Pods are started +only after the pre-deployment checks have finished successfully. + +A Kubernetes +[Manifest](https://monokle.io/learn/kubernetes-manifest-files-explained#:~:text=Kubernetes%20Manifest%20files!-,What%20is%20a%20Kubernetes%20Manifest%20File%3F,you%20want%20in%20your%20cluster). +which is annotated with Keptn specific annotations, +is applied to the Kubernetes Cluster. +Afterward, the Keptn Scheduler is injected (via Mutating Webhook), +and Kubernetes Events for Pre-Deployment are sent to the event stream. +The Event Controller watches for events +and triggers a Kubernetes Job to fullfil the Pre-Deployment. +After the Pre-Deployment has finished, +the Keptn Scheduler schedules the Pod to be deployed. +The KeptnApp and KeptnWorkload Controllers +watch for the workload resources to finish +and then generate a Post-Deployment Event. +After the Post-Deployment checks, +SLOs can be validated using an interface +for retrieving SLI data from a provider e.g, [Prometheus](https://prometheus.io/). -Finally, Keptn Lifecycle Toolkit exposes Metrics and Traces of the whole Deployment cycle -with [OpenTelemetry](https://opentelemetry.io/). +Finally, the Keptn Lifecycle Toolkit exposes Metrics and Traces +of the entire Deployment cycle with +[OpenTelemetry](https://opentelemetry.io/). ![KLT Architecture](./assets/architecture.png) -## How it works - -The following sections will provide insights on each component of the Keptn Lifecycle Toolkit in terms of their purpose, -responsibility, and communication with other components. -Furthermore, there will be a description on what CRD they monitor and a general overview of their fields. - ### Webhook Annotating a namespace subjects it to the effects of the mutating webhook: @@ -207,41 +156,46 @@ kind: Namespace metadata: name: podtato-kubectl annotations: - keptn.sh/lifecycle-toolkit: "enabled" # this lines tells the webhook to handle the namespace + keptn.sh/lifecycle-toolkit: "enabled" # this line tells the webhook to handle the namespace ``` -However, the mutating webhook will modify only resources in the annotated namespace that have Keptn annotations. -When the webhook receives a request for a new pod, it will look for the workload annotations: +The mutating webhook only modifies specifically annotated resources in the annotated namespace. +When the webhook receives a request for a new pod, +it looks for the workload annotations: ```yaml keptn.sh/workload: "some-workload-name" ``` -The mutation consists in changing the scheduler used for the deployment with the Keptn Scheduler. -Webhook then creates a -workload and app resource per annotated resource. +The mutation consists in changing the scheduler used for the deployment +with the Keptn Scheduler. +The webhook then creates a workload and app resource per annotated resource. You can also specify a custom app definition with the annotation: ```yaml keptn.sh/app: "your-app-name" ``` -In this case the webhook will not generate an app, but it will expect that the user will provide one. -The webhook should be as fast as possible and should not create/change any resource. -Additionally, it will compute a version string, using a hash function that takes certain properties of the pod as -parameters +In this case the webhook does not generate an app, +but it expects that the user will provide one. +Additionally, it computes a version string, +using a hash function that takes certain properties of the pod as parameters (e.g. the images of its containers). -Next, it will look for an existing instance of a `Workload CRD` for the given workload name: +Next, it looks for an existing instance of a `Workload CRD` +for the specified workload name: -- If it finds the `Workload`, it will update its version according to the previously computed version string. - In addition, it will include a reference to the ReplicaSet UID of the pod (i.e. the Pods owner), +- If it finds the `Workload`, + it updates its version according to the previously computed version string. + In addition, it includes a reference to the ReplicaSet UID of the pod + (i.e. the Pods owner), or the pod itself, if it does not have an owner. -- If it does not find a workload instance, it will create one containing the previously computed version string. - In addition, it will include a reference to the ReplicaSet UID of the pod (i.e. the Pods owner), or the pod itself, if - it does not have an owner. +- If it does not find a workload instance, + it creates one containing the previously computed version string. + In addition, it includes a reference to the ReplicaSet UID of the pod + (i.e. the Pods owner), or the pod itself, if it does not have an owner. -It will use the following annotations for -the specification of the pre/post deployment checks that should be executed for the `Workload`: +It uses the following annotations for the specification +of the pre/post deployment checks that should be executed for the `Workload`: - `keptn.sh/pre-deployment-tasks: task1,task2` - `keptn.sh/post-deployment-tasks: task1,task2` @@ -251,261 +205,22 @@ and for the Evaluations: - `keptn.sh/pre-deployment-evaluations: my-evaluation-definition` - `keptn.sh/post-deployment-evaluations: my-eval-definition` -After either one of those actions has been taken, the webhook will set the scheduler of the pod and allow the pod to be -scheduled. +After either one of those actions has been taken, +the webhook sets the scheduler of the pod +and allows the pod to be scheduled. ### Scheduler -After the Webhook mutation, the Keptn-Scheduler will handle the annotated resources. -The scheduling flow follows the -default scheduler behavior, -since it implements a scheduler plugin based on -the [scheduling framework]( https://kubernetes.io/docs/concepts/scheduling-eviction/scheduling-framework/). -For each pod, at the very end of the scheduling cycle, the plugin verifies whether the pre deployment checks have -terminated, by retrieving the current status of the WorkloadInstance. -Only if that is successful, the pod is bound to a -node. - -### KeptnApp - -An App contains information about all workloads and checks associated with an application. -It will use the following structure for the specification of the pre/post deployment and pre/post evaluations checks -that should be executed at app level: - -```yaml -apiVersion: lifecycle.keptn.sh/v1alpha3 -kind: KeptnApp -metadata: - name: podtato-head - namespace: podtato-kubectl -spec: - version: "1.3" - revision: 1 - workloads: - - name: podtato-head-left-arm - version: 0.1.0 - - name: podtato-head-left-leg - version: 1.2.3 - preDeploymentTasks: - - pre-deployment-hello - postDeploymentTasks: - - post-deployment-hello - preDeploymentEvaluations: - - my-prometheus-definition - postDeploymentEvaluations: - - my-prometheus-definition -``` - -While changes in the workload version will affect only workload checks, a change in the app version will also cause a -new execution of app level checks. - -### KeptnWorkload - -A Workload contains information about which tasks should be performed during the `preDeployment` as well as -the `postDeployment` -phase of a deployment. -In its state it keeps track of the currently active `Workload Instances`, which are responsible -for doing those checks for -a particular instance of a Deployment/StatefulSet/ReplicaSet (e.g. a Deployment of a certain version). - -### KeptnWorkloadInstance - -A Workload Instance is responsible for executing the pre- and post deployment checks of a workload. -In its state, it -keeps track of the current status of all checks, as well as the overall state of -the Pre Deployment phase, which can be used by the scheduler to tell that a pod can be allowed to be placed on a node. -Workload Instances have a reference to the respective Deployment/StatefulSet/ReplicaSet, to check if it has reached the -desired state. -If it detects that the referenced object has reached -its desired state (e.g. all pods of a deployment are up and running), it will be able to tell that -a `PostDeploymentCheck` can be triggered. - -### KeptnTaskDefinition - -A `KeptnTaskDefinition` is a CRD used to define tasks that can be run by the Keptn Lifecycle Toolkit -as part of pre- and post-deployment phases of a deployment. -`KeptnTaskDefinition` resource can be created in the namespace where the application is running, or -in the default KLT namespace, which will be the fallback option for the system to search. -The task definition is a [Deno](https://deno.land/) script -Please, refer to the [function runtime](./functions-runtime/) folder for more information about the runtime. -In the future, we also intend to support other runtimes, especially running a container image directly. - -A task definition can be configured in three different ways: - -- inline -- referring to an HTTP script -- referring to another `KeptnTaskDefinition` - -An inline KeptnTaskDefinition looks like the following: - -```yaml -apiVersion: lifecycle.keptn.sh/v1alpha3 -kind: KeptnTaskDefinition -metadata: - name: deployment-hello -spec: - function: - inline: - code: | - console.log("Deployment Task has been executed"); -``` - -In the code section, it is possible to define a full-fletched Deno script. -A further example, is available [here](./examples/taskonly-hello-keptn/inline/taskdefinition.yaml). - -To runtime can also fetch the script on the fly from a remote webserver. -For this, the CRD should look like the -following: - -```yaml -apiVersion: lifecycle.keptn.sh/v1alpha3 -kind: KeptnTaskDefinition -metadata: - name: hello-keptn-http -spec: - function: - httpRef: - url: -``` - -An example is available [here](./examples/taskonly-hello-keptn/http/taskdefinition.yaml). - -Finally, `KeptnTaskDefinition` can build on top of other `KeptnTaskDefinition`s. -This is a common use case where a general function can be re-used in multiple places with different parameters. - -```yaml -apiVersion: lifecycle.keptn.sh/v1alpha3 -kind: KeptnTaskDefinition -metadata: - name: slack-notification-dev -spec: - function: - functionRef: - name: slack-notification - parameters: - map: - textMessage: "This is my configuration" - secureParameters: - secret: slack-token -``` - -As you might have noticed, Task Definitions also have the possibility to use input parameters. -The Lifecycle Toolkit passes the values defined inside the `map` field as a JSON object. -At the moment, multi-level maps are not supported. -The JSON object can be read through the environment variable `DATA` using `Deno.env.get("DATA");`. -K8s secrets can also be passed to the function using the `secureParameters` field. -Here, the `secret` value is the K8s secret name that will be mounted into the runtime and made available to the function -via the environment variable `SECURE_DATA`. - -### KeptnTask - -A Task is responsible for executing the TaskDefinition of a workload. -The execution is done spawning a K8s Job to handle a single Task. -In its state, it keeps track of the current status of the K8s Job created. - -### KeptnEvaluationDefinition - -A `KeptnEvaluationDefinition` is a CRD used to define evaluation tasks that can be run by the Keptn Lifecycle Toolkit -as part of pre- and post-analysis phases of a workload or application. -`KeptnEvaluationDefinition` resource can be created in the namespace where the application is running, or -in the default KLT namespace, which will be the fallback option for the system to search. - -A KeptnEvaluationDefinition looks like the following: - -```yaml -apiVersion: lifecycle.keptn.sh/v1alpha3 -kind: KeptnEvaluationDefinition -metadata: - name: my-prometheus-evaluation -spec: - objectives: - - keptnMetricRef: - name: cpu - namespace: ns - evaluationTarget: <20 - - keptnMetricRef: - name: memory - namespace: ns - evaluationTarget: >4 -``` - -### KeptnMetricsProvider - -A `KeptnMetricsProvider` CRD defines the evaluation provider that provides data for the -pre- and post-analysis phases of a Keptn workload or Keptn application. - -A KeptnMetricsProvider definition looks like the following: - -```yaml -apiVersion: metrics.keptn.sh/v1alpha2 -kind: KeptnMetricsProvider -metadata: - name: prometheus -spec: - targetServer: "http://prometheus-k8s.monitoring.svc.cluster.local:9090" - secretKeyRef: - key: prometheusLoginCredentials -``` - -> **Note** -The KeptnMetricsProvider is a new resource in KLT 0.7.0. -The [migration documentation](https://lifecycle.keptn.sh/docs/tasks/migrate-keptnevaluationprovider/) -provides information about how to upgrade from 0.6.0 and earlier versions to 0.7.0. - -### KeptnMetric - -A `KeptnMetric` CRD defines the SLI provider with a query and stores metric data fetched from the provider. -Providing the metrics as CRD into a Kubernetes cluster makes this data reusable across multiple projects or workloads. -Furthermore, this allows using multiple observability platforms for different metrics. - -A KeptnMetric definition looks like the following: - -```yaml -apiVersion: metrics.keptn.sh/v1alpha2 -kind: KeptnMetric -metadata: - name: keptnmetric-sample - namespace: keptn-lifecycle-toolkit-system -spec: - provider: - name: "prometheus" - query: "sum(kube_pod_container_resource_limits{resource='cpu'})" - fetchIntervalSeconds: 5 -``` - -To use `KeptnMetric` as part of your evaluation, you must set the -`.spec.objectives[i].keptnMetricRef.name` and `.spec.objectives[i].keptnMetricRef.namespace` of -`KeptnEvaluationDefiniton` resource to the same value that is stored in `.metadata.name` and `metadata.namespace` -of the `KeptnMetric` resource. -Specifying the `.spec.objectives[i].keptnMetricRef.namespace` is optional. -If it's not specified, KLT searches for the `KeptnMetric` resource in the namespace where `KeptnEvaluationDefinition` -resource is stored. -If the `KeptnMetric` resource cannot be found there, it searches in the default KLT namespace (`keptn-lifecycle-toolkit-system`). - -> **Note** -Please be aware that, if - the `.spec.objectives[i].keptnMetricRef.namespace` of `KeptnEvaluationDefinition` -resource is specified and the `KeptnMetric` resource does not exist in this namespace, the evaluation fails. - -### Keptn Config - -The `KeptnConfig` is a CRD defines configuration values for the Keptn Lifecycle Toolkit. -Currently, it can be used to configure the URL of the OpenTelemetry collector. -Additionally, it can be used to set the time interval in which automatic app discovery -searches for workloads to put into the same auto-generated `KeptnApp`. -When the parameter is not set, the default value is 30 seconds. - -A `KeptnConfig` looks like the following: - -```yaml -apiVersion: options.keptn.sh/v1alpha1 -kind: KeptnConfig -metadata: - name: keptnconfig-sample -spec: - OTelCollectorUrl: 'otel-collector:4317' - keptnAppCreationRequestTimeoutSeconds: 30 -``` +After the Webhook mutation, the Keptn-Scheduler handles the annotated resources. +The scheduling flow follows the default +[scheduler](https://kubernetes.io/docs/concepts/scheduling-eviction/kube-scheduler/) +behavior, +since it implements a scheduler plugin based on the +[scheduling framework]( https://kubernetes.io/docs/concepts/scheduling-eviction/scheduling-framework/). +For each pod, at the very end of the scheduling cycle, +the plugin verifies that the pre deployment checks have terminated +by retrieving the current status of the WorkloadInstance. +Only when that is successful is the pod bound to a node. ## Install a dev build @@ -514,11 +229,12 @@ The [GitHub CLI](https://cli.github.com/) can be used to download the manifests ```bash gh run list --repo keptn/lifecycle-toolkit # find the id of a run gh run download 3152895000 --repo keptn/lifecycle-toolkit # download the artifacts -kubectl apply -f ./keptn-lifecycle-operator-manifest/release.yaml # install the operator +kubectl apply -f ./keptn-lifecycle-operator-manifest/release.yaml # install the lifecycle-operator kubectl apply -f ./scheduler-manifest/release.yaml # install the scheduler ``` -Instead, if you want to build and deploy the operator into your cluster directly from the code, you can type: +Instead, if you want to build and deploy the operator into your cluster +directly from the code, you can type: ```bash RELEASE_REGISTRY= @@ -527,7 +243,6 @@ RELEASE_REGISTRY= # Build and deploy the dev images to the current kubernetes cluster make build-deploy-dev-environment - ``` ## License diff --git a/codecov.yml b/codecov.yml index 435cf7f81c..1a146422fb 100644 --- a/codecov.yml +++ b/codecov.yml @@ -27,7 +27,7 @@ github_checks: flags: keptn-lifecycle-operator: paths: - - operator/ + - lifecycle-operator/ carryforward: true scheduler: paths: @@ -35,5 +35,5 @@ flags: carryforward: true component-tests: paths: - - operator/ + - lifecycle-operator/ carryforward: true diff --git a/docs/.htmltest.yml b/docs/.htmltest.yml index df24819fb8..675761922c 100644 --- a/docs/.htmltest.yml +++ b/docs/.htmltest.yml @@ -3,7 +3,6 @@ CheckDoctype: false IgnoreDirectoryMissingTrailingSlash: true IgnoreDirs: - favicons - - docs/crd-ref/lifecycle/ - community/ IgnoreURLs: - "linkedin.com" diff --git a/docs/content/en/docs/concepts/architecture/cert-manager.md b/docs/content/en/docs/concepts/architecture/cert-manager.md index d49a1940dc..95ccbc135c 100644 --- a/docs/content/en/docs/concepts/architecture/cert-manager.md +++ b/docs/content/en/docs/concepts/architecture/cert-manager.md @@ -9,6 +9,12 @@ hidechildren: false # this flag hides all sub-pages in the sidebar-multicard.htm ### Keptn Cert Manager +The Keptn Cert Manager automatically configures TLS certificates to +[secure communication with the Kubernetes API](https://kubernetes.io/docs/concepts/security/controlling-access/#transport-security). +You can instead +[configure your own certificate manager](https://lifecycle.keptn.sh/docs/install/cert-manager/) +for this purpose. + The Lifecycle Toolkit includes a Mutating Webhook that requires TLS certificates to be mounted as a volume in its pod. In version 0.6.0 and later, the certificate creation diff --git a/docs/content/en/docs/crd-ref/lifecycle/v1alpha1/_index.md b/docs/content/en/docs/crd-ref/lifecycle/v1alpha1/_index.md index 741a65ab8b..17ff572e0b 100644 --- a/docs/content/en/docs/crd-ref/lifecycle/v1alpha1/_index.md +++ b/docs/content/en/docs/crd-ref/lifecycle/v1alpha1/_index.md @@ -345,7 +345,7 @@ _Appears in:_ | `kind` _string_ | `KeptnEvaluationDefinition` | `metadata` _[ObjectMeta](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.24/#objectmeta-v1-meta)_ | Refer to Kubernetes API documentation for fields of `metadata`. | | `spec` _[KeptnEvaluationDefinitionSpec](#keptnevaluationdefinitionspec)_ | | -| `status` _[EmptyStatus](#emptystatus)_ | unused field | +| `status` _string_ | unused field | #### KeptnEvaluationDefinitionList @@ -410,7 +410,7 @@ _Appears in:_ | `kind` _string_ | `KeptnEvaluationProvider` | `metadata` _[ObjectMeta](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.24/#objectmeta-v1-meta)_ | Refer to Kubernetes API documentation for fields of `metadata`. | | `spec` _[KeptnEvaluationProviderSpec](#keptnevaluationproviderspec)_ | | -| `status` _[EmptyStatus](#emptystatus)_ | unused field | +| `status` _string_ | unused field | #### KeptnEvaluationProviderList diff --git a/docs/content/en/docs/crd-ref/lifecycle/v1alpha2/_index.md b/docs/content/en/docs/crd-ref/lifecycle/v1alpha2/_index.md index 4a74f59111..3a362a9c8d 100644 --- a/docs/content/en/docs/crd-ref/lifecycle/v1alpha2/_index.md +++ b/docs/content/en/docs/crd-ref/lifecycle/v1alpha2/_index.md @@ -347,7 +347,7 @@ _Appears in:_ | `kind` _string_ | `KeptnEvaluationDefinition` | `metadata` _[ObjectMeta](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.24/#objectmeta-v1-meta)_ | Refer to Kubernetes API documentation for fields of `metadata`. | | `spec` _[KeptnEvaluationDefinitionSpec](#keptnevaluationdefinitionspec)_ | | -| `status` _[EmptyStatus](#emptystatus)_ | unused field | +| `status` _string_ | unused field | #### KeptnEvaluationDefinitionList @@ -412,7 +412,7 @@ _Appears in:_ | `kind` _string_ | `KeptnEvaluationProvider` | `metadata` _[ObjectMeta](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.24/#objectmeta-v1-meta)_ | Refer to Kubernetes API documentation for fields of `metadata`. | | `spec` _[KeptnEvaluationProviderSpec](#keptnevaluationproviderspec)_ | | -| `status` _[EmptyStatus](#emptystatus)_ | unused field | +| `status` _string_ | unused field | #### KeptnEvaluationProviderList diff --git a/docs/content/en/docs/crd-ref/lifecycle/v1alpha3/_index.md b/docs/content/en/docs/crd-ref/lifecycle/v1alpha3/_index.md index b94f8bc7d8..8799f01744 100644 --- a/docs/content/en/docs/crd-ref/lifecycle/v1alpha3/_index.md +++ b/docs/content/en/docs/crd-ref/lifecycle/v1alpha3/_index.md @@ -209,7 +209,7 @@ _Appears in:_ | `kind` _string_ | `KeptnAppCreationRequest` | `metadata` _[ObjectMeta](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.24/#objectmeta-v1-meta)_ | Refer to Kubernetes API documentation for fields of `metadata`. | | `spec` _[KeptnAppCreationRequestSpec](#keptnappcreationrequestspec)_ | Spec describes the desired state of the KeptnAppCreationRequest. | -| `status` _[EmptyStatus](#emptystatus)_ | Status describes the current state of the KeptnAppCreationRequest. | +| `status` _string_ | Status describes the current state of the KeptnAppCreationRequest. | #### KeptnAppCreationRequestList @@ -411,7 +411,7 @@ _Appears in:_ | `kind` _string_ | `KeptnEvaluationDefinition` | `metadata` _[ObjectMeta](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.24/#objectmeta-v1-meta)_ | Refer to Kubernetes API documentation for fields of `metadata`. | | `spec` _[KeptnEvaluationDefinitionSpec](#keptnevaluationdefinitionspec)_ | Spec describes the desired state of the KeptnEvaluationDefinition. | -| `status` _[EmptyStatus](#emptystatus)_ | unused field | +| `status` _string_ | unused field | #### KeptnEvaluationDefinitionList @@ -475,7 +475,7 @@ _Appears in:_ | `kind` _string_ | `KeptnEvaluationProvider` | `metadata` _[ObjectMeta](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.24/#objectmeta-v1-meta)_ | Refer to Kubernetes API documentation for fields of `metadata`. | | `spec` _[KeptnEvaluationProviderSpec](#keptnevaluationproviderspec)_ | | -| `status` _[EmptyStatus](#emptystatus)_ | unused field | +| `status` _string_ | unused field | #### KeptnEvaluationProviderList diff --git a/docs/content/en/docs/crd-ref/metrics/v1alpha2/_index.md b/docs/content/en/docs/crd-ref/metrics/v1alpha2/_index.md index 8b4164e8b1..bd758cc8b4 100644 --- a/docs/content/en/docs/crd-ref/metrics/v1alpha2/_index.md +++ b/docs/content/en/docs/crd-ref/metrics/v1alpha2/_index.md @@ -20,8 +20,6 @@ Package v1alpha2 contains API Schema definitions for the metrics v1alpha2 API gr - - #### KeptnMetric @@ -103,7 +101,7 @@ _Appears in:_ | `kind` _string_ | `KeptnMetricsProvider` | `metadata` _[ObjectMeta](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.24/#objectmeta-v1-meta)_ | Refer to Kubernetes API documentation for fields of `metadata`. | | `spec` _[KeptnMetricsProviderSpec](#keptnmetricsproviderspec)_ | | -| `status` _[EmptyStatus](#emptystatus)_ | unused field | +| `status` _string_ | unused field | #### KeptnMetricsProviderList diff --git a/docs/content/en/docs/crd-ref/metrics/v1alpha3/_index.md b/docs/content/en/docs/crd-ref/metrics/v1alpha3/_index.md index 1764dd11ea..1732420d81 100644 --- a/docs/content/en/docs/crd-ref/metrics/v1alpha3/_index.md +++ b/docs/content/en/docs/crd-ref/metrics/v1alpha3/_index.md @@ -20,8 +20,6 @@ Package v1alpha3 contains API Schema definitions for the metrics v1alpha3 API gr - - #### KeptnMetric @@ -105,7 +103,7 @@ _Appears in:_ | `kind` _string_ | `KeptnMetricsProvider` | `metadata` _[ObjectMeta](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.24/#objectmeta-v1-meta)_ | Refer to Kubernetes API documentation for fields of `metadata`. | | `spec` _[KeptnMetricsProviderSpec](#keptnmetricsproviderspec)_ | | -| `status` _[EmptyStatus](#emptystatus)_ | unused field | +| `status` _string_ | unused field | #### KeptnMetricsProviderList @@ -167,5 +165,6 @@ _Appears in:_ | --- | --- | | `interval` _string_ | Interval specifies the duration of the time interval for the data query | | `step` _string_ | Step represents the query resolution step width for the data query | +| `aggregation` _string_ | Aggregation defines as the type of aggregation function to be applied on the data. Accepted values: p90, p95, p99, max, min, avg, median | diff --git a/docs/content/en/docs/crd-ref/options/v1alpha1/_index.md b/docs/content/en/docs/crd-ref/options/v1alpha1/_index.md index c48666c1ea..d3d3bf9661 100644 --- a/docs/content/en/docs/crd-ref/options/v1alpha1/_index.md +++ b/docs/content/en/docs/crd-ref/options/v1alpha1/_index.md @@ -18,8 +18,6 @@ Package v1alpha1 contains API Schema definitions for the options v1alpha1 API gr - - #### KeptnConfig @@ -35,7 +33,7 @@ _Appears in:_ | `kind` _string_ | `KeptnConfig` | `metadata` _[ObjectMeta](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.24/#objectmeta-v1-meta)_ | Refer to Kubernetes API documentation for fields of `metadata`. | | `spec` _[KeptnConfigSpec](#keptnconfigspec)_ | | -| `status` _[EmptyStatus](#emptystatus)_ | unused field | +| `status` _string_ | unused field | #### KeptnConfigList @@ -65,7 +63,7 @@ _Appears in:_ | Field | Description | | --- | --- | -| `OTelCollectorUrl` _string_ | OTelCollectorUrl can be used to set the Open Telemetry collector that the operator should use | +| `OTelCollectorUrl` _string_ | OTelCollectorUrl can be used to set the Open Telemetry collector that the lifecycle operator should use | | `keptnAppCreationRequestTimeoutSeconds` _integer_ | KeptnAppCreationRequestTimeoutSeconds is used to set the interval in which automatic app discovery searches for workload to put into the same auto-generated KeptnApp | diff --git a/docs/content/en/docs/implementing/integrate/_index.md b/docs/content/en/docs/implementing/integrate/_index.md index 8cec841530..a51a859aed 100644 --- a/docs/content/en/docs/implementing/integrate/_index.md +++ b/docs/content/en/docs/implementing/integrate/_index.md @@ -227,6 +227,38 @@ keptn.sh/post-deployment-evaluations: <`EvaluationDefinition`-name> keptn.sh/post-deployment-tasks: <`TaskDefinition`-name> ``` +The value of these annotations corresponds to the name of +Keptn [resources](https://kubernetes.io/docs/concepts/extend-kubernetes/api-extension/custom-resources/) +called +[KeptnTaskDefinition](../../yaml-crd-ref/taskdefinition.md)s. +These resources contain re-usable "functions" +that can execute before and after the deployment. +For example, before the deployment starts, +you might perform a check for open problems in your infrastructure. +If everything is fine, the deployment continues and afterward, +a slack notification can be sent with the result of the deployment +and a pipeline to run performance tests can be invoked. +Otherwise, the deployment is kept in a pending state +until the infrastructure is capable of accepting deployments again. + +A comprehensive example can be found in our +[examples folder](https://github.com/keptn/lifecycle-toolkit/tree/main/examples/sample-app), +where we use [Podtato-Head](https://github.com/podtato-head/podtato-head) +to run some simple pre-deployment checks. + +To run the example, use the following commands: + +```shell +cd ./examples/podtatohead-deployment/ +kubectl apply -f . +``` + +Afterward, you can monitor the status of the deployment using + +```shell +kubectl get keptnworkloadinstance -n podtato-kubectl -w +``` + ## Use Keptn automatic app discovery The automatically generated `KeptnApp` file diff --git a/docs/content/en/docs/install/reqs.md b/docs/content/en/docs/install/reqs.md index 8f735090ba..9dad0c7850 100644 --- a/docs/content/en/docs/install/reqs.md +++ b/docs/content/en/docs/install/reqs.md @@ -24,6 +24,9 @@ Kustomize Version: v4.5.4 Server Version: v1.24.0 ``` +KLT is not currently compatible with +[vcluster](). + ## Resource requirements ## cert-manager diff --git a/docs/content/en/docs/migrate/_index.md b/docs/content/en/docs/migrate/_index.md index f6cab197cf..b308ac16e7 100644 --- a/docs/content/en/docs/migrate/_index.md +++ b/docs/content/en/docs/migrate/_index.md @@ -1,7 +1,7 @@ --- title: Migrating to the Keptn Lifecycle Toolkit description: Notes to help you migrate from Keptn v1 to KLT -weight: 20 +weight: 80 hidechildren: false # this flag hides all sub-pages in the sidebar-multicard.html --- @@ -26,31 +26,19 @@ without implementing all KLT features. This section currently includes the following topics: -* [Evolution of KLT](evolution-klt) - Understand the paradigm of KLT and how it evolved from Keptn v1. - Also see whether migrating to KLT is appropriate for your deployments - * [Migration strategy](strategy) -- Overview of the recommended migration strategy -* [Set up Kubernetes cluster with a deployment engine](setup) -- - Begin with a Kubernetes cluster with a deployment engine - that deploys your software. - This can be a new installation or an existing installation - that meets the requirements for KLT. - -* [Install and integrate KLT into your cluster](install-integrate] - * [Set up metrics and observability](metrics-observe) -- When you identify the data-sources being used and provide KLT with information about your OpenTelemetry collector, KLT begins to accumulate information that you can view for your deployment. -* [Migrate CI/CD functionality](cicd) - * [Migrate Quality Gates to Keptn Evaluations](evaluations) +* [Migrate CI/CD functionality](cicd) + * [Migrate JES services to Keptn Tasks](jes) * [Migrate remediation services to Day 2 monitoring](day2) diff --git a/docs/content/en/docs/migrate/cicd/_index.md b/docs/content/en/docs/migrate/cicd/_index.md index b609bb272d..eb02b323d3 100644 --- a/docs/content/en/docs/migrate/cicd/_index.md +++ b/docs/content/en/docs/migrate/cicd/_index.md @@ -1,7 +1,7 @@ --- title: Migrate CI/CD functionality to KLT description: Translate Keptn v1 CI/CD funtionality to KLT resources -weight: 50 +weight: 60 hidechildren: false # this flag hides all sub-pages in the sidebar-multicard.html --- diff --git a/docs/content/en/docs/migrate/evaluations/_index.md b/docs/content/en/docs/migrate/evaluations/_index.md index fa04e1e668..210f8358d5 100644 --- a/docs/content/en/docs/migrate/evaluations/_index.md +++ b/docs/content/en/docs/migrate/evaluations/_index.md @@ -1,7 +1,7 @@ --- title: Migrate Quality Gates to Keptn Evaluations description: How to define Keptn Evaluations for some Quality Gates checks -weight: 60 +weight: 50 hidechildren: false # this flag hides all sub-pages in the sidebar-multicard.html --- diff --git a/docs/content/en/docs/migrate/evolution-klt/_index.md b/docs/content/en/docs/migrate/evolution-klt/_index.md deleted file mode 100644 index 49bb7ac671..0000000000 --- a/docs/content/en/docs/migrate/evolution-klt/_index.md +++ /dev/null @@ -1,9 +0,0 @@ ---- -title: Evolution of KLT -description: Understand the paradigm of KLT, how it evolved from Keptn v1, and whether you should migrate to KLT -weight: 5 -hidechildren: false # this flag hides all sub-pages in the sidebar-multicard.html ---- - -The Keptn project provides tool-agnostic ways -to manage and observe software deployment. diff --git a/docs/content/en/docs/migrate/install/_index.md b/docs/content/en/docs/migrate/install/_index.md deleted file mode 100644 index d973df4b66..0000000000 --- a/docs/content/en/docs/migrate/install/_index.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -title: Install and integrate KLT into your cluster -description: How to add KLT to your cluster -weight: 30 -hidechildren: false # this flag hides all sub-pages in the sidebar-multicard.html ---- - -> **Note** -This section is under development. -Information that is published here has been reviewed for technical accuracy -but the format and content is still evolving. -We hope you will contribute your experiences -and questions that you have. diff --git a/docs/content/en/docs/migrate/setup/_index.md b/docs/content/en/docs/migrate/setup/_index.md deleted file mode 100644 index 1e1da26587..0000000000 --- a/docs/content/en/docs/migrate/setup/_index.md +++ /dev/null @@ -1,16 +0,0 @@ ---- -title: Set up Kubernetes deployment environment -description: Set up Kubernetes cluster with a deployment engine for your software -weight: 20 -hidechildren: false # this flag hides all sub-pages in the sidebar-multicard.html ---- - -> **Note** -This section is under development. -Information that is published here has been reviewed for technical accuracy -but the format and content is still evolving. -We hope you will contribute your experiences -and questions that you have. - -No two migrations are alike but these are some general guidelines -for how to approach the project: diff --git a/docs/content/en/docs/yaml-crd-ref/app.md b/docs/content/en/docs/yaml-crd-ref/app.md index 3e00088579..3e653b01bc 100644 --- a/docs/content/en/docs/yaml-crd-ref/app.md +++ b/docs/content/en/docs/yaml-crd-ref/app.md @@ -4,8 +4,8 @@ description: Define all workloads and checks associated with an application weight: 10 --- -`KeptnApp` defines a list of workloads -that together constitute a logical application. +A `KeptnApp` resource lists all the workloads +that constitute a logical application. It contains information about: - All workloads and checks diff --git a/docs/content/en/docs/yaml-crd-ref/taskdefinition.md b/docs/content/en/docs/yaml-crd-ref/taskdefinition.md index 38db4f2c26..95fbfc003f 100644 --- a/docs/content/en/docs/yaml-crd-ref/taskdefinition.md +++ b/docs/content/en/docs/yaml-crd-ref/taskdefinition.md @@ -574,7 +574,7 @@ then spawns a shell and runs the `sleep 30` command. You can embed python code directly in the task definition. This example prints data stored in the parameters map: -{{< embed path="/operator/config/samples/python_execution/taskdefinition_pyfunction_inline.yaml" >}} +{{< embed path="/lifecycle-operator/config/samples/python_execution/taskdefinition_pyfunction_inline.yaml" >}} ### Example 2: httpRef for a python-runtime runner @@ -584,25 +584,25 @@ For example, we have a few examples available in the tree. Consider the following: -{{< embed path="/operator/config/samples/python_execution/taskdefinition_pyfunction_configmap.yaml" >}} +{{< embed path="/lifecycle-operator/config/samples/python_execution/taskdefinition_pyfunction_configmap.yaml" >}} ### Example 3: functionRef for a python-runtime runner You can refer to an existing `KeptnTaskDefinition`. This example calls the inline example but overrides the data printed with what is specified in the task: -{{< embed path="/operator/config/samples/python_execution/taskdefinition_pyfunction_recursive.yaml" >}} +{{< embed path="/lifecycle-operator/config/samples/python_execution/taskdefinition_pyfunction_recursive.yaml" >}} ### Example 4: ConfigMapRef for a python-runtime runner -{{< embed path="/operator/config/samples/python_execution/taskdefinition_pyfunction_configmap.yaml" >}} +{{< embed path="/lifecycle-operator/config/samples/python_execution/taskdefinition_pyfunction_configmap.yaml" >}} ### Allowed libraries for the python-runtime runner The following example shows how to use some of the allowed packages, namely: requests, json, git, and yaml: -{{< embed path="/operator/config/samples/python_execution/taskdefinition_pyfunction_inline_printargs_py.yaml">}} +{{< embed path="/lifecycle-operator/config/samples/python_execution/taskdefinition_pyfunction_inline_printargs_py.yaml">}} ### Passing secrets, environment variables and modifying the python command @@ -612,11 +612,11 @@ and how to modify the python command. In this case the container runs with the `-h` option, which prints the help message for the python3 interpreter: -{{< embed path="/operator/config/samples/python_execution/taskdefinition_pyfunction_use_envvars.yaml" >}} +{{< embed path="/lifecycle-operator/config/samples/python_execution/taskdefinition_pyfunction_use_envvars.yaml" >}} ## More examples -See the [operator/config/samples](https://github.com/keptn/lifecycle-toolkit/tree/main/operator/config/samples/function_execution) +See the [lifecycle-operator/config/samples](https://github.com/keptn/lifecycle-toolkit/tree/main/lifecycle-operator/config/samples/function_execution) directory for more example `KeptnTaskDefinition` YAML files. ## Files diff --git a/examples/support/argo/Makefile b/examples/support/argo/Makefile index 5c503fdbd7..dcb0826526 100644 --- a/examples/support/argo/Makefile +++ b/examples/support/argo/Makefile @@ -2,7 +2,7 @@ LFC_NAMESPACE ?= keptn-lifecycle-toolkit-system PODTATO_NAMESPACE ?= podtato-kubectl ARGO_NAMESPACE ?= argocd # renovate: datasource=github-tags depName=argoproj/argo-cd -ARGO_VERSION ?= v2.7.8 +ARGO_VERSION ?= v2.7.10 ARGO_SECRET = $(shell kubectl -n ${ARGO_NAMESPACE} get secret argocd-initial-admin-secret -o jsonpath="{.data.password}" | base64 -d; echo) .PHONY: install diff --git a/examples/support/observability/README.md b/examples/support/observability/README.md index 14c4ca88eb..7dc9a1646d 100644 --- a/examples/support/observability/README.md +++ b/examples/support/observability/README.md @@ -1,7 +1,7 @@ # Sending Traces and Metrics to the OpenTelemetry Collector In this example, we will show you an example configuration -for enabling the operator to send OpenTelemetry traces and metrics to the +for enabling the lifecycle-operator to send OpenTelemetry traces and metrics to the [OpenTelemetry Collector](https://github.com/open-telemetry/opentelemetry-collector). The Collector will then be used to forward the gathered data to [Jaeger](https://www.jaegertracing.io) diff --git a/helm/chart/README.md b/helm/chart/README.md index b55dca395a..80c105f664 100644 --- a/helm/chart/README.md +++ b/helm/chart/README.md @@ -35,7 +35,7 @@ checks | `certificateOperator.tolerations` | customize tolerations for cert manager | `[]` | | `certificateOperator.topologySpreadConstraints` | add topology constraints for cert manager | `[]` | | `lifecycleManagerConfig.controllerManagerConfigYaml.health.healthProbeBindAddress` | setup on what address to start the default health handler | `:8081` | -| `lifecycleManagerConfig.controllerManagerConfigYaml.leaderElection.leaderElect` | enable leader election for multiple replicas of the operator | `true` | +| `lifecycleManagerConfig.controllerManagerConfigYaml.leaderElection.leaderElect` | enable leader election for multiple replicas of the lifecycle operator | `true` | | `lifecycleManagerConfig.controllerManagerConfigYaml.leaderElection.resourceName` | define LeaderElectionID | `6b866dd9.keptn.sh` | | `lifecycleManagerConfig.controllerManagerConfigYaml.metrics.bindAddress` | MetricsBindAddress is the TCP address that the controller should bind to for serving prometheus metrics. It can be set to "0" to disable the metrics serving. | `127.0.0.1:8080` | | `lifecycleManagerConfig.controllerManagerConfigYaml.webhook.port` | setup port for the lifecycle operator admission webhook | `9443` | @@ -136,23 +136,23 @@ checks ### Keptn Metrics Operator controller -| Name | Description | Value | -| --------------------------------------------------------------------------- | ------------------------------------------------------------- | -------------------------------- | -| `metricsOperator.manager.containerSecurityContext` | Sets security context privileges | | -| `metricsOperator.manager.containerSecurityContext.allowPrivilegeEscalation` | | `false` | -| `metricsOperator.manager.containerSecurityContext.capabilities.drop` | | `["ALL"]` | -| `metricsOperator.manager.containerSecurityContext.privileged` | | `false` | -| `metricsOperator.manager.containerSecurityContext.runAsGroup` | | `65532` | -| `metricsOperator.manager.containerSecurityContext.runAsNonRoot` | | `true` | -| `metricsOperator.manager.containerSecurityContext.runAsUser` | | `65532` | -| `metricsOperator.manager.containerSecurityContext.seccompProfile.type` | | `RuntimeDefault` | -| `metricsOperator.manager.image.repository` | specify registry for manager image | `ghcr.io/keptn/metrics-operator` | -| `metricsOperator.manager.image.tag` | select tag for manager image | `v0.8.1` | -| `metricsOperator.manager.env.exposeKeptnMetrics` | enable metrics exporter | `true` | -| `metricsOperator.manager.env.metricsControllerLogLevel` | sets the log level of Metrics Controller | `0` | -| `metricsOperator.manager.livenessProbe` | custom livenessprobe for manager container | | -| `metricsOperator.manager.readinessProbe` | custom readinessprobe for manager container | | -| `metricsOperator.manager.resources` | specify limits and requests for manager container | | +| Name | Description | Value | +| --------------------------------------------------------------------------- | ------------------------------------------------- | -------------------------------- | +| `metricsOperator.manager.containerSecurityContext` | Sets security context privileges | | +| `metricsOperator.manager.containerSecurityContext.allowPrivilegeEscalation` | | `false` | +| `metricsOperator.manager.containerSecurityContext.capabilities.drop` | | `["ALL"]` | +| `metricsOperator.manager.containerSecurityContext.privileged` | | `false` | +| `metricsOperator.manager.containerSecurityContext.runAsGroup` | | `65532` | +| `metricsOperator.manager.containerSecurityContext.runAsNonRoot` | | `true` | +| `metricsOperator.manager.containerSecurityContext.runAsUser` | | `65532` | +| `metricsOperator.manager.containerSecurityContext.seccompProfile.type` | | `RuntimeDefault` | +| `metricsOperator.manager.image.repository` | specify registry for manager image | `ghcr.io/keptn/metrics-operator` | +| `metricsOperator.manager.image.tag` | select tag for manager image | `v0.8.1` | +| `metricsOperator.manager.env.exposeKeptnMetrics` | enable metrics exporter | `true` | +| `metricsOperator.manager.env.metricsControllerLogLevel` | sets the log level of Metrics Controller | `0` | +| `metricsOperator.manager.livenessProbe` | custom livenessprobe for manager container | | +| `metricsOperator.manager.readinessProbe` | custom readinessprobe for manager container | | +| `metricsOperator.manager.resources` | specify limits and requests for manager container | | ### Global diff --git a/helm/chart/doc.yaml b/helm/chart/doc.yaml index 0b5f7e67f7..bdef4ff48c 100644 --- a/helm/chart/doc.yaml +++ b/helm/chart/doc.yaml @@ -50,7 +50,7 @@ ## @param certificateOperator.topologySpreadConstraints add topology constraints for cert manager ## @param lifecycleManagerConfig.controllerManagerConfigYaml.health.healthProbeBindAddress setup on what address to start the default health handler -## @param lifecycleManagerConfig.controllerManagerConfigYaml.leaderElection.leaderElect enable leader election for multiple replicas of the operator +## @param lifecycleManagerConfig.controllerManagerConfigYaml.leaderElection.leaderElect enable leader election for multiple replicas of the lifecycle operator ## @param lifecycleManagerConfig.controllerManagerConfigYaml.leaderElection.resourceName define LeaderElectionID ## @param lifecycleManagerConfig.controllerManagerConfigYaml.metrics.bindAddress MetricsBindAddress is the TCP address that the controller should bind to for serving prometheus metrics. It can be set to "0" to disable the metrics serving. ## @param lifecycleManagerConfig.controllerManagerConfigYaml.webhook.port setup port for the lifecycle operator admission webhook @@ -206,7 +206,7 @@ ## @param metricsOperator.manager.image.repository specify registry for manager image -## @param metricsOperator.manager.image.tag select tag for manager image +## @param metricsOperator.manager.image.tag select tag for manager image ## @param metricsOperator.manager.env.exposeKeptnMetrics enable metrics exporter ## @param metricsOperator.manager.env.metricsControllerLogLevel sets the log level of Metrics Controller diff --git a/helm/overlay/kustomization.yaml b/helm/overlay/kustomization.yaml index 6869e10aac..229394fa72 100644 --- a/helm/overlay/kustomization.yaml +++ b/helm/overlay/kustomization.yaml @@ -2,7 +2,7 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization # import the default deployment as the base resources: - - ../../operator/config/default + - ../../lifecycle-operator/config/default - ../../klt-cert-manager/config/default - ../../metrics-operator/config/default - ../../scheduler/manifests/install diff --git a/kuttl-test-local.yaml b/kuttl-test-local.yaml index a4301f8bed..7644d88df6 100644 --- a/kuttl-test-local.yaml +++ b/kuttl-test-local.yaml @@ -1,6 +1,6 @@ apiVersion: kuttl.dev/v1 kind: TestSuite -crdDir: ./operator/config/crd/bases +crdDir: ./lifecycle-operator/config/crd/bases testDirs: - ./test/integration/ timeout: 300 diff --git a/kuttl-test.yaml b/kuttl-test.yaml index 2149e1d4fc..f0d6cfa7c0 100644 --- a/kuttl-test.yaml +++ b/kuttl-test.yaml @@ -1,6 +1,6 @@ apiVersion: kuttl.dev/v1 kind: TestSuite -crdDir: ./operator/config/crd/bases +crdDir: ./lifecycle-operator/config/crd/bases testDirs: - ./test/integration/ timeout: 400 diff --git a/operator/.dockerignore b/lifecycle-operator/.dockerignore similarity index 100% rename from operator/.dockerignore rename to lifecycle-operator/.dockerignore diff --git a/operator/.gitignore b/lifecycle-operator/.gitignore similarity index 100% rename from operator/.gitignore rename to lifecycle-operator/.gitignore diff --git a/operator/Dockerfile b/lifecycle-operator/Dockerfile similarity index 100% rename from operator/Dockerfile rename to lifecycle-operator/Dockerfile diff --git a/operator/Makefile b/lifecycle-operator/Makefile similarity index 95% rename from operator/Makefile rename to lifecycle-operator/Makefile index 56c079c354..7ecb1a33aa 100644 --- a/operator/Makefile +++ b/lifecycle-operator/Makefile @@ -98,14 +98,14 @@ test: manifests fmt vet generate envtest ## Run tests. .PHONY: component-test component-test: manifests generate envtest ## Run tests. - KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) -p path)" go test ./test/component/app/... -v -timeout 30m -coverprofile cover-app.out -coverpkg "github.com/keptn/lifecycle-toolkit/operator/controllers/lifecycle/keptnapp/..." - KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) -p path)" go test ./test/component/appversion/... -v -timeout 30m -coverprofile cover-appversion.out -coverpkg "github.com/keptn/lifecycle-toolkit/operator/controllers/lifecycle/keptnappversion/..." - KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) -p path)" go test ./test/component/evaluation/... -v -timeout 30m -coverprofile cover-evaluation.out -coverpkg "github.com/keptn/lifecycle-toolkit/operator/controllers/lifecycle/keptnevaluation/..." + KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) -p path)" go test ./test/component/app/... -v -timeout 30m -coverprofile cover-app.out -coverpkg "github.com/keptn/lifecycle-toolkit/lifecycle-operator/controllers/lifecycle/keptnapp/..." + KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) -p path)" go test ./test/component/appversion/... -v -timeout 30m -coverprofile cover-appversion.out -coverpkg "github.com/keptn/lifecycle-toolkit/lifecycle-operator/controllers/lifecycle/keptnappversion/..." + KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) -p path)" go test ./test/component/evaluation/... -v -timeout 30m -coverprofile cover-evaluation.out -coverpkg "github.com/keptn/lifecycle-toolkit/lifecycle-operator/controllers/lifecycle/keptnevaluation/..." KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) -p path)" go test ./test/component/load/... -v -timeout 30m - KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) -p path)" go test ./test/component/task/... -v -timeout 30m -coverprofile cover-task.out -coverpkg "github.com/keptn/lifecycle-toolkit/operator/controllers/lifecycle/keptntask/..." - KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) -p path)" go test ./test/component/taskdefinition/... -v -timeout 30m -coverprofile cover-taskdefinition.out -coverpkg "github.com/keptn/lifecycle-toolkit/operator/controllers/lifecycle/keptntaskdefinition/..." - KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) -p path)" go test ./test/component/workload/... -v -timeout 30m -coverprofile cover-workload.out -coverpkg "github.com/keptn/lifecycle-toolkit/operator/controllers/lifecycle/keptnworkload/..." - KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) -p path)" go test ./test/component/workloadinstance/... -v -timeout 30m -coverprofile cover-workloadinstance.out -coverpkg "github.com/keptn/lifecycle-toolkit/operator/controllers/lifecycle/keptnworkloadinstance/..." + KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) -p path)" go test ./test/component/task/... -v -timeout 30m -coverprofile cover-task.out -coverpkg "github.com/keptn/lifecycle-toolkit/lifecycle-operator/controllers/lifecycle/keptntask/..." + KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) -p path)" go test ./test/component/taskdefinition/... -v -timeout 30m -coverprofile cover-taskdefinition.out -coverpkg "github.com/keptn/lifecycle-toolkit/lifecycle-operator/controllers/lifecycle/keptntaskdefinition/..." + KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) -p path)" go test ./test/component/workload/... -v -timeout 30m -coverprofile cover-workload.out -coverpkg "github.com/keptn/lifecycle-toolkit/lifecycle-operator/controllers/lifecycle/keptnworkload/..." + KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) -p path)" go test ./test/component/workloadinstance/... -v -timeout 30m -coverprofile cover-workloadinstance.out -coverpkg "github.com/keptn/lifecycle-toolkit/lifecycle-operator/controllers/lifecycle/keptnworkloadinstance/..." sed -i '/mode: set/d' "cover-app.out" sed -i '/mode: set/d' "cover-appversion.out" sed -i '/mode: set/d' "cover-evaluation.out" diff --git a/operator/PROJECT b/lifecycle-operator/PROJECT similarity index 63% rename from operator/PROJECT rename to lifecycle-operator/PROJECT index 8c88afe3d8..4eff914800 100644 --- a/operator/PROJECT +++ b/lifecycle-operator/PROJECT @@ -3,7 +3,7 @@ layout: - go.kubebuilder.io/v3 multigroup: true projectName: keptn-lifecycle-toolkit -repo: github.com/keptn/lifecycle-toolkit/operator +repo: github.com/keptn/lifecycle-toolkit/lifecycle-operator resources: - api: crdVersion: v1 @@ -12,7 +12,7 @@ resources: domain: keptn.sh group: lifecycle kind: KeptnTaskDefinition - path: github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha1 + path: github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha1 version: v1alpha1 - api: crdVersion: v1 @@ -21,7 +21,7 @@ resources: domain: keptn.sh group: lifecycle kind: KeptnTask - path: github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha1 + path: github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha1 version: v1alpha1 - api: crdVersion: v1 @@ -30,7 +30,7 @@ resources: domain: keptn.sh group: lifecycle kind: KeptnApp - path: github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha1 + path: github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha1 version: v1alpha1 - api: crdVersion: v1 @@ -39,7 +39,7 @@ resources: domain: keptn.sh group: lifecycle kind: KeptnWorkload - path: github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha1 + path: github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha1 version: v1alpha1 - api: crdVersion: v1 @@ -48,7 +48,7 @@ resources: domain: keptn.sh group: lifecycle kind: KeptnWorkloadInstance - path: github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha1 + path: github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha1 version: v1alpha1 - api: crdVersion: v1 @@ -57,7 +57,7 @@ resources: domain: keptn.sh group: lifecycle kind: KeptnAppVersion - path: github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha1 + path: github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha1 version: v1alpha1 - api: crdVersion: v1 @@ -66,7 +66,7 @@ resources: domain: keptn.sh group: lifecycle kind: KeptnEvaluationDefinition - path: github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha1 + path: github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha1 version: v1alpha1 - api: crdVersion: v1 @@ -74,7 +74,7 @@ resources: domain: keptn.sh group: lifecycle kind: KeptnEvaluationProvider - path: github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha1 + path: github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha1 version: v1alpha1 - api: crdVersion: v1 @@ -83,7 +83,7 @@ resources: domain: keptn.sh group: lifecycle kind: KeptnEvaluation - path: github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha1 + path: github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha1 version: v1alpha1 - api: crdVersion: v1 @@ -92,7 +92,7 @@ resources: domain: keptn.sh group: lifecycle kind: KeptnTaskDefinition - path: github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha2 + path: github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha2 version: v1alpha2 - api: crdVersion: v1 @@ -101,7 +101,7 @@ resources: domain: keptn.sh group: lifecycle kind: KeptnTask - path: github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha2 + path: github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha2 version: v1alpha2 - api: crdVersion: v1 @@ -110,7 +110,7 @@ resources: domain: keptn.sh group: lifecycle kind: KeptnApp - path: github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha2 + path: github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha2 version: v1alpha2 webhooks: conversion: true @@ -122,7 +122,7 @@ resources: domain: keptn.sh group: lifecycle kind: KeptnWorkload - path: github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha2 + path: github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha2 version: v1alpha2 - api: crdVersion: v1 @@ -131,7 +131,7 @@ resources: domain: keptn.sh group: lifecycle kind: KeptnWorkloadInstance - path: github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha2 + path: github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha2 version: v1alpha2 webhooks: conversion: true @@ -143,7 +143,7 @@ resources: domain: keptn.sh group: lifecycle kind: KeptnAppVersion - path: github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha2 + path: github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha2 version: v1alpha2 webhooks: conversion: true @@ -155,7 +155,7 @@ resources: domain: keptn.sh group: lifecycle kind: KeptnEvaluationDefinition - path: github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha2 + path: github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha2 version: v1alpha2 - api: crdVersion: v1 @@ -163,7 +163,7 @@ resources: domain: keptn.sh group: lifecycle kind: KeptnEvaluationProvider - path: github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha2 + path: github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha2 version: v1alpha2 webhooks: conversion: true @@ -175,7 +175,7 @@ resources: domain: keptn.sh group: lifecycle kind: KeptnEvaluation - path: github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha2 + path: github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha2 version: v1alpha2 - api: crdVersion: v1 @@ -184,7 +184,7 @@ resources: domain: keptn.sh group: options kind: KeptnConfig - path: github.com/keptn/lifecycle-toolkit/operator/apis/options/v1alpha1 + path: github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/options/v1alpha1 version: v1alpha1 - api: crdVersion: v1 @@ -192,7 +192,7 @@ resources: domain: keptn.sh group: lifecycle kind: KeptnApp - path: github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3 + path: github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3 version: v1alpha3 - api: crdVersion: v1 @@ -200,7 +200,7 @@ resources: domain: keptn.sh group: lifecycle kind: KeptnAppVersion - path: github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3 + path: github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3 version: v1alpha3 - api: crdVersion: v1 @@ -208,7 +208,7 @@ resources: domain: keptn.sh group: lifecycle kind: KeptnEvaluation - path: github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3 + path: github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3 version: v1alpha3 - api: crdVersion: v1 @@ -216,7 +216,7 @@ resources: domain: keptn.sh group: lifecycle kind: KeptnEvaluationDefinition - path: github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3 + path: github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3 version: v1alpha3 - api: crdVersion: v1 @@ -224,7 +224,7 @@ resources: domain: keptn.sh group: lifecycle kind: KeptnTask - path: github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3 + path: github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3 version: v1alpha3 - api: crdVersion: v1 @@ -232,7 +232,7 @@ resources: domain: keptn.sh group: lifecycle kind: KeptnTaskDefinition - path: github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3 + path: github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3 version: v1alpha3 webhooks: validation: true @@ -243,7 +243,7 @@ resources: domain: keptn.sh group: lifecycle kind: KeptnWorkload - path: github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3 + path: github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3 version: v1alpha3 - api: crdVersion: v1 @@ -251,7 +251,7 @@ resources: domain: keptn.sh group: lifecycle kind: KeptnWorkloadInstance - path: github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3 + path: github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3 version: v1alpha3 - api: crdVersion: v1 @@ -259,7 +259,7 @@ resources: domain: keptn.sh group: lifecycle kind: KeptnEvaluationProvider - path: github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3 + path: github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3 version: v1alpha3 - api: crdVersion: v1 @@ -268,6 +268,6 @@ resources: domain: keptn.sh group: lifecycle kind: KeptnAppCreationRequest - path: github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3 + path: github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3 version: v1alpha3 version: "3" diff --git a/operator/README.md b/lifecycle-operator/README.md similarity index 100% rename from operator/README.md rename to lifecycle-operator/README.md diff --git a/operator/apis/lifecycle/v1alpha1/common/common.go b/lifecycle-operator/apis/lifecycle/v1alpha1/common/common.go similarity index 99% rename from operator/apis/lifecycle/v1alpha1/common/common.go rename to lifecycle-operator/apis/lifecycle/v1alpha1/common/common.go index 512d454568..b714e7b71a 100644 --- a/operator/apis/lifecycle/v1alpha1/common/common.go +++ b/lifecycle-operator/apis/lifecycle/v1alpha1/common/common.go @@ -37,8 +37,6 @@ var ErrCannotCastKeptnAppVersion = errors.New("cannot cast KeptnAppVersion to v1 var ErrCannotCastKeptnApp = errors.New("cannot cast KeptnApp to v1alpha3") var ErrCannotCastKeptnWorkloadInstance = errors.New("cannot cast KeptnWorkloadInstance to v1alpha3") -type EmptyStatus struct{} - type KeptnState string const ( diff --git a/operator/apis/lifecycle/v1alpha1/common/common_test.go b/lifecycle-operator/apis/lifecycle/v1alpha1/common/common_test.go similarity index 100% rename from operator/apis/lifecycle/v1alpha1/common/common_test.go rename to lifecycle-operator/apis/lifecycle/v1alpha1/common/common_test.go diff --git a/operator/apis/lifecycle/v1alpha1/common/phases.go b/lifecycle-operator/apis/lifecycle/v1alpha1/common/phases.go similarity index 100% rename from operator/apis/lifecycle/v1alpha1/common/phases.go rename to lifecycle-operator/apis/lifecycle/v1alpha1/common/phases.go diff --git a/operator/apis/lifecycle/v1alpha1/common/phases_test.go b/lifecycle-operator/apis/lifecycle/v1alpha1/common/phases_test.go similarity index 100% rename from operator/apis/lifecycle/v1alpha1/common/phases_test.go rename to lifecycle-operator/apis/lifecycle/v1alpha1/common/phases_test.go diff --git a/operator/apis/lifecycle/v1alpha1/groupversion_info.go b/lifecycle-operator/apis/lifecycle/v1alpha1/groupversion_info.go similarity index 100% rename from operator/apis/lifecycle/v1alpha1/groupversion_info.go rename to lifecycle-operator/apis/lifecycle/v1alpha1/groupversion_info.go diff --git a/operator/apis/lifecycle/v1alpha1/keptnapp_conversion.go b/lifecycle-operator/apis/lifecycle/v1alpha1/keptnapp_conversion.go similarity index 92% rename from operator/apis/lifecycle/v1alpha1/keptnapp_conversion.go rename to lifecycle-operator/apis/lifecycle/v1alpha1/keptnapp_conversion.go index 56867e7f48..80b545455d 100644 --- a/operator/apis/lifecycle/v1alpha1/keptnapp_conversion.go +++ b/lifecycle-operator/apis/lifecycle/v1alpha1/keptnapp_conversion.go @@ -3,8 +3,8 @@ package v1alpha1 import ( "fmt" - "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha1/common" - "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha1/common" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3" "sigs.k8s.io/controller-runtime/pkg/conversion" ) diff --git a/operator/apis/lifecycle/v1alpha1/keptnapp_conversion_test.go b/lifecycle-operator/apis/lifecycle/v1alpha1/keptnapp_conversion_test.go similarity index 97% rename from operator/apis/lifecycle/v1alpha1/keptnapp_conversion_test.go rename to lifecycle-operator/apis/lifecycle/v1alpha1/keptnapp_conversion_test.go index a840a099c2..8ef7c9150d 100644 --- a/operator/apis/lifecycle/v1alpha1/keptnapp_conversion_test.go +++ b/lifecycle-operator/apis/lifecycle/v1alpha1/keptnapp_conversion_test.go @@ -3,8 +3,8 @@ package v1alpha1 import ( "testing" - "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha1/common" - "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha1/common" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3" "github.com/stretchr/testify/require" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" v2 "sigs.k8s.io/controller-runtime/pkg/webhook/conversion/testdata/api/v2" diff --git a/operator/apis/lifecycle/v1alpha1/keptnapp_test.go b/lifecycle-operator/apis/lifecycle/v1alpha1/keptnapp_test.go similarity index 91% rename from operator/apis/lifecycle/v1alpha1/keptnapp_test.go rename to lifecycle-operator/apis/lifecycle/v1alpha1/keptnapp_test.go index c5c7328078..9ce1fdcd23 100644 --- a/operator/apis/lifecycle/v1alpha1/keptnapp_test.go +++ b/lifecycle-operator/apis/lifecycle/v1alpha1/keptnapp_test.go @@ -3,7 +3,7 @@ package v1alpha1 import ( "testing" - "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha1/common" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha1/common" "github.com/stretchr/testify/require" "go.opentelemetry.io/otel/attribute" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" diff --git a/operator/apis/lifecycle/v1alpha1/keptnapp_types.go b/lifecycle-operator/apis/lifecycle/v1alpha1/keptnapp_types.go similarity index 97% rename from operator/apis/lifecycle/v1alpha1/keptnapp_types.go rename to lifecycle-operator/apis/lifecycle/v1alpha1/keptnapp_types.go index 864cc72ca8..ce60dee83e 100644 --- a/operator/apis/lifecycle/v1alpha1/keptnapp_types.go +++ b/lifecycle-operator/apis/lifecycle/v1alpha1/keptnapp_types.go @@ -19,7 +19,7 @@ package v1alpha1 import ( "strings" - "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha1/common" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha1/common" "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/trace" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" diff --git a/operator/apis/lifecycle/v1alpha1/keptnappversion_conversion.go b/lifecycle-operator/apis/lifecycle/v1alpha1/keptnappversion_conversion.go similarity index 96% rename from operator/apis/lifecycle/v1alpha1/keptnappversion_conversion.go rename to lifecycle-operator/apis/lifecycle/v1alpha1/keptnappversion_conversion.go index 1be83f2629..54760f487f 100644 --- a/operator/apis/lifecycle/v1alpha1/keptnappversion_conversion.go +++ b/lifecycle-operator/apis/lifecycle/v1alpha1/keptnappversion_conversion.go @@ -3,9 +3,9 @@ package v1alpha1 import ( "fmt" - "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha1/common" - "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3" - v1alpha3common "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3/common" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha1/common" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3" + v1alpha3common "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3/common" "go.opentelemetry.io/otel/propagation" "sigs.k8s.io/controller-runtime/pkg/conversion" ) diff --git a/operator/apis/lifecycle/v1alpha1/keptnappversion_conversion_test.go b/lifecycle-operator/apis/lifecycle/v1alpha1/keptnappversion_conversion_test.go similarity index 98% rename from operator/apis/lifecycle/v1alpha1/keptnappversion_conversion_test.go rename to lifecycle-operator/apis/lifecycle/v1alpha1/keptnappversion_conversion_test.go index d90486e7fa..4ca42bbf8a 100644 --- a/operator/apis/lifecycle/v1alpha1/keptnappversion_conversion_test.go +++ b/lifecycle-operator/apis/lifecycle/v1alpha1/keptnappversion_conversion_test.go @@ -4,9 +4,9 @@ package v1alpha1 import ( "testing" - "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha1/common" - "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3" - v1alpha3common "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3/common" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha1/common" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3" + v1alpha3common "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3/common" "github.com/stretchr/testify/require" "go.opentelemetry.io/otel/propagation" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" diff --git a/operator/apis/lifecycle/v1alpha1/keptnappversion_test.go b/lifecycle-operator/apis/lifecycle/v1alpha1/keptnappversion_test.go similarity index 99% rename from operator/apis/lifecycle/v1alpha1/keptnappversion_test.go rename to lifecycle-operator/apis/lifecycle/v1alpha1/keptnappversion_test.go index ce2d762e45..95a6c0b4b4 100644 --- a/operator/apis/lifecycle/v1alpha1/keptnappversion_test.go +++ b/lifecycle-operator/apis/lifecycle/v1alpha1/keptnappversion_test.go @@ -4,7 +4,7 @@ import ( "testing" "time" - "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha1/common" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha1/common" "github.com/stretchr/testify/require" "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/propagation" diff --git a/operator/apis/lifecycle/v1alpha1/keptnappversion_types.go b/lifecycle-operator/apis/lifecycle/v1alpha1/keptnappversion_types.go similarity index 99% rename from operator/apis/lifecycle/v1alpha1/keptnappversion_types.go rename to lifecycle-operator/apis/lifecycle/v1alpha1/keptnappversion_types.go index 3b4e2002d4..55b62220ab 100644 --- a/operator/apis/lifecycle/v1alpha1/keptnappversion_types.go +++ b/lifecycle-operator/apis/lifecycle/v1alpha1/keptnappversion_types.go @@ -20,7 +20,7 @@ import ( "fmt" "time" - "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha1/common" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha1/common" "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/propagation" "go.opentelemetry.io/otel/trace" diff --git a/operator/apis/lifecycle/v1alpha1/keptnevaluation_test.go b/lifecycle-operator/apis/lifecycle/v1alpha1/keptnevaluation_test.go similarity index 96% rename from operator/apis/lifecycle/v1alpha1/keptnevaluation_test.go rename to lifecycle-operator/apis/lifecycle/v1alpha1/keptnevaluation_test.go index 203bab42e8..6fa539a847 100644 --- a/operator/apis/lifecycle/v1alpha1/keptnevaluation_test.go +++ b/lifecycle-operator/apis/lifecycle/v1alpha1/keptnevaluation_test.go @@ -3,7 +3,7 @@ package v1alpha1 import ( "testing" - "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha1/common" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha1/common" "github.com/stretchr/testify/require" "go.opentelemetry.io/otel/attribute" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" diff --git a/operator/apis/lifecycle/v1alpha1/keptnevaluation_types.go b/lifecycle-operator/apis/lifecycle/v1alpha1/keptnevaluation_types.go similarity index 98% rename from operator/apis/lifecycle/v1alpha1/keptnevaluation_types.go rename to lifecycle-operator/apis/lifecycle/v1alpha1/keptnevaluation_types.go index 112aff08ee..6c69f82af4 100644 --- a/operator/apis/lifecycle/v1alpha1/keptnevaluation_types.go +++ b/lifecycle-operator/apis/lifecycle/v1alpha1/keptnevaluation_types.go @@ -19,7 +19,7 @@ package v1alpha1 import ( "time" - "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha1/common" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha1/common" "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/propagation" "go.opentelemetry.io/otel/trace" diff --git a/operator/apis/lifecycle/v1alpha1/keptnevaluationdefinition_types.go b/lifecycle-operator/apis/lifecycle/v1alpha1/keptnevaluationdefinition_types.go similarity index 93% rename from operator/apis/lifecycle/v1alpha1/keptnevaluationdefinition_types.go rename to lifecycle-operator/apis/lifecycle/v1alpha1/keptnevaluationdefinition_types.go index 66eb210ff5..fb8075e010 100644 --- a/operator/apis/lifecycle/v1alpha1/keptnevaluationdefinition_types.go +++ b/lifecycle-operator/apis/lifecycle/v1alpha1/keptnevaluationdefinition_types.go @@ -17,7 +17,6 @@ limitations under the License. package v1alpha1 import ( - "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha1/common" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) @@ -47,7 +46,7 @@ type KeptnEvaluationDefinition struct { Spec KeptnEvaluationDefinitionSpec `json:"spec,omitempty"` // unused field - Status common.EmptyStatus `json:"status,omitempty"` + Status string `json:"status,omitempty"` } // +kubebuilder:object:root=true diff --git a/operator/apis/lifecycle/v1alpha1/keptnevaluationprovider_conversion.go b/lifecycle-operator/apis/lifecycle/v1alpha1/keptnevaluationprovider_conversion.go similarity index 89% rename from operator/apis/lifecycle/v1alpha1/keptnevaluationprovider_conversion.go rename to lifecycle-operator/apis/lifecycle/v1alpha1/keptnevaluationprovider_conversion.go index c86b0f1800..0707ef0def 100644 --- a/operator/apis/lifecycle/v1alpha1/keptnevaluationprovider_conversion.go +++ b/lifecycle-operator/apis/lifecycle/v1alpha1/keptnevaluationprovider_conversion.go @@ -3,8 +3,8 @@ package v1alpha1 import ( "fmt" - "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha1/common" - "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha1/common" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3" corev1 "k8s.io/api/core/v1" "sigs.k8s.io/controller-runtime/pkg/conversion" ) diff --git a/operator/apis/lifecycle/v1alpha1/keptnevaluationprovider_conversion_test.go b/lifecycle-operator/apis/lifecycle/v1alpha1/keptnevaluationprovider_conversion_test.go similarity index 96% rename from operator/apis/lifecycle/v1alpha1/keptnevaluationprovider_conversion_test.go rename to lifecycle-operator/apis/lifecycle/v1alpha1/keptnevaluationprovider_conversion_test.go index c25d268ad8..f0831624d6 100644 --- a/operator/apis/lifecycle/v1alpha1/keptnevaluationprovider_conversion_test.go +++ b/lifecycle-operator/apis/lifecycle/v1alpha1/keptnevaluationprovider_conversion_test.go @@ -3,8 +3,8 @@ package v1alpha1 import ( "testing" - "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha1/common" - "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha1/common" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3" "github.com/stretchr/testify/require" corev1 "k8s.io/api/core/v1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" diff --git a/operator/apis/lifecycle/v1alpha1/keptnevaluationprovider_types.go b/lifecycle-operator/apis/lifecycle/v1alpha1/keptnevaluationprovider_types.go similarity index 93% rename from operator/apis/lifecycle/v1alpha1/keptnevaluationprovider_types.go rename to lifecycle-operator/apis/lifecycle/v1alpha1/keptnevaluationprovider_types.go index 50beb32a57..12bb4b6c35 100644 --- a/operator/apis/lifecycle/v1alpha1/keptnevaluationprovider_types.go +++ b/lifecycle-operator/apis/lifecycle/v1alpha1/keptnevaluationprovider_types.go @@ -17,7 +17,6 @@ limitations under the License. package v1alpha1 import ( - "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha1/common" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) @@ -41,7 +40,7 @@ type KeptnEvaluationProvider struct { Spec KeptnEvaluationProviderSpec `json:"spec,omitempty"` // unused field - Status common.EmptyStatus `json:"status,omitempty"` + Status string `json:"status,omitempty"` } // +kubebuilder:object:root=true diff --git a/operator/apis/lifecycle/v1alpha1/keptntask_test.go b/lifecycle-operator/apis/lifecycle/v1alpha1/keptntask_test.go similarity index 97% rename from operator/apis/lifecycle/v1alpha1/keptntask_test.go rename to lifecycle-operator/apis/lifecycle/v1alpha1/keptntask_test.go index c8136ef1c1..9cdae0f619 100644 --- a/operator/apis/lifecycle/v1alpha1/keptntask_test.go +++ b/lifecycle-operator/apis/lifecycle/v1alpha1/keptntask_test.go @@ -3,7 +3,7 @@ package v1alpha1 import ( "testing" - "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha1/common" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha1/common" "github.com/stretchr/testify/require" "go.opentelemetry.io/otel/attribute" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" diff --git a/operator/apis/lifecycle/v1alpha1/keptntask_types.go b/lifecycle-operator/apis/lifecycle/v1alpha1/keptntask_types.go similarity index 98% rename from operator/apis/lifecycle/v1alpha1/keptntask_types.go rename to lifecycle-operator/apis/lifecycle/v1alpha1/keptntask_types.go index 06b6f2467b..3921ceb97c 100644 --- a/operator/apis/lifecycle/v1alpha1/keptntask_types.go +++ b/lifecycle-operator/apis/lifecycle/v1alpha1/keptntask_types.go @@ -19,7 +19,7 @@ package v1alpha1 import ( "time" - "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha1/common" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha1/common" "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/propagation" "go.opentelemetry.io/otel/trace" diff --git a/operator/apis/lifecycle/v1alpha1/keptntaskdefinition_types.go b/lifecycle-operator/apis/lifecycle/v1alpha1/keptntaskdefinition_types.go similarity index 100% rename from operator/apis/lifecycle/v1alpha1/keptntaskdefinition_types.go rename to lifecycle-operator/apis/lifecycle/v1alpha1/keptntaskdefinition_types.go diff --git a/operator/apis/lifecycle/v1alpha1/keptnworkload_test.go b/lifecycle-operator/apis/lifecycle/v1alpha1/keptnworkload_test.go similarity index 93% rename from operator/apis/lifecycle/v1alpha1/keptnworkload_test.go rename to lifecycle-operator/apis/lifecycle/v1alpha1/keptnworkload_test.go index 11454e0889..aeb8cd0025 100644 --- a/operator/apis/lifecycle/v1alpha1/keptnworkload_test.go +++ b/lifecycle-operator/apis/lifecycle/v1alpha1/keptnworkload_test.go @@ -3,7 +3,7 @@ package v1alpha1 import ( "testing" - "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha1/common" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha1/common" "github.com/stretchr/testify/require" "go.opentelemetry.io/otel/attribute" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" diff --git a/operator/apis/lifecycle/v1alpha1/keptnworkload_types.go b/lifecycle-operator/apis/lifecycle/v1alpha1/keptnworkload_types.go similarity index 97% rename from operator/apis/lifecycle/v1alpha1/keptnworkload_types.go rename to lifecycle-operator/apis/lifecycle/v1alpha1/keptnworkload_types.go index e7ba9afc47..c4d3a6b21b 100644 --- a/operator/apis/lifecycle/v1alpha1/keptnworkload_types.go +++ b/lifecycle-operator/apis/lifecycle/v1alpha1/keptnworkload_types.go @@ -19,7 +19,7 @@ package v1alpha1 import ( "strings" - "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha1/common" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha1/common" "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/trace" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" diff --git a/operator/apis/lifecycle/v1alpha1/keptnworkloadinstance_conversion.go b/lifecycle-operator/apis/lifecycle/v1alpha1/keptnworkloadinstance_conversion.go similarity index 96% rename from operator/apis/lifecycle/v1alpha1/keptnworkloadinstance_conversion.go rename to lifecycle-operator/apis/lifecycle/v1alpha1/keptnworkloadinstance_conversion.go index 1d696575ba..83e0b11c6d 100644 --- a/operator/apis/lifecycle/v1alpha1/keptnworkloadinstance_conversion.go +++ b/lifecycle-operator/apis/lifecycle/v1alpha1/keptnworkloadinstance_conversion.go @@ -3,9 +3,9 @@ package v1alpha1 import ( "fmt" - "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha1/common" - "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3" - v1alpha3common "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3/common" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha1/common" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3" + v1alpha3common "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3/common" "go.opentelemetry.io/otel/propagation" "sigs.k8s.io/controller-runtime/pkg/conversion" ) diff --git a/operator/apis/lifecycle/v1alpha1/keptnworkloadinstance_conversion_test.go b/lifecycle-operator/apis/lifecycle/v1alpha1/keptnworkloadinstance_conversion_test.go similarity index 98% rename from operator/apis/lifecycle/v1alpha1/keptnworkloadinstance_conversion_test.go rename to lifecycle-operator/apis/lifecycle/v1alpha1/keptnworkloadinstance_conversion_test.go index 59e0031489..02dddf6723 100644 --- a/operator/apis/lifecycle/v1alpha1/keptnworkloadinstance_conversion_test.go +++ b/lifecycle-operator/apis/lifecycle/v1alpha1/keptnworkloadinstance_conversion_test.go @@ -4,9 +4,9 @@ package v1alpha1 import ( "testing" - "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha1/common" - "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3" - v1alpha3common "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3/common" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha1/common" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3" + v1alpha3common "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3/common" "github.com/stretchr/testify/require" "go.opentelemetry.io/otel/propagation" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" diff --git a/operator/apis/lifecycle/v1alpha1/keptnworkloadinstance_test.go b/lifecycle-operator/apis/lifecycle/v1alpha1/keptnworkloadinstance_test.go similarity index 99% rename from operator/apis/lifecycle/v1alpha1/keptnworkloadinstance_test.go rename to lifecycle-operator/apis/lifecycle/v1alpha1/keptnworkloadinstance_test.go index 9dbc8d1736..3eadaabb92 100644 --- a/operator/apis/lifecycle/v1alpha1/keptnworkloadinstance_test.go +++ b/lifecycle-operator/apis/lifecycle/v1alpha1/keptnworkloadinstance_test.go @@ -4,7 +4,7 @@ import ( "testing" "time" - "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha1/common" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha1/common" "github.com/stretchr/testify/require" "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/propagation" diff --git a/operator/apis/lifecycle/v1alpha1/keptnworkloadinstance_types.go b/lifecycle-operator/apis/lifecycle/v1alpha1/keptnworkloadinstance_types.go similarity index 99% rename from operator/apis/lifecycle/v1alpha1/keptnworkloadinstance_types.go rename to lifecycle-operator/apis/lifecycle/v1alpha1/keptnworkloadinstance_types.go index 2eb75bff77..86e99ae67f 100644 --- a/operator/apis/lifecycle/v1alpha1/keptnworkloadinstance_types.go +++ b/lifecycle-operator/apis/lifecycle/v1alpha1/keptnworkloadinstance_types.go @@ -20,7 +20,7 @@ import ( "fmt" "time" - "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha1/common" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha1/common" "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/propagation" "go.opentelemetry.io/otel/trace" diff --git a/operator/apis/lifecycle/v1alpha2/semconv/semconv.go b/lifecycle-operator/apis/lifecycle/v1alpha1/semconv/semconv.go similarity index 81% rename from operator/apis/lifecycle/v1alpha2/semconv/semconv.go rename to lifecycle-operator/apis/lifecycle/v1alpha1/semconv/semconv.go index b91f6ad495..90f68f6122 100644 --- a/operator/apis/lifecycle/v1alpha2/semconv/semconv.go +++ b/lifecycle-operator/apis/lifecycle/v1alpha1/semconv/semconv.go @@ -1,7 +1,7 @@ package semconv import ( - "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha2/common" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha1/common" "go.opentelemetry.io/otel/trace" ) diff --git a/operator/apis/lifecycle/v1alpha1/zz_generated.deepcopy.go b/lifecycle-operator/apis/lifecycle/v1alpha1/zz_generated.deepcopy.go similarity index 99% rename from operator/apis/lifecycle/v1alpha1/zz_generated.deepcopy.go rename to lifecycle-operator/apis/lifecycle/v1alpha1/zz_generated.deepcopy.go index 96d009d609..35d1501f72 100644 --- a/operator/apis/lifecycle/v1alpha1/zz_generated.deepcopy.go +++ b/lifecycle-operator/apis/lifecycle/v1alpha1/zz_generated.deepcopy.go @@ -22,7 +22,7 @@ limitations under the License. package v1alpha1 import ( - "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha1/common" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha1/common" "go.opentelemetry.io/otel/propagation" runtime "k8s.io/apimachinery/pkg/runtime" ) @@ -466,7 +466,6 @@ func (in *KeptnEvaluationDefinition) DeepCopyInto(out *KeptnEvaluationDefinition out.TypeMeta = in.TypeMeta in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) in.Spec.DeepCopyInto(&out.Spec) - out.Status = in.Status } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KeptnEvaluationDefinition. @@ -577,7 +576,6 @@ func (in *KeptnEvaluationProvider) DeepCopyInto(out *KeptnEvaluationProvider) { out.TypeMeta = in.TypeMeta in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) out.Spec = in.Spec - out.Status = in.Status } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KeptnEvaluationProvider. diff --git a/operator/apis/lifecycle/v1alpha2/common/common.go b/lifecycle-operator/apis/lifecycle/v1alpha2/common/common.go similarity index 99% rename from operator/apis/lifecycle/v1alpha2/common/common.go rename to lifecycle-operator/apis/lifecycle/v1alpha2/common/common.go index 18e0d5d39e..4f758bbb6a 100644 --- a/operator/apis/lifecycle/v1alpha2/common/common.go +++ b/lifecycle-operator/apis/lifecycle/v1alpha2/common/common.go @@ -36,8 +36,6 @@ var ErrCannotCastKeptnApp = errors.New("cannot cast KeptnApp to v1alpha3") var ErrCannotCastKeptnWorkloadInstance = errors.New("cannot cast KeptnWorkloadInstance to v1alpha3") var ErrCannotCastKeptnEvaluationProvider = errors.New("cannot cast KeptnEvaluationDefinition to v1alpha3") -type EmptyStatus struct{} - type KeptnState string const ( diff --git a/operator/apis/lifecycle/v1alpha2/common/common_test.go b/lifecycle-operator/apis/lifecycle/v1alpha2/common/common_test.go similarity index 100% rename from operator/apis/lifecycle/v1alpha2/common/common_test.go rename to lifecycle-operator/apis/lifecycle/v1alpha2/common/common_test.go diff --git a/operator/apis/lifecycle/v1alpha2/common/phases.go b/lifecycle-operator/apis/lifecycle/v1alpha2/common/phases.go similarity index 100% rename from operator/apis/lifecycle/v1alpha2/common/phases.go rename to lifecycle-operator/apis/lifecycle/v1alpha2/common/phases.go diff --git a/operator/apis/lifecycle/v1alpha2/common/phases_test.go b/lifecycle-operator/apis/lifecycle/v1alpha2/common/phases_test.go similarity index 100% rename from operator/apis/lifecycle/v1alpha2/common/phases_test.go rename to lifecycle-operator/apis/lifecycle/v1alpha2/common/phases_test.go diff --git a/operator/apis/lifecycle/v1alpha2/groupversion_info.go b/lifecycle-operator/apis/lifecycle/v1alpha2/groupversion_info.go similarity index 100% rename from operator/apis/lifecycle/v1alpha2/groupversion_info.go rename to lifecycle-operator/apis/lifecycle/v1alpha2/groupversion_info.go diff --git a/operator/apis/lifecycle/v1alpha2/keptnapp_conversion.go b/lifecycle-operator/apis/lifecycle/v1alpha2/keptnapp_conversion.go similarity index 92% rename from operator/apis/lifecycle/v1alpha2/keptnapp_conversion.go rename to lifecycle-operator/apis/lifecycle/v1alpha2/keptnapp_conversion.go index 05cfb64e8a..412ea14071 100644 --- a/operator/apis/lifecycle/v1alpha2/keptnapp_conversion.go +++ b/lifecycle-operator/apis/lifecycle/v1alpha2/keptnapp_conversion.go @@ -3,8 +3,8 @@ package v1alpha2 import ( "fmt" - "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha2/common" - "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha2/common" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3" "sigs.k8s.io/controller-runtime/pkg/conversion" ) diff --git a/operator/apis/lifecycle/v1alpha2/keptnapp_conversion_test.go b/lifecycle-operator/apis/lifecycle/v1alpha2/keptnapp_conversion_test.go similarity index 97% rename from operator/apis/lifecycle/v1alpha2/keptnapp_conversion_test.go rename to lifecycle-operator/apis/lifecycle/v1alpha2/keptnapp_conversion_test.go index 12ef6a1d7a..b9dc50cdeb 100644 --- a/operator/apis/lifecycle/v1alpha2/keptnapp_conversion_test.go +++ b/lifecycle-operator/apis/lifecycle/v1alpha2/keptnapp_conversion_test.go @@ -3,8 +3,8 @@ package v1alpha2 import ( "testing" - "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha2/common" - "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha2/common" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3" "github.com/stretchr/testify/require" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" v2 "sigs.k8s.io/controller-runtime/pkg/webhook/conversion/testdata/api/v2" diff --git a/operator/apis/lifecycle/v1alpha2/keptnapp_test.go b/lifecycle-operator/apis/lifecycle/v1alpha2/keptnapp_test.go similarity index 92% rename from operator/apis/lifecycle/v1alpha2/keptnapp_test.go rename to lifecycle-operator/apis/lifecycle/v1alpha2/keptnapp_test.go index 1f9453a6d3..5c12c649c2 100644 --- a/operator/apis/lifecycle/v1alpha2/keptnapp_test.go +++ b/lifecycle-operator/apis/lifecycle/v1alpha2/keptnapp_test.go @@ -3,7 +3,7 @@ package v1alpha2 import ( "testing" - "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha2/common" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha2/common" "github.com/stretchr/testify/require" "go.opentelemetry.io/otel/attribute" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" diff --git a/operator/apis/lifecycle/v1alpha2/keptnapp_types.go b/lifecycle-operator/apis/lifecycle/v1alpha2/keptnapp_types.go similarity index 97% rename from operator/apis/lifecycle/v1alpha2/keptnapp_types.go rename to lifecycle-operator/apis/lifecycle/v1alpha2/keptnapp_types.go index ccbe19a97e..40e2f97b11 100644 --- a/operator/apis/lifecycle/v1alpha2/keptnapp_types.go +++ b/lifecycle-operator/apis/lifecycle/v1alpha2/keptnapp_types.go @@ -21,7 +21,7 @@ import ( "strconv" "strings" - "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha2/common" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha2/common" "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/trace" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" diff --git a/operator/apis/lifecycle/v1alpha2/keptnappversion_conversion.go b/lifecycle-operator/apis/lifecycle/v1alpha2/keptnappversion_conversion.go similarity index 96% rename from operator/apis/lifecycle/v1alpha2/keptnappversion_conversion.go rename to lifecycle-operator/apis/lifecycle/v1alpha2/keptnappversion_conversion.go index adb96c3be2..847108a0c4 100644 --- a/operator/apis/lifecycle/v1alpha2/keptnappversion_conversion.go +++ b/lifecycle-operator/apis/lifecycle/v1alpha2/keptnappversion_conversion.go @@ -3,9 +3,9 @@ package v1alpha2 import ( "fmt" - "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha2/common" - "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3" - v1alpha3common "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3/common" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha2/common" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3" + v1alpha3common "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3/common" "go.opentelemetry.io/otel/propagation" "sigs.k8s.io/controller-runtime/pkg/conversion" ) diff --git a/operator/apis/lifecycle/v1alpha2/keptnappversion_conversion_test.go b/lifecycle-operator/apis/lifecycle/v1alpha2/keptnappversion_conversion_test.go similarity index 98% rename from operator/apis/lifecycle/v1alpha2/keptnappversion_conversion_test.go rename to lifecycle-operator/apis/lifecycle/v1alpha2/keptnappversion_conversion_test.go index 2f967511da..dfcbe40e76 100644 --- a/operator/apis/lifecycle/v1alpha2/keptnappversion_conversion_test.go +++ b/lifecycle-operator/apis/lifecycle/v1alpha2/keptnappversion_conversion_test.go @@ -4,9 +4,9 @@ package v1alpha2 import ( "testing" - "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha2/common" - "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3" - v1alpha3common "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3/common" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha2/common" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3" + v1alpha3common "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3/common" "github.com/stretchr/testify/require" "go.opentelemetry.io/otel/propagation" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" diff --git a/operator/apis/lifecycle/v1alpha2/keptnappversion_test.go b/lifecycle-operator/apis/lifecycle/v1alpha2/keptnappversion_test.go similarity index 99% rename from operator/apis/lifecycle/v1alpha2/keptnappversion_test.go rename to lifecycle-operator/apis/lifecycle/v1alpha2/keptnappversion_test.go index 084504c2f0..2595aa52b5 100644 --- a/operator/apis/lifecycle/v1alpha2/keptnappversion_test.go +++ b/lifecycle-operator/apis/lifecycle/v1alpha2/keptnappversion_test.go @@ -4,7 +4,7 @@ import ( "testing" "time" - "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha2/common" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha2/common" "github.com/stretchr/testify/require" "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/propagation" diff --git a/operator/apis/lifecycle/v1alpha2/keptnappversion_types.go b/lifecycle-operator/apis/lifecycle/v1alpha2/keptnappversion_types.go similarity index 99% rename from operator/apis/lifecycle/v1alpha2/keptnappversion_types.go rename to lifecycle-operator/apis/lifecycle/v1alpha2/keptnappversion_types.go index eda1d8259a..e6af0d146f 100644 --- a/operator/apis/lifecycle/v1alpha2/keptnappversion_types.go +++ b/lifecycle-operator/apis/lifecycle/v1alpha2/keptnappversion_types.go @@ -20,7 +20,7 @@ import ( "fmt" "time" - "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha2/common" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha2/common" "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/propagation" "go.opentelemetry.io/otel/trace" diff --git a/operator/apis/lifecycle/v1alpha2/keptnevaluation_test.go b/lifecycle-operator/apis/lifecycle/v1alpha2/keptnevaluation_test.go similarity index 97% rename from operator/apis/lifecycle/v1alpha2/keptnevaluation_test.go rename to lifecycle-operator/apis/lifecycle/v1alpha2/keptnevaluation_test.go index a980c63e73..f43628ace6 100644 --- a/operator/apis/lifecycle/v1alpha2/keptnevaluation_test.go +++ b/lifecycle-operator/apis/lifecycle/v1alpha2/keptnevaluation_test.go @@ -3,7 +3,7 @@ package v1alpha2 import ( "testing" - "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha2/common" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha2/common" "github.com/stretchr/testify/require" "go.opentelemetry.io/otel/attribute" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" diff --git a/operator/apis/lifecycle/v1alpha2/keptnevaluation_types.go b/lifecycle-operator/apis/lifecycle/v1alpha2/keptnevaluation_types.go similarity index 98% rename from operator/apis/lifecycle/v1alpha2/keptnevaluation_types.go rename to lifecycle-operator/apis/lifecycle/v1alpha2/keptnevaluation_types.go index aebe235a5f..88d2de0bb7 100644 --- a/operator/apis/lifecycle/v1alpha2/keptnevaluation_types.go +++ b/lifecycle-operator/apis/lifecycle/v1alpha2/keptnevaluation_types.go @@ -19,7 +19,7 @@ package v1alpha2 import ( "time" - "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha2/common" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha2/common" "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/propagation" "go.opentelemetry.io/otel/trace" diff --git a/operator/apis/lifecycle/v1alpha2/keptnevaluationdefinition_types.go b/lifecycle-operator/apis/lifecycle/v1alpha2/keptnevaluationdefinition_types.go similarity index 93% rename from operator/apis/lifecycle/v1alpha2/keptnevaluationdefinition_types.go rename to lifecycle-operator/apis/lifecycle/v1alpha2/keptnevaluationdefinition_types.go index 3b5e57a888..b5d835f02b 100644 --- a/operator/apis/lifecycle/v1alpha2/keptnevaluationdefinition_types.go +++ b/lifecycle-operator/apis/lifecycle/v1alpha2/keptnevaluationdefinition_types.go @@ -17,7 +17,6 @@ limitations under the License. package v1alpha2 import ( - "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha2/common" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) @@ -47,7 +46,7 @@ type KeptnEvaluationDefinition struct { Spec KeptnEvaluationDefinitionSpec `json:"spec,omitempty"` // unused field - Status common.EmptyStatus `json:"status,omitempty"` + Status string `json:"status,omitempty"` } // +kubebuilder:object:root=true diff --git a/operator/apis/lifecycle/v1alpha2/keptnevaluationprovider_conversion.go b/lifecycle-operator/apis/lifecycle/v1alpha2/keptnevaluationprovider_conversion.go similarity index 90% rename from operator/apis/lifecycle/v1alpha2/keptnevaluationprovider_conversion.go rename to lifecycle-operator/apis/lifecycle/v1alpha2/keptnevaluationprovider_conversion.go index 6c31a5428b..5d62b63c25 100644 --- a/operator/apis/lifecycle/v1alpha2/keptnevaluationprovider_conversion.go +++ b/lifecycle-operator/apis/lifecycle/v1alpha2/keptnevaluationprovider_conversion.go @@ -3,8 +3,8 @@ package v1alpha2 import ( "fmt" - "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha2/common" - "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha2/common" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3" corev1 "k8s.io/api/core/v1" "sigs.k8s.io/controller-runtime/pkg/conversion" ) diff --git a/operator/apis/lifecycle/v1alpha2/keptnevaluationprovider_conversion_test.go b/lifecycle-operator/apis/lifecycle/v1alpha2/keptnevaluationprovider_conversion_test.go similarity index 96% rename from operator/apis/lifecycle/v1alpha2/keptnevaluationprovider_conversion_test.go rename to lifecycle-operator/apis/lifecycle/v1alpha2/keptnevaluationprovider_conversion_test.go index ed80f00483..6a2f3ecdea 100644 --- a/operator/apis/lifecycle/v1alpha2/keptnevaluationprovider_conversion_test.go +++ b/lifecycle-operator/apis/lifecycle/v1alpha2/keptnevaluationprovider_conversion_test.go @@ -3,8 +3,8 @@ package v1alpha2 import ( "testing" - "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha2/common" - "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha2/common" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3" "github.com/stretchr/testify/require" corev1 "k8s.io/api/core/v1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" diff --git a/operator/apis/lifecycle/v1alpha2/keptnevaluationprovider_test.go b/lifecycle-operator/apis/lifecycle/v1alpha2/keptnevaluationprovider_test.go similarity index 100% rename from operator/apis/lifecycle/v1alpha2/keptnevaluationprovider_test.go rename to lifecycle-operator/apis/lifecycle/v1alpha2/keptnevaluationprovider_test.go diff --git a/operator/apis/lifecycle/v1alpha2/keptnevaluationprovider_types.go b/lifecycle-operator/apis/lifecycle/v1alpha2/keptnevaluationprovider_types.go similarity index 94% rename from operator/apis/lifecycle/v1alpha2/keptnevaluationprovider_types.go rename to lifecycle-operator/apis/lifecycle/v1alpha2/keptnevaluationprovider_types.go index c3b601946d..1ecf947042 100644 --- a/operator/apis/lifecycle/v1alpha2/keptnevaluationprovider_types.go +++ b/lifecycle-operator/apis/lifecycle/v1alpha2/keptnevaluationprovider_types.go @@ -19,7 +19,6 @@ package v1alpha2 import ( "strings" - "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha2/common" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) @@ -44,7 +43,7 @@ type KeptnEvaluationProvider struct { Spec KeptnEvaluationProviderSpec `json:"spec,omitempty"` // unused field - Status common.EmptyStatus `json:"status,omitempty"` + Status string `json:"status,omitempty"` } // +kubebuilder:object:root=true diff --git a/operator/apis/lifecycle/v1alpha2/keptntask_test.go b/lifecycle-operator/apis/lifecycle/v1alpha2/keptntask_test.go similarity index 97% rename from operator/apis/lifecycle/v1alpha2/keptntask_test.go rename to lifecycle-operator/apis/lifecycle/v1alpha2/keptntask_test.go index f3c1e5bae5..de4eb26b94 100644 --- a/operator/apis/lifecycle/v1alpha2/keptntask_test.go +++ b/lifecycle-operator/apis/lifecycle/v1alpha2/keptntask_test.go @@ -3,7 +3,7 @@ package v1alpha2 import ( "testing" - "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha2/common" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha2/common" "github.com/stretchr/testify/require" "go.opentelemetry.io/otel/attribute" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" diff --git a/operator/apis/lifecycle/v1alpha2/keptntask_types.go b/lifecycle-operator/apis/lifecycle/v1alpha2/keptntask_types.go similarity index 98% rename from operator/apis/lifecycle/v1alpha2/keptntask_types.go rename to lifecycle-operator/apis/lifecycle/v1alpha2/keptntask_types.go index 5c14d4a0ad..9160d6d0f6 100644 --- a/operator/apis/lifecycle/v1alpha2/keptntask_types.go +++ b/lifecycle-operator/apis/lifecycle/v1alpha2/keptntask_types.go @@ -19,7 +19,7 @@ package v1alpha2 import ( "time" - "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha2/common" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha2/common" "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/propagation" "go.opentelemetry.io/otel/trace" diff --git a/operator/apis/lifecycle/v1alpha2/keptntaskdefinition_types.go b/lifecycle-operator/apis/lifecycle/v1alpha2/keptntaskdefinition_types.go similarity index 100% rename from operator/apis/lifecycle/v1alpha2/keptntaskdefinition_types.go rename to lifecycle-operator/apis/lifecycle/v1alpha2/keptntaskdefinition_types.go diff --git a/operator/apis/lifecycle/v1alpha2/keptnworkload_test.go b/lifecycle-operator/apis/lifecycle/v1alpha2/keptnworkload_test.go similarity index 93% rename from operator/apis/lifecycle/v1alpha2/keptnworkload_test.go rename to lifecycle-operator/apis/lifecycle/v1alpha2/keptnworkload_test.go index 7af31a4fb3..b57d5b079d 100644 --- a/operator/apis/lifecycle/v1alpha2/keptnworkload_test.go +++ b/lifecycle-operator/apis/lifecycle/v1alpha2/keptnworkload_test.go @@ -3,7 +3,7 @@ package v1alpha2 import ( "testing" - "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha2/common" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha2/common" "github.com/stretchr/testify/require" "go.opentelemetry.io/otel/attribute" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" diff --git a/operator/apis/lifecycle/v1alpha2/keptnworkload_types.go b/lifecycle-operator/apis/lifecycle/v1alpha2/keptnworkload_types.go similarity index 97% rename from operator/apis/lifecycle/v1alpha2/keptnworkload_types.go rename to lifecycle-operator/apis/lifecycle/v1alpha2/keptnworkload_types.go index 0961f062d0..798856d0ac 100644 --- a/operator/apis/lifecycle/v1alpha2/keptnworkload_types.go +++ b/lifecycle-operator/apis/lifecycle/v1alpha2/keptnworkload_types.go @@ -19,7 +19,7 @@ package v1alpha2 import ( "strings" - "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha2/common" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha2/common" "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/trace" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" diff --git a/operator/apis/lifecycle/v1alpha2/keptnworkloadinstance_conversion.go b/lifecycle-operator/apis/lifecycle/v1alpha2/keptnworkloadinstance_conversion.go similarity index 96% rename from operator/apis/lifecycle/v1alpha2/keptnworkloadinstance_conversion.go rename to lifecycle-operator/apis/lifecycle/v1alpha2/keptnworkloadinstance_conversion.go index 20f39c3955..f6812c0995 100644 --- a/operator/apis/lifecycle/v1alpha2/keptnworkloadinstance_conversion.go +++ b/lifecycle-operator/apis/lifecycle/v1alpha2/keptnworkloadinstance_conversion.go @@ -3,9 +3,9 @@ package v1alpha2 import ( "fmt" - "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha2/common" - "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3" - v1alpha3common "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3/common" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha2/common" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3" + v1alpha3common "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3/common" "go.opentelemetry.io/otel/propagation" "sigs.k8s.io/controller-runtime/pkg/conversion" ) diff --git a/operator/apis/lifecycle/v1alpha2/keptnworkloadinstance_conversion_test.go b/lifecycle-operator/apis/lifecycle/v1alpha2/keptnworkloadinstance_conversion_test.go similarity index 98% rename from operator/apis/lifecycle/v1alpha2/keptnworkloadinstance_conversion_test.go rename to lifecycle-operator/apis/lifecycle/v1alpha2/keptnworkloadinstance_conversion_test.go index 64aa7a1fe2..10d46f2e24 100644 --- a/operator/apis/lifecycle/v1alpha2/keptnworkloadinstance_conversion_test.go +++ b/lifecycle-operator/apis/lifecycle/v1alpha2/keptnworkloadinstance_conversion_test.go @@ -4,9 +4,9 @@ package v1alpha2 import ( "testing" - "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha2/common" - "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3" - v1alpha3common "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3/common" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha2/common" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3" + v1alpha3common "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3/common" "github.com/stretchr/testify/require" "go.opentelemetry.io/otel/propagation" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" diff --git a/operator/apis/lifecycle/v1alpha2/keptnworkloadinstance_test.go b/lifecycle-operator/apis/lifecycle/v1alpha2/keptnworkloadinstance_test.go similarity index 99% rename from operator/apis/lifecycle/v1alpha2/keptnworkloadinstance_test.go rename to lifecycle-operator/apis/lifecycle/v1alpha2/keptnworkloadinstance_test.go index 55d889407f..6f433e9b55 100644 --- a/operator/apis/lifecycle/v1alpha2/keptnworkloadinstance_test.go +++ b/lifecycle-operator/apis/lifecycle/v1alpha2/keptnworkloadinstance_test.go @@ -4,7 +4,7 @@ import ( "testing" "time" - "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha2/common" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha2/common" "github.com/stretchr/testify/require" "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/propagation" diff --git a/operator/apis/lifecycle/v1alpha2/keptnworkloadinstance_types.go b/lifecycle-operator/apis/lifecycle/v1alpha2/keptnworkloadinstance_types.go similarity index 99% rename from operator/apis/lifecycle/v1alpha2/keptnworkloadinstance_types.go rename to lifecycle-operator/apis/lifecycle/v1alpha2/keptnworkloadinstance_types.go index 1a7d8927f2..6757f88052 100644 --- a/operator/apis/lifecycle/v1alpha2/keptnworkloadinstance_types.go +++ b/lifecycle-operator/apis/lifecycle/v1alpha2/keptnworkloadinstance_types.go @@ -20,7 +20,7 @@ import ( "fmt" "time" - "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha2/common" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha2/common" "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/propagation" "go.opentelemetry.io/otel/trace" diff --git a/operator/apis/lifecycle/v1alpha3/semconv/semconv.go b/lifecycle-operator/apis/lifecycle/v1alpha2/semconv/semconv.go similarity index 81% rename from operator/apis/lifecycle/v1alpha3/semconv/semconv.go rename to lifecycle-operator/apis/lifecycle/v1alpha2/semconv/semconv.go index 214fd4cae7..474607e02e 100644 --- a/operator/apis/lifecycle/v1alpha3/semconv/semconv.go +++ b/lifecycle-operator/apis/lifecycle/v1alpha2/semconv/semconv.go @@ -1,7 +1,7 @@ package semconv import ( - "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3/common" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha2/common" "go.opentelemetry.io/otel/trace" ) diff --git a/operator/apis/lifecycle/v1alpha2/zz_generated.deepcopy.go b/lifecycle-operator/apis/lifecycle/v1alpha2/zz_generated.deepcopy.go similarity index 99% rename from operator/apis/lifecycle/v1alpha2/zz_generated.deepcopy.go rename to lifecycle-operator/apis/lifecycle/v1alpha2/zz_generated.deepcopy.go index eb48ec8bb5..3cb212387f 100644 --- a/operator/apis/lifecycle/v1alpha2/zz_generated.deepcopy.go +++ b/lifecycle-operator/apis/lifecycle/v1alpha2/zz_generated.deepcopy.go @@ -22,7 +22,7 @@ limitations under the License. package v1alpha2 import ( - "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha2/common" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha2/common" "go.opentelemetry.io/otel/propagation" runtime "k8s.io/apimachinery/pkg/runtime" ) @@ -466,7 +466,6 @@ func (in *KeptnEvaluationDefinition) DeepCopyInto(out *KeptnEvaluationDefinition out.TypeMeta = in.TypeMeta in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) in.Spec.DeepCopyInto(&out.Spec) - out.Status = in.Status } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KeptnEvaluationDefinition. @@ -577,7 +576,6 @@ func (in *KeptnEvaluationProvider) DeepCopyInto(out *KeptnEvaluationProvider) { out.TypeMeta = in.TypeMeta in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) in.Spec.DeepCopyInto(&out.Spec) - out.Status = in.Status } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KeptnEvaluationProvider. diff --git a/operator/apis/lifecycle/v1alpha3/common/common.go b/lifecycle-operator/apis/lifecycle/v1alpha3/common/common.go similarity index 98% rename from operator/apis/lifecycle/v1alpha3/common/common.go rename to lifecycle-operator/apis/lifecycle/v1alpha3/common/common.go index ee6152931a..52cf3d88cf 100644 --- a/operator/apis/lifecycle/v1alpha3/common/common.go +++ b/lifecycle-operator/apis/lifecycle/v1alpha3/common/common.go @@ -6,7 +6,7 @@ import ( "math/rand" "strconv" - operatorcommon "github.com/keptn/lifecycle-toolkit/operator/common" + operatorcommon "github.com/keptn/lifecycle-toolkit/lifecycle-operator/common" "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/metric" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -34,8 +34,6 @@ const AppTypeAnnotation = "keptn.sh/app-type" const MinKLTNameLen = 80 const MaxK8sObjectLength = 253 -type EmptyStatus struct{} - type AppType string const ( diff --git a/operator/apis/lifecycle/v1alpha3/common/common_test.go b/lifecycle-operator/apis/lifecycle/v1alpha3/common/common_test.go similarity index 100% rename from operator/apis/lifecycle/v1alpha3/common/common_test.go rename to lifecycle-operator/apis/lifecycle/v1alpha3/common/common_test.go diff --git a/operator/apis/lifecycle/v1alpha3/common/phases.go b/lifecycle-operator/apis/lifecycle/v1alpha3/common/phases.go similarity index 100% rename from operator/apis/lifecycle/v1alpha3/common/phases.go rename to lifecycle-operator/apis/lifecycle/v1alpha3/common/phases.go diff --git a/operator/apis/lifecycle/v1alpha3/common/phases_test.go b/lifecycle-operator/apis/lifecycle/v1alpha3/common/phases_test.go similarity index 100% rename from operator/apis/lifecycle/v1alpha3/common/phases_test.go rename to lifecycle-operator/apis/lifecycle/v1alpha3/common/phases_test.go diff --git a/operator/apis/lifecycle/v1alpha3/groupversion_info.go b/lifecycle-operator/apis/lifecycle/v1alpha3/groupversion_info.go similarity index 100% rename from operator/apis/lifecycle/v1alpha3/groupversion_info.go rename to lifecycle-operator/apis/lifecycle/v1alpha3/groupversion_info.go diff --git a/operator/apis/lifecycle/v1alpha3/keptnapp_conversion.go b/lifecycle-operator/apis/lifecycle/v1alpha3/keptnapp_conversion.go similarity index 100% rename from operator/apis/lifecycle/v1alpha3/keptnapp_conversion.go rename to lifecycle-operator/apis/lifecycle/v1alpha3/keptnapp_conversion.go diff --git a/operator/apis/lifecycle/v1alpha3/keptnapp_test.go b/lifecycle-operator/apis/lifecycle/v1alpha3/keptnapp_test.go similarity index 93% rename from operator/apis/lifecycle/v1alpha3/keptnapp_test.go rename to lifecycle-operator/apis/lifecycle/v1alpha3/keptnapp_test.go index cc7402f0bf..0868ec3dad 100644 --- a/operator/apis/lifecycle/v1alpha3/keptnapp_test.go +++ b/lifecycle-operator/apis/lifecycle/v1alpha3/keptnapp_test.go @@ -3,7 +3,7 @@ package v1alpha3 import ( "testing" - "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3/common" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3/common" "github.com/stretchr/testify/require" "go.opentelemetry.io/otel/attribute" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" diff --git a/operator/apis/lifecycle/v1alpha3/keptnapp_types.go b/lifecycle-operator/apis/lifecycle/v1alpha3/keptnapp_types.go similarity index 94% rename from operator/apis/lifecycle/v1alpha3/keptnapp_types.go rename to lifecycle-operator/apis/lifecycle/v1alpha3/keptnapp_types.go index ede59936bc..7904465006 100644 --- a/operator/apis/lifecycle/v1alpha3/keptnapp_types.go +++ b/lifecycle-operator/apis/lifecycle/v1alpha3/keptnapp_types.go @@ -17,8 +17,8 @@ limitations under the License. package v1alpha3 import ( - "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3/common" - operatorcommon "github.com/keptn/lifecycle-toolkit/operator/common" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3/common" + operatorcommon "github.com/keptn/lifecycle-toolkit/lifecycle-operator/common" "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/trace" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -73,9 +73,9 @@ type KeptnWorkloadRef struct { Version string `json:"version"` } -//+kubebuilder:object:root=true -//+kubebuilder:storageversion -//+kubebuilder:subresource:status +// +kubebuilder:object:root=true +// +kubebuilder:storageversion +// +kubebuilder:subresource:status // KeptnApp is the Schema for the keptnapps API type KeptnApp struct { @@ -88,7 +88,7 @@ type KeptnApp struct { Status KeptnAppStatus `json:"status,omitempty"` } -//+kubebuilder:object:root=true +// +kubebuilder:object:root=true // KeptnAppList contains a list of KeptnApp type KeptnAppList struct { diff --git a/operator/apis/lifecycle/v1alpha3/keptnapp_webhook.go b/lifecycle-operator/apis/lifecycle/v1alpha3/keptnapp_webhook.go similarity index 100% rename from operator/apis/lifecycle/v1alpha3/keptnapp_webhook.go rename to lifecycle-operator/apis/lifecycle/v1alpha3/keptnapp_webhook.go diff --git a/operator/apis/lifecycle/v1alpha3/keptnappcreationrequest_types.go b/lifecycle-operator/apis/lifecycle/v1alpha3/keptnappcreationrequest_types.go similarity index 91% rename from operator/apis/lifecycle/v1alpha3/keptnappcreationrequest_types.go rename to lifecycle-operator/apis/lifecycle/v1alpha3/keptnappcreationrequest_types.go index 5aa780bfdd..78253a9b25 100644 --- a/operator/apis/lifecycle/v1alpha3/keptnappcreationrequest_types.go +++ b/lifecycle-operator/apis/lifecycle/v1alpha3/keptnappcreationrequest_types.go @@ -17,7 +17,7 @@ limitations under the License. package v1alpha3 import ( - "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3/common" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3/common" "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/trace" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -32,8 +32,8 @@ type KeptnAppCreationRequestSpec struct { AppName string `json:"appName"` } -//+kubebuilder:object:root=true -//+kubebuilder:subresource:status +// +kubebuilder:object:root=true +// +kubebuilder:subresource:status // KeptnAppCreationRequest is the Schema for the keptnappcreationrequests API type KeptnAppCreationRequest struct { @@ -43,10 +43,10 @@ type KeptnAppCreationRequest struct { // Spec describes the desired state of the KeptnAppCreationRequest. Spec KeptnAppCreationRequestSpec `json:"spec,omitempty"` // Status describes the current state of the KeptnAppCreationRequest. - Status common.EmptyStatus `json:"status,omitempty"` + Status string `json:"status,omitempty"` } -//+kubebuilder:object:root=true +// +kubebuilder:object:root=true // KeptnAppCreationRequestList contains a list of KeptnAppCreationRequest type KeptnAppCreationRequestList struct { diff --git a/operator/apis/lifecycle/v1alpha3/keptnappcreationrequest_types_test.go b/lifecycle-operator/apis/lifecycle/v1alpha3/keptnappcreationrequest_types_test.go similarity index 94% rename from operator/apis/lifecycle/v1alpha3/keptnappcreationrequest_types_test.go rename to lifecycle-operator/apis/lifecycle/v1alpha3/keptnappcreationrequest_types_test.go index 1dd90610a6..b4243c762e 100644 --- a/operator/apis/lifecycle/v1alpha3/keptnappcreationrequest_types_test.go +++ b/lifecycle-operator/apis/lifecycle/v1alpha3/keptnappcreationrequest_types_test.go @@ -3,7 +3,7 @@ package v1alpha3 import ( "testing" - "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3/common" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3/common" "github.com/stretchr/testify/require" "go.opentelemetry.io/otel/attribute" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" diff --git a/operator/apis/lifecycle/v1alpha3/keptnappversion_conversion.go b/lifecycle-operator/apis/lifecycle/v1alpha3/keptnappversion_conversion.go similarity index 100% rename from operator/apis/lifecycle/v1alpha3/keptnappversion_conversion.go rename to lifecycle-operator/apis/lifecycle/v1alpha3/keptnappversion_conversion.go diff --git a/operator/apis/lifecycle/v1alpha3/keptnappversion_test.go b/lifecycle-operator/apis/lifecycle/v1alpha3/keptnappversion_test.go similarity index 99% rename from operator/apis/lifecycle/v1alpha3/keptnappversion_test.go rename to lifecycle-operator/apis/lifecycle/v1alpha3/keptnappversion_test.go index e718dd9a16..c7a5e40bb3 100644 --- a/operator/apis/lifecycle/v1alpha3/keptnappversion_test.go +++ b/lifecycle-operator/apis/lifecycle/v1alpha3/keptnappversion_test.go @@ -4,7 +4,7 @@ import ( "testing" "time" - "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3/common" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3/common" "github.com/stretchr/testify/require" "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/propagation" diff --git a/operator/apis/lifecycle/v1alpha3/keptnappversion_types.go b/lifecycle-operator/apis/lifecycle/v1alpha3/keptnappversion_types.go similarity index 97% rename from operator/apis/lifecycle/v1alpha3/keptnappversion_types.go rename to lifecycle-operator/apis/lifecycle/v1alpha3/keptnappversion_types.go index 0d2f353689..1b5c6ffcf1 100644 --- a/operator/apis/lifecycle/v1alpha3/keptnappversion_types.go +++ b/lifecycle-operator/apis/lifecycle/v1alpha3/keptnappversion_types.go @@ -20,7 +20,7 @@ import ( "fmt" "time" - "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3/common" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3/common" "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/propagation" "go.opentelemetry.io/otel/trace" @@ -91,11 +91,11 @@ type WorkloadStatus struct { Status common.KeptnState `json:"status,omitempty"` } -//+kubebuilder:object:root=true -//+kubebuilder:storageversion -//+kubebuilder:resource:path=keptnappversions,shortName=kav -//+kubebuilder:subresource:status -//+kubebuilder:printcolumn:name="AppName",type=string,JSONPath=`.spec.appName` +// +kubebuilder:object:root=true +// +kubebuilder:storageversion +// +kubebuilder:resource:path=keptnappversions,shortName=kav +// +kubebuilder:subresource:status +// +kubebuilder:printcolumn:name="AppName",type=string,JSONPath=`.spec.appName` // +kubebuilder:printcolumn:name="Version",type=string,JSONPath=`.spec.version` // +kubebuilder:printcolumn:name="Phase",type=string,JSONPath=`.status.currentPhase` // +kubebuilder:printcolumn:name="PreDeploymentStatus",priority=1,type=string,JSONPath=`.status.preDeploymentStatus` @@ -115,7 +115,7 @@ type KeptnAppVersion struct { Status KeptnAppVersionStatus `json:"status,omitempty"` } -//+kubebuilder:object:root=true +// +kubebuilder:object:root=true // KeptnAppVersionList contains a list of KeptnAppVersion type KeptnAppVersionList struct { diff --git a/operator/apis/lifecycle/v1alpha3/keptnappversion_webhook.go b/lifecycle-operator/apis/lifecycle/v1alpha3/keptnappversion_webhook.go similarity index 100% rename from operator/apis/lifecycle/v1alpha3/keptnappversion_webhook.go rename to lifecycle-operator/apis/lifecycle/v1alpha3/keptnappversion_webhook.go diff --git a/operator/apis/lifecycle/v1alpha3/keptnevaluation_test.go b/lifecycle-operator/apis/lifecycle/v1alpha3/keptnevaluation_test.go similarity index 97% rename from operator/apis/lifecycle/v1alpha3/keptnevaluation_test.go rename to lifecycle-operator/apis/lifecycle/v1alpha3/keptnevaluation_test.go index 307838c0de..8ea9a916f8 100644 --- a/operator/apis/lifecycle/v1alpha3/keptnevaluation_test.go +++ b/lifecycle-operator/apis/lifecycle/v1alpha3/keptnevaluation_test.go @@ -3,7 +3,7 @@ package v1alpha3 import ( "testing" - "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3/common" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3/common" "github.com/stretchr/testify/require" "go.opentelemetry.io/otel/attribute" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" diff --git a/operator/apis/lifecycle/v1alpha3/keptnevaluation_types.go b/lifecycle-operator/apis/lifecycle/v1alpha3/keptnevaluation_types.go similarity index 89% rename from operator/apis/lifecycle/v1alpha3/keptnevaluation_types.go rename to lifecycle-operator/apis/lifecycle/v1alpha3/keptnevaluation_types.go index 4f3c55bd62..132461510e 100644 --- a/operator/apis/lifecycle/v1alpha3/keptnevaluation_types.go +++ b/lifecycle-operator/apis/lifecycle/v1alpha3/keptnevaluation_types.go @@ -19,7 +19,7 @@ package v1alpha3 import ( "time" - "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3/common" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3/common" "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/propagation" "go.opentelemetry.io/otel/trace" @@ -92,17 +92,17 @@ type EvaluationStatusItem struct { Message string `json:"message,omitempty"` } -//+kubebuilder:object:root=true -//+kubebuilder:subresource:status -//+kubebuilder:storageversion -//+kubebuilder:resource:path=keptnevaluations,shortName=ke -//+kubebuilder:printcolumn:name="AppName",type=string,JSONPath=`.spec.appName` -//+kubebuilder:printcolumn:name="AppVersion",type=string,JSONPath=`.spec.appVersion` -//+kubebuilder:printcolumn:name="WorkloadName",type=string,JSONPath=`.spec.workload` -//+kubebuilder:printcolumn:name="WorkloadVersion",type=string,JSONPath=`.spec.workloadVersion` -//+kubebuilder:printcolumn:name="RetryCount",type=string,JSONPath=`.status.retryCount` -//+kubebuilder:printcolumn:name="EvaluationStatus",type=string,JSONPath=`.status.evaluationStatus` -//+kubebuilder:printcolumn:name="OverallStatus",type=string,JSONPath=`.status.overallStatus` +// +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion +// +kubebuilder:resource:path=keptnevaluations,shortName=ke +// +kubebuilder:printcolumn:name="AppName",type=string,JSONPath=`.spec.appName` +// +kubebuilder:printcolumn:name="AppVersion",type=string,JSONPath=`.spec.appVersion` +// +kubebuilder:printcolumn:name="WorkloadName",type=string,JSONPath=`.spec.workload` +// +kubebuilder:printcolumn:name="WorkloadVersion",type=string,JSONPath=`.spec.workloadVersion` +// +kubebuilder:printcolumn:name="RetryCount",type=string,JSONPath=`.status.retryCount` +// +kubebuilder:printcolumn:name="EvaluationStatus",type=string,JSONPath=`.status.evaluationStatus` +// +kubebuilder:printcolumn:name="OverallStatus",type=string,JSONPath=`.status.overallStatus` // KeptnEvaluation is the Schema for the keptnevaluations API type KeptnEvaluation struct { @@ -115,7 +115,7 @@ type KeptnEvaluation struct { Status KeptnEvaluationStatus `json:"status,omitempty"` } -//+kubebuilder:object:root=true +// +kubebuilder:object:root=true // KeptnEvaluationList contains a list of KeptnEvaluation type KeptnEvaluationList struct { diff --git a/operator/apis/lifecycle/v1alpha3/keptnevaluationdefinition_types.go b/lifecycle-operator/apis/lifecycle/v1alpha3/keptnevaluationdefinition_types.go similarity index 88% rename from operator/apis/lifecycle/v1alpha3/keptnevaluationdefinition_types.go rename to lifecycle-operator/apis/lifecycle/v1alpha3/keptnevaluationdefinition_types.go index 0f8505546f..94f7b3bed0 100644 --- a/operator/apis/lifecycle/v1alpha3/keptnevaluationdefinition_types.go +++ b/lifecycle-operator/apis/lifecycle/v1alpha3/keptnevaluationdefinition_types.go @@ -17,7 +17,6 @@ limitations under the License. package v1alpha3 import ( - "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3/common" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) @@ -46,10 +45,10 @@ type KeptnMetricReference struct { Namespace string `json:"namespace,omitempty"` } -//+kubebuilder:object:root=true -//+kubebuilder:subresource:status -//+kubebuilder:storageversion -//+kubebuilder:resource:path=keptnevaluationdefinitions,shortName=ked +// +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion +// +kubebuilder:resource:path=keptnevaluationdefinitions,shortName=ked // KeptnEvaluationDefinition is the Schema for the keptnevaluationdefinitions API type KeptnEvaluationDefinition struct { @@ -59,10 +58,10 @@ type KeptnEvaluationDefinition struct { // Spec describes the desired state of the KeptnEvaluationDefinition. Spec KeptnEvaluationDefinitionSpec `json:"spec,omitempty"` // unused field - Status common.EmptyStatus `json:"status,omitempty"` + Status string `json:"status,omitempty"` } -//+kubebuilder:object:root=true +// +kubebuilder:object:root=true // KeptnEvaluationDefinitionList contains a list of KeptnEvaluationDefinition type KeptnEvaluationDefinitionList struct { diff --git a/operator/apis/lifecycle/v1alpha3/keptnevaluationprovider_conversion.go b/lifecycle-operator/apis/lifecycle/v1alpha3/keptnevaluationprovider_conversion.go similarity index 100% rename from operator/apis/lifecycle/v1alpha3/keptnevaluationprovider_conversion.go rename to lifecycle-operator/apis/lifecycle/v1alpha3/keptnevaluationprovider_conversion.go diff --git a/operator/apis/lifecycle/v1alpha3/keptnevaluationprovider_types.go b/lifecycle-operator/apis/lifecycle/v1alpha3/keptnevaluationprovider_types.go similarity index 86% rename from operator/apis/lifecycle/v1alpha3/keptnevaluationprovider_types.go rename to lifecycle-operator/apis/lifecycle/v1alpha3/keptnevaluationprovider_types.go index ddebd2ab72..43edc7fc1b 100644 --- a/operator/apis/lifecycle/v1alpha3/keptnevaluationprovider_types.go +++ b/lifecycle-operator/apis/lifecycle/v1alpha3/keptnevaluationprovider_types.go @@ -17,7 +17,6 @@ limitations under the License. package v1alpha3 import ( - "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3/common" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) @@ -31,9 +30,9 @@ type KeptnEvaluationProviderSpec struct { SecretKeyRef corev1.SecretKeySelector `json:"secretKeyRef,omitempty"` } -//+kubebuilder:object:root=true -//+kubebuilder:storageversion -//+kubebuilder:subresource:status +// +kubebuilder:object:root=true +// +kubebuilder:storageversion +// +kubebuilder:subresource:status // KeptnEvaluationProvider is the Schema for the keptnevaluationproviders API type KeptnEvaluationProvider struct { @@ -42,10 +41,10 @@ type KeptnEvaluationProvider struct { Spec KeptnEvaluationProviderSpec `json:"spec,omitempty"` // unused field - Status common.EmptyStatus `json:"status,omitempty"` + Status string `json:"status,omitempty"` } -//+kubebuilder:object:root=true +// +kubebuilder:object:root=true // KeptnEvaluationProviderList contains a list of KeptnEvaluationProvider type KeptnEvaluationProviderList struct { diff --git a/operator/apis/lifecycle/v1alpha3/keptnevaluationprovider_webhook.go b/lifecycle-operator/apis/lifecycle/v1alpha3/keptnevaluationprovider_webhook.go similarity index 100% rename from operator/apis/lifecycle/v1alpha3/keptnevaluationprovider_webhook.go rename to lifecycle-operator/apis/lifecycle/v1alpha3/keptnevaluationprovider_webhook.go diff --git a/operator/apis/lifecycle/v1alpha3/keptntask_test.go b/lifecycle-operator/apis/lifecycle/v1alpha3/keptntask_test.go similarity index 97% rename from operator/apis/lifecycle/v1alpha3/keptntask_test.go rename to lifecycle-operator/apis/lifecycle/v1alpha3/keptntask_test.go index ff3865c8a3..55c4bf1c91 100644 --- a/operator/apis/lifecycle/v1alpha3/keptntask_test.go +++ b/lifecycle-operator/apis/lifecycle/v1alpha3/keptntask_test.go @@ -4,7 +4,7 @@ import ( "testing" "time" - "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3/common" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3/common" "github.com/stretchr/testify/require" "go.opentelemetry.io/otel/attribute" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" diff --git a/operator/apis/lifecycle/v1alpha3/keptntask_types.go b/lifecycle-operator/apis/lifecycle/v1alpha3/keptntask_types.go similarity index 98% rename from operator/apis/lifecycle/v1alpha3/keptntask_types.go rename to lifecycle-operator/apis/lifecycle/v1alpha3/keptntask_types.go index 182cd4512b..d1929d892d 100644 --- a/operator/apis/lifecycle/v1alpha3/keptntask_types.go +++ b/lifecycle-operator/apis/lifecycle/v1alpha3/keptntask_types.go @@ -19,7 +19,7 @@ package v1alpha3 import ( "time" - "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3/common" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3/common" "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/propagation" "go.opentelemetry.io/otel/trace" @@ -138,7 +138,7 @@ type KeptnTask struct { Status KeptnTaskStatus `json:"status,omitempty"` } -//+kubebuilder:object:root=true +// +kubebuilder:object:root=true // KeptnTaskList contains a list of KeptnTask type KeptnTaskList struct { diff --git a/operator/apis/lifecycle/v1alpha3/keptntaskdefinition_types.go b/lifecycle-operator/apis/lifecycle/v1alpha3/keptntaskdefinition_types.go similarity index 100% rename from operator/apis/lifecycle/v1alpha3/keptntaskdefinition_types.go rename to lifecycle-operator/apis/lifecycle/v1alpha3/keptntaskdefinition_types.go diff --git a/operator/apis/lifecycle/v1alpha3/keptntaskdefinition_webhook.go b/lifecycle-operator/apis/lifecycle/v1alpha3/keptntaskdefinition_webhook.go similarity index 100% rename from operator/apis/lifecycle/v1alpha3/keptntaskdefinition_webhook.go rename to lifecycle-operator/apis/lifecycle/v1alpha3/keptntaskdefinition_webhook.go diff --git a/operator/apis/lifecycle/v1alpha3/keptntaskdefinition_webhook_test.go b/lifecycle-operator/apis/lifecycle/v1alpha3/keptntaskdefinition_webhook_test.go similarity index 100% rename from operator/apis/lifecycle/v1alpha3/keptntaskdefinition_webhook_test.go rename to lifecycle-operator/apis/lifecycle/v1alpha3/keptntaskdefinition_webhook_test.go diff --git a/operator/apis/lifecycle/v1alpha3/keptnworkload_test.go b/lifecycle-operator/apis/lifecycle/v1alpha3/keptnworkload_test.go similarity index 93% rename from operator/apis/lifecycle/v1alpha3/keptnworkload_test.go rename to lifecycle-operator/apis/lifecycle/v1alpha3/keptnworkload_test.go index 72f09672b0..d9084d297a 100644 --- a/operator/apis/lifecycle/v1alpha3/keptnworkload_test.go +++ b/lifecycle-operator/apis/lifecycle/v1alpha3/keptnworkload_test.go @@ -3,7 +3,7 @@ package v1alpha3 import ( "testing" - "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3/common" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3/common" "github.com/stretchr/testify/require" "go.opentelemetry.io/otel/attribute" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" diff --git a/operator/apis/lifecycle/v1alpha3/keptnworkload_types.go b/lifecycle-operator/apis/lifecycle/v1alpha3/keptnworkload_types.go similarity index 94% rename from operator/apis/lifecycle/v1alpha3/keptnworkload_types.go rename to lifecycle-operator/apis/lifecycle/v1alpha3/keptnworkload_types.go index f550f7179f..1bc1d4ddd4 100644 --- a/operator/apis/lifecycle/v1alpha3/keptnworkload_types.go +++ b/lifecycle-operator/apis/lifecycle/v1alpha3/keptnworkload_types.go @@ -20,8 +20,8 @@ import ( "fmt" "strings" - "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3/common" - operatorcommon "github.com/keptn/lifecycle-toolkit/operator/common" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3/common" + operatorcommon "github.com/keptn/lifecycle-toolkit/lifecycle-operator/common" "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/trace" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -66,9 +66,9 @@ type KeptnWorkloadStatus struct { CurrentVersion string `json:"currentVersion,omitempty"` } -//+kubebuilder:object:root=true -//+kubebuilder:subresource:status -//+kubebuilder:storageversion +// +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // +kubebuilder:printcolumn:name="AppName",type=string,JSONPath=`.spec.app` // +kubebuilder:printcolumn:name="Version",type=string,JSONPath=`.spec.version` @@ -83,7 +83,7 @@ type KeptnWorkload struct { Status KeptnWorkloadStatus `json:"status,omitempty"` } -//+kubebuilder:object:root=true +// +kubebuilder:object:root=true // KeptnWorkloadList contains a list of KeptnWorkload type KeptnWorkloadList struct { diff --git a/operator/apis/lifecycle/v1alpha3/keptnworkload_types_test.go b/lifecycle-operator/apis/lifecycle/v1alpha3/keptnworkload_types_test.go similarity index 100% rename from operator/apis/lifecycle/v1alpha3/keptnworkload_types_test.go rename to lifecycle-operator/apis/lifecycle/v1alpha3/keptnworkload_types_test.go diff --git a/operator/apis/lifecycle/v1alpha3/keptnworkloadinstance_conversion.go b/lifecycle-operator/apis/lifecycle/v1alpha3/keptnworkloadinstance_conversion.go similarity index 100% rename from operator/apis/lifecycle/v1alpha3/keptnworkloadinstance_conversion.go rename to lifecycle-operator/apis/lifecycle/v1alpha3/keptnworkloadinstance_conversion.go diff --git a/operator/apis/lifecycle/v1alpha3/keptnworkloadinstance_test.go b/lifecycle-operator/apis/lifecycle/v1alpha3/keptnworkloadinstance_test.go similarity index 99% rename from operator/apis/lifecycle/v1alpha3/keptnworkloadinstance_test.go rename to lifecycle-operator/apis/lifecycle/v1alpha3/keptnworkloadinstance_test.go index 551519c230..0227a51048 100644 --- a/operator/apis/lifecycle/v1alpha3/keptnworkloadinstance_test.go +++ b/lifecycle-operator/apis/lifecycle/v1alpha3/keptnworkloadinstance_test.go @@ -4,7 +4,7 @@ import ( "testing" "time" - "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3/common" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3/common" "github.com/stretchr/testify/require" "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/propagation" diff --git a/operator/apis/lifecycle/v1alpha3/keptnworkloadinstance_types.go b/lifecycle-operator/apis/lifecycle/v1alpha3/keptnworkloadinstance_types.go similarity index 98% rename from operator/apis/lifecycle/v1alpha3/keptnworkloadinstance_types.go rename to lifecycle-operator/apis/lifecycle/v1alpha3/keptnworkloadinstance_types.go index 0440489ac3..28a1803959 100644 --- a/operator/apis/lifecycle/v1alpha3/keptnworkloadinstance_types.go +++ b/lifecycle-operator/apis/lifecycle/v1alpha3/keptnworkloadinstance_types.go @@ -20,7 +20,7 @@ import ( "fmt" "time" - "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3/common" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3/common" "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/propagation" "go.opentelemetry.io/otel/trace" @@ -98,10 +98,10 @@ type ItemStatus struct { EndTime metav1.Time `json:"endTime,omitempty"` } -//+kubebuilder:object:root=true -//+kubebuilder:resource:path=keptnworkloadinstances,shortName=kwi -//+kubebuilder:subresource:status -//+kubebuilder:storageversion +// +kubebuilder:object:root=true +// +kubebuilder:resource:path=keptnworkloadinstances,shortName=kwi +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // +kubebuilder:printcolumn:name="AppName",type=string,JSONPath=`.spec.app` // +kubebuilder:printcolumn:name="WorkloadName",type=string,JSONPath=`.spec.workloadName` // +kubebuilder:printcolumn:name="WorkloadVersion",type=string,JSONPath=`.spec.version` @@ -123,7 +123,7 @@ type KeptnWorkloadInstance struct { Status KeptnWorkloadInstanceStatus `json:"status,omitempty"` } -//+kubebuilder:object:root=true +// +kubebuilder:object:root=true // KeptnWorkloadInstanceList contains a list of KeptnWorkloadInstance type KeptnWorkloadInstanceList struct { diff --git a/operator/apis/lifecycle/v1alpha3/keptnworkloadinstance_webhook.go b/lifecycle-operator/apis/lifecycle/v1alpha3/keptnworkloadinstance_webhook.go similarity index 100% rename from operator/apis/lifecycle/v1alpha3/keptnworkloadinstance_webhook.go rename to lifecycle-operator/apis/lifecycle/v1alpha3/keptnworkloadinstance_webhook.go diff --git a/operator/apis/lifecycle/v1alpha1/semconv/semconv.go b/lifecycle-operator/apis/lifecycle/v1alpha3/semconv/semconv.go similarity index 81% rename from operator/apis/lifecycle/v1alpha1/semconv/semconv.go rename to lifecycle-operator/apis/lifecycle/v1alpha3/semconv/semconv.go index 95475b9344..547b3bf217 100644 --- a/operator/apis/lifecycle/v1alpha1/semconv/semconv.go +++ b/lifecycle-operator/apis/lifecycle/v1alpha3/semconv/semconv.go @@ -1,7 +1,7 @@ package semconv import ( - "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha1/common" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3/common" "go.opentelemetry.io/otel/trace" ) diff --git a/operator/apis/lifecycle/v1alpha3/zz_generated.deepcopy.go b/lifecycle-operator/apis/lifecycle/v1alpha3/zz_generated.deepcopy.go similarity index 99% rename from operator/apis/lifecycle/v1alpha3/zz_generated.deepcopy.go rename to lifecycle-operator/apis/lifecycle/v1alpha3/zz_generated.deepcopy.go index d6d24341a5..7dd637e57a 100644 --- a/operator/apis/lifecycle/v1alpha3/zz_generated.deepcopy.go +++ b/lifecycle-operator/apis/lifecycle/v1alpha3/zz_generated.deepcopy.go @@ -22,7 +22,7 @@ limitations under the License. package v1alpha3 import ( - "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3/common" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3/common" "go.opentelemetry.io/otel/propagation" "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/runtime" @@ -188,7 +188,6 @@ func (in *KeptnAppCreationRequest) DeepCopyInto(out *KeptnAppCreationRequest) { out.TypeMeta = in.TypeMeta in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) out.Spec = in.Spec - out.Status = in.Status } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KeptnAppCreationRequest. @@ -525,7 +524,6 @@ func (in *KeptnEvaluationDefinition) DeepCopyInto(out *KeptnEvaluationDefinition out.TypeMeta = in.TypeMeta in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) in.Spec.DeepCopyInto(&out.Spec) - out.Status = in.Status } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KeptnEvaluationDefinition. @@ -636,7 +634,6 @@ func (in *KeptnEvaluationProvider) DeepCopyInto(out *KeptnEvaluationProvider) { out.TypeMeta = in.TypeMeta in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) in.Spec.DeepCopyInto(&out.Spec) - out.Status = in.Status } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KeptnEvaluationProvider. diff --git a/operator/apis/options/v1alpha1/groupversion_info.go b/lifecycle-operator/apis/options/v1alpha1/groupversion_info.go similarity index 100% rename from operator/apis/options/v1alpha1/groupversion_info.go rename to lifecycle-operator/apis/options/v1alpha1/groupversion_info.go diff --git a/operator/apis/options/v1alpha1/keptnconfig_types.go b/lifecycle-operator/apis/options/v1alpha1/keptnconfig_types.go similarity index 95% rename from operator/apis/options/v1alpha1/keptnconfig_types.go rename to lifecycle-operator/apis/options/v1alpha1/keptnconfig_types.go index 5e73cbd6fb..50d72d5eae 100644 --- a/operator/apis/options/v1alpha1/keptnconfig_types.go +++ b/lifecycle-operator/apis/options/v1alpha1/keptnconfig_types.go @@ -28,7 +28,7 @@ type KeptnConfigSpec struct { // INSERT ADDITIONAL SPEC FIELDS - desired state of cluster // Important: Run "make" to regenerate code after modifying this file - // OTelCollectorUrl can be used to set the Open Telemetry collector that the operator should use + // OTelCollectorUrl can be used to set the Open Telemetry collector that the lifecycle operator should use // +optional OTelCollectorUrl string `json:"OTelCollectorUrl,omitempty"` // KeptnAppCreationRequestTimeoutSeconds is used to set the interval in which automatic app discovery @@ -38,8 +38,6 @@ type KeptnConfigSpec struct { KeptnAppCreationRequestTimeoutSeconds uint `json:"keptnAppCreationRequestTimeoutSeconds,omitempty"` } -type EmptyStatus struct{} - // +kubebuilder:object:root=true // +kubebuilder:subresource:status @@ -50,7 +48,7 @@ type KeptnConfig struct { Spec KeptnConfigSpec `json:"spec,omitempty"` // unused field - Status EmptyStatus `json:"status,omitempty"` + Status string `json:"status,omitempty"` } // +kubebuilder:object:root=true diff --git a/operator/apis/options/v1alpha1/zz_generated.deepcopy.go b/lifecycle-operator/apis/options/v1alpha1/zz_generated.deepcopy.go similarity index 86% rename from operator/apis/options/v1alpha1/zz_generated.deepcopy.go rename to lifecycle-operator/apis/options/v1alpha1/zz_generated.deepcopy.go index 82e0a71d7b..29dcf00dcd 100644 --- a/operator/apis/options/v1alpha1/zz_generated.deepcopy.go +++ b/lifecycle-operator/apis/options/v1alpha1/zz_generated.deepcopy.go @@ -25,28 +25,12 @@ import ( runtime "k8s.io/apimachinery/pkg/runtime" ) -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *EmptyStatus) DeepCopyInto(out *EmptyStatus) { - *out = *in -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EmptyStatus. -func (in *EmptyStatus) DeepCopy() *EmptyStatus { - if in == nil { - return nil - } - out := new(EmptyStatus) - in.DeepCopyInto(out) - return out -} - // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *KeptnConfig) DeepCopyInto(out *KeptnConfig) { *out = *in out.TypeMeta = in.TypeMeta in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) out.Spec = in.Spec - out.Status = in.Status } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KeptnConfig. diff --git a/operator/cmd/config/config.go b/lifecycle-operator/cmd/config/config.go similarity index 100% rename from operator/cmd/config/config.go rename to lifecycle-operator/cmd/config/config.go diff --git a/operator/cmd/config/config_test.go b/lifecycle-operator/cmd/config/config_test.go similarity index 100% rename from operator/cmd/config/config_test.go rename to lifecycle-operator/cmd/config/config_test.go diff --git a/operator/cmd/fake/manager_mock.go b/lifecycle-operator/cmd/fake/manager_mock.go similarity index 100% rename from operator/cmd/fake/manager_mock.go rename to lifecycle-operator/cmd/fake/manager_mock.go diff --git a/operator/cmd/fake/provider_mock.go b/lifecycle-operator/cmd/fake/provider_mock.go similarity index 100% rename from operator/cmd/fake/provider_mock.go rename to lifecycle-operator/cmd/fake/provider_mock.go diff --git a/operator/cmd/fake/webhookmanager_mock.go b/lifecycle-operator/cmd/fake/webhookmanager_mock.go similarity index 100% rename from operator/cmd/fake/webhookmanager_mock.go rename to lifecycle-operator/cmd/fake/webhookmanager_mock.go diff --git a/operator/cmd/manager/manager.go b/lifecycle-operator/cmd/manager/manager.go similarity index 100% rename from operator/cmd/manager/manager.go rename to lifecycle-operator/cmd/manager/manager.go diff --git a/operator/common/common.go b/lifecycle-operator/common/common.go similarity index 100% rename from operator/common/common.go rename to lifecycle-operator/common/common.go diff --git a/operator/common/common_test.go b/lifecycle-operator/common/common_test.go similarity index 100% rename from operator/common/common_test.go rename to lifecycle-operator/common/common_test.go diff --git a/operator/config/crd/bases/lifecycle.keptn.sh_keptnappcreationrequests.yaml b/lifecycle-operator/config/crd/bases/lifecycle.keptn.sh_keptnappcreationrequests.yaml similarity index 98% rename from operator/config/crd/bases/lifecycle.keptn.sh_keptnappcreationrequests.yaml rename to lifecycle-operator/config/crd/bases/lifecycle.keptn.sh_keptnappcreationrequests.yaml index 2a782d856c..a6e123f194 100644 --- a/operator/config/crd/bases/lifecycle.keptn.sh_keptnappcreationrequests.yaml +++ b/lifecycle-operator/config/crd/bases/lifecycle.keptn.sh_keptnappcreationrequests.yaml @@ -44,7 +44,7 @@ spec: type: object status: description: Status describes the current state of the KeptnAppCreationRequest. - type: object + type: string type: object served: true storage: true diff --git a/operator/config/crd/bases/lifecycle.keptn.sh_keptnapps.yaml b/lifecycle-operator/config/crd/bases/lifecycle.keptn.sh_keptnapps.yaml similarity index 100% rename from operator/config/crd/bases/lifecycle.keptn.sh_keptnapps.yaml rename to lifecycle-operator/config/crd/bases/lifecycle.keptn.sh_keptnapps.yaml diff --git a/operator/config/crd/bases/lifecycle.keptn.sh_keptnappversions.yaml b/lifecycle-operator/config/crd/bases/lifecycle.keptn.sh_keptnappversions.yaml similarity index 100% rename from operator/config/crd/bases/lifecycle.keptn.sh_keptnappversions.yaml rename to lifecycle-operator/config/crd/bases/lifecycle.keptn.sh_keptnappversions.yaml diff --git a/operator/config/crd/bases/lifecycle.keptn.sh_keptnevaluationdefinitions.yaml b/lifecycle-operator/config/crd/bases/lifecycle.keptn.sh_keptnevaluationdefinitions.yaml similarity index 98% rename from operator/config/crd/bases/lifecycle.keptn.sh_keptnevaluationdefinitions.yaml rename to lifecycle-operator/config/crd/bases/lifecycle.keptn.sh_keptnevaluationdefinitions.yaml index 73aad8a709..06980838fb 100644 --- a/operator/config/crd/bases/lifecycle.keptn.sh_keptnevaluationdefinitions.yaml +++ b/lifecycle-operator/config/crd/bases/lifecycle.keptn.sh_keptnevaluationdefinitions.yaml @@ -61,7 +61,7 @@ spec: type: object status: description: unused field - type: object + type: string type: object served: true storage: false @@ -112,7 +112,7 @@ spec: type: object status: description: unused field - type: object + type: string type: object served: true storage: false @@ -174,7 +174,7 @@ spec: type: object status: description: unused field - type: object + type: string type: object served: true storage: true diff --git a/operator/config/crd/bases/lifecycle.keptn.sh_keptnevaluationproviders.yaml b/lifecycle-operator/config/crd/bases/lifecycle.keptn.sh_keptnevaluationproviders.yaml similarity index 98% rename from operator/config/crd/bases/lifecycle.keptn.sh_keptnevaluationproviders.yaml rename to lifecycle-operator/config/crd/bases/lifecycle.keptn.sh_keptnevaluationproviders.yaml index 8360618cbf..0a416126b6 100644 --- a/operator/config/crd/bases/lifecycle.keptn.sh_keptnevaluationproviders.yaml +++ b/lifecycle-operator/config/crd/bases/lifecycle.keptn.sh_keptnevaluationproviders.yaml @@ -47,7 +47,7 @@ spec: type: object status: description: unused field - type: object + type: string type: object served: true storage: false @@ -100,7 +100,7 @@ spec: type: object status: description: unused field - type: object + type: string type: object served: true storage: false @@ -153,7 +153,7 @@ spec: type: object status: description: unused field - type: object + type: string type: object served: true storage: true diff --git a/operator/config/crd/bases/lifecycle.keptn.sh_keptnevaluations.yaml b/lifecycle-operator/config/crd/bases/lifecycle.keptn.sh_keptnevaluations.yaml similarity index 100% rename from operator/config/crd/bases/lifecycle.keptn.sh_keptnevaluations.yaml rename to lifecycle-operator/config/crd/bases/lifecycle.keptn.sh_keptnevaluations.yaml diff --git a/operator/config/crd/bases/lifecycle.keptn.sh_keptntaskdefinitions.yaml b/lifecycle-operator/config/crd/bases/lifecycle.keptn.sh_keptntaskdefinitions.yaml similarity index 100% rename from operator/config/crd/bases/lifecycle.keptn.sh_keptntaskdefinitions.yaml rename to lifecycle-operator/config/crd/bases/lifecycle.keptn.sh_keptntaskdefinitions.yaml diff --git a/operator/config/crd/bases/lifecycle.keptn.sh_keptntasks.yaml b/lifecycle-operator/config/crd/bases/lifecycle.keptn.sh_keptntasks.yaml similarity index 100% rename from operator/config/crd/bases/lifecycle.keptn.sh_keptntasks.yaml rename to lifecycle-operator/config/crd/bases/lifecycle.keptn.sh_keptntasks.yaml diff --git a/operator/config/crd/bases/lifecycle.keptn.sh_keptnworkloadinstances.yaml b/lifecycle-operator/config/crd/bases/lifecycle.keptn.sh_keptnworkloadinstances.yaml similarity index 100% rename from operator/config/crd/bases/lifecycle.keptn.sh_keptnworkloadinstances.yaml rename to lifecycle-operator/config/crd/bases/lifecycle.keptn.sh_keptnworkloadinstances.yaml diff --git a/operator/config/crd/bases/lifecycle.keptn.sh_keptnworkloads.yaml b/lifecycle-operator/config/crd/bases/lifecycle.keptn.sh_keptnworkloads.yaml similarity index 100% rename from operator/config/crd/bases/lifecycle.keptn.sh_keptnworkloads.yaml rename to lifecycle-operator/config/crd/bases/lifecycle.keptn.sh_keptnworkloads.yaml diff --git a/operator/config/crd/bases/options.keptn.sh_keptnconfigs.yaml b/lifecycle-operator/config/crd/bases/options.keptn.sh_keptnconfigs.yaml similarity index 95% rename from operator/config/crd/bases/options.keptn.sh_keptnconfigs.yaml rename to lifecycle-operator/config/crd/bases/options.keptn.sh_keptnconfigs.yaml index 240f70715c..c1a66a3c79 100644 --- a/operator/config/crd/bases/options.keptn.sh_keptnconfigs.yaml +++ b/lifecycle-operator/config/crd/bases/options.keptn.sh_keptnconfigs.yaml @@ -36,7 +36,7 @@ spec: properties: OTelCollectorUrl: description: OTelCollectorUrl can be used to set the Open Telemetry - collector that the operator should use + collector that the lifecycle operator should use type: string keptnAppCreationRequestTimeoutSeconds: default: 30 @@ -47,7 +47,7 @@ spec: type: object status: description: unused field - type: object + type: string type: object served: true storage: true diff --git a/operator/config/crd/kustomization.yaml b/lifecycle-operator/config/crd/kustomization.yaml similarity index 100% rename from operator/config/crd/kustomization.yaml rename to lifecycle-operator/config/crd/kustomization.yaml diff --git a/operator/config/crd/kustomizeconfig.yaml b/lifecycle-operator/config/crd/kustomizeconfig.yaml similarity index 100% rename from operator/config/crd/kustomizeconfig.yaml rename to lifecycle-operator/config/crd/kustomizeconfig.yaml diff --git a/operator/config/crd/patches/.gitignore b/lifecycle-operator/config/crd/patches/.gitignore similarity index 100% rename from operator/config/crd/patches/.gitignore rename to lifecycle-operator/config/crd/patches/.gitignore diff --git a/operator/config/crd/patches/webhook_in_lifecycle_keptnappcreationrequests.yaml b/lifecycle-operator/config/crd/patches/webhook_in_lifecycle_keptnappcreationrequests.yaml similarity index 100% rename from operator/config/crd/patches/webhook_in_lifecycle_keptnappcreationrequests.yaml rename to lifecycle-operator/config/crd/patches/webhook_in_lifecycle_keptnappcreationrequests.yaml diff --git a/operator/config/crd/patches/webhook_in_lifecycle_keptnapps.yaml b/lifecycle-operator/config/crd/patches/webhook_in_lifecycle_keptnapps.yaml similarity index 100% rename from operator/config/crd/patches/webhook_in_lifecycle_keptnapps.yaml rename to lifecycle-operator/config/crd/patches/webhook_in_lifecycle_keptnapps.yaml diff --git a/operator/config/crd/patches/webhook_in_lifecycle_keptnappversions.yaml b/lifecycle-operator/config/crd/patches/webhook_in_lifecycle_keptnappversions.yaml similarity index 100% rename from operator/config/crd/patches/webhook_in_lifecycle_keptnappversions.yaml rename to lifecycle-operator/config/crd/patches/webhook_in_lifecycle_keptnappversions.yaml diff --git a/operator/config/crd/patches/webhook_in_lifecycle_keptnevaluationdefinitions.yaml b/lifecycle-operator/config/crd/patches/webhook_in_lifecycle_keptnevaluationdefinitions.yaml similarity index 100% rename from operator/config/crd/patches/webhook_in_lifecycle_keptnevaluationdefinitions.yaml rename to lifecycle-operator/config/crd/patches/webhook_in_lifecycle_keptnevaluationdefinitions.yaml diff --git a/operator/config/crd/patches/webhook_in_lifecycle_keptnevaluationproviders.yaml b/lifecycle-operator/config/crd/patches/webhook_in_lifecycle_keptnevaluationproviders.yaml similarity index 100% rename from operator/config/crd/patches/webhook_in_lifecycle_keptnevaluationproviders.yaml rename to lifecycle-operator/config/crd/patches/webhook_in_lifecycle_keptnevaluationproviders.yaml diff --git a/operator/config/crd/patches/webhook_in_lifecycle_keptnevaluations.yaml b/lifecycle-operator/config/crd/patches/webhook_in_lifecycle_keptnevaluations.yaml similarity index 100% rename from operator/config/crd/patches/webhook_in_lifecycle_keptnevaluations.yaml rename to lifecycle-operator/config/crd/patches/webhook_in_lifecycle_keptnevaluations.yaml diff --git a/operator/config/crd/patches/webhook_in_lifecycle_keptntaskdefinitions.yaml b/lifecycle-operator/config/crd/patches/webhook_in_lifecycle_keptntaskdefinitions.yaml similarity index 100% rename from operator/config/crd/patches/webhook_in_lifecycle_keptntaskdefinitions.yaml rename to lifecycle-operator/config/crd/patches/webhook_in_lifecycle_keptntaskdefinitions.yaml diff --git a/operator/config/crd/patches/webhook_in_lifecycle_keptntasks.yaml b/lifecycle-operator/config/crd/patches/webhook_in_lifecycle_keptntasks.yaml similarity index 100% rename from operator/config/crd/patches/webhook_in_lifecycle_keptntasks.yaml rename to lifecycle-operator/config/crd/patches/webhook_in_lifecycle_keptntasks.yaml diff --git a/operator/config/crd/patches/webhook_in_lifecycle_keptnworkloadinstances.yaml b/lifecycle-operator/config/crd/patches/webhook_in_lifecycle_keptnworkloadinstances.yaml similarity index 100% rename from operator/config/crd/patches/webhook_in_lifecycle_keptnworkloadinstances.yaml rename to lifecycle-operator/config/crd/patches/webhook_in_lifecycle_keptnworkloadinstances.yaml diff --git a/operator/config/crd/patches/webhook_in_lifecycle_keptnworkloads.yaml b/lifecycle-operator/config/crd/patches/webhook_in_lifecycle_keptnworkloads.yaml similarity index 100% rename from operator/config/crd/patches/webhook_in_lifecycle_keptnworkloads.yaml rename to lifecycle-operator/config/crd/patches/webhook_in_lifecycle_keptnworkloads.yaml diff --git a/operator/config/crd/patches/webhook_in_options_keptnconfigs.yaml b/lifecycle-operator/config/crd/patches/webhook_in_options_keptnconfigs.yaml similarity index 100% rename from operator/config/crd/patches/webhook_in_options_keptnconfigs.yaml rename to lifecycle-operator/config/crd/patches/webhook_in_options_keptnconfigs.yaml diff --git a/operator/config/default/.gitignore b/lifecycle-operator/config/default/.gitignore similarity index 100% rename from operator/config/default/.gitignore rename to lifecycle-operator/config/default/.gitignore diff --git a/operator/config/default/kustomization.yaml b/lifecycle-operator/config/default/kustomization.yaml similarity index 100% rename from operator/config/default/kustomization.yaml rename to lifecycle-operator/config/default/kustomization.yaml diff --git a/operator/config/default/manager_webhook_patch.yaml b/lifecycle-operator/config/default/manager_webhook_patch.yaml similarity index 100% rename from operator/config/default/manager_webhook_patch.yaml rename to lifecycle-operator/config/default/manager_webhook_patch.yaml diff --git a/operator/config/default/webhooknamespaces_patch.yaml b/lifecycle-operator/config/default/webhooknamespaces_patch.yaml similarity index 85% rename from operator/config/default/webhooknamespaces_patch.yaml rename to lifecycle-operator/config/default/webhooknamespaces_patch.yaml index 6066f1f342..6b5655410a 100644 --- a/operator/config/default/webhooknamespaces_patch.yaml +++ b/lifecycle-operator/config/default/webhooknamespaces_patch.yaml @@ -5,7 +5,7 @@ metadata: name: lifecycle-mutating-webhook-configuration labels: app.kubernetes.io/part-of: keptn-lifecycle-toolkit -# Add an exclusion rule for the Mutating Webhook since the operator pod will not be able to start since it's waiting for +# Add an exclusion rule for the Mutating Webhook since the lifecycle-operator pod will not be able to start since it's waiting for # itself otherwise control-plane: controller-manager webhooks: - name: mpod.keptn.sh diff --git a/operator/config/manager/controller_manager_config.yaml b/lifecycle-operator/config/manager/controller_manager_config.yaml similarity index 100% rename from operator/config/manager/controller_manager_config.yaml rename to lifecycle-operator/config/manager/controller_manager_config.yaml diff --git a/operator/config/manager/kustomization.yaml b/lifecycle-operator/config/manager/kustomization.yaml similarity index 100% rename from operator/config/manager/kustomization.yaml rename to lifecycle-operator/config/manager/kustomization.yaml diff --git a/operator/config/manager/manager.yaml b/lifecycle-operator/config/manager/manager.yaml similarity index 100% rename from operator/config/manager/manager.yaml rename to lifecycle-operator/config/manager/manager.yaml diff --git a/operator/config/manager/service.yaml b/lifecycle-operator/config/manager/service.yaml similarity index 100% rename from operator/config/manager/service.yaml rename to lifecycle-operator/config/manager/service.yaml diff --git a/operator/config/rbac/extra_role_binding.yaml b/lifecycle-operator/config/rbac/extra_role_binding.yaml similarity index 100% rename from operator/config/rbac/extra_role_binding.yaml rename to lifecycle-operator/config/rbac/extra_role_binding.yaml diff --git a/operator/config/rbac/extra_roles.yaml b/lifecycle-operator/config/rbac/extra_roles.yaml similarity index 100% rename from operator/config/rbac/extra_roles.yaml rename to lifecycle-operator/config/rbac/extra_roles.yaml diff --git a/operator/config/rbac/keptnapp_editor_role.yaml b/lifecycle-operator/config/rbac/keptnapp_editor_role.yaml similarity index 100% rename from operator/config/rbac/keptnapp_editor_role.yaml rename to lifecycle-operator/config/rbac/keptnapp_editor_role.yaml diff --git a/operator/config/rbac/keptnapp_viewer_role.yaml b/lifecycle-operator/config/rbac/keptnapp_viewer_role.yaml similarity index 100% rename from operator/config/rbac/keptnapp_viewer_role.yaml rename to lifecycle-operator/config/rbac/keptnapp_viewer_role.yaml diff --git a/operator/config/rbac/keptnappversion_editor_role.yaml b/lifecycle-operator/config/rbac/keptnappversion_editor_role.yaml similarity index 100% rename from operator/config/rbac/keptnappversion_editor_role.yaml rename to lifecycle-operator/config/rbac/keptnappversion_editor_role.yaml diff --git a/operator/config/rbac/keptnappversion_viewer_role.yaml b/lifecycle-operator/config/rbac/keptnappversion_viewer_role.yaml similarity index 100% rename from operator/config/rbac/keptnappversion_viewer_role.yaml rename to lifecycle-operator/config/rbac/keptnappversion_viewer_role.yaml diff --git a/operator/config/rbac/keptnevaluation_editor_role.yaml b/lifecycle-operator/config/rbac/keptnevaluation_editor_role.yaml similarity index 100% rename from operator/config/rbac/keptnevaluation_editor_role.yaml rename to lifecycle-operator/config/rbac/keptnevaluation_editor_role.yaml diff --git a/operator/config/rbac/keptnevaluation_viewer_role.yaml b/lifecycle-operator/config/rbac/keptnevaluation_viewer_role.yaml similarity index 100% rename from operator/config/rbac/keptnevaluation_viewer_role.yaml rename to lifecycle-operator/config/rbac/keptnevaluation_viewer_role.yaml diff --git a/operator/config/rbac/keptnevaluationdefinition_editor_role.yaml b/lifecycle-operator/config/rbac/keptnevaluationdefinition_editor_role.yaml similarity index 100% rename from operator/config/rbac/keptnevaluationdefinition_editor_role.yaml rename to lifecycle-operator/config/rbac/keptnevaluationdefinition_editor_role.yaml diff --git a/operator/config/rbac/keptnevaluationdefinition_viewer_role.yaml b/lifecycle-operator/config/rbac/keptnevaluationdefinition_viewer_role.yaml similarity index 100% rename from operator/config/rbac/keptnevaluationdefinition_viewer_role.yaml rename to lifecycle-operator/config/rbac/keptnevaluationdefinition_viewer_role.yaml diff --git a/operator/config/rbac/keptntask_editor_role.yaml b/lifecycle-operator/config/rbac/keptntask_editor_role.yaml similarity index 100% rename from operator/config/rbac/keptntask_editor_role.yaml rename to lifecycle-operator/config/rbac/keptntask_editor_role.yaml diff --git a/operator/config/rbac/keptntask_viewer_role.yaml b/lifecycle-operator/config/rbac/keptntask_viewer_role.yaml similarity index 100% rename from operator/config/rbac/keptntask_viewer_role.yaml rename to lifecycle-operator/config/rbac/keptntask_viewer_role.yaml diff --git a/operator/config/rbac/keptntaskdefinition_editor_role.yaml b/lifecycle-operator/config/rbac/keptntaskdefinition_editor_role.yaml similarity index 100% rename from operator/config/rbac/keptntaskdefinition_editor_role.yaml rename to lifecycle-operator/config/rbac/keptntaskdefinition_editor_role.yaml diff --git a/operator/config/rbac/keptntaskdefinition_viewer_role.yaml b/lifecycle-operator/config/rbac/keptntaskdefinition_viewer_role.yaml similarity index 100% rename from operator/config/rbac/keptntaskdefinition_viewer_role.yaml rename to lifecycle-operator/config/rbac/keptntaskdefinition_viewer_role.yaml diff --git a/operator/config/rbac/keptnworkload_editor_role.yaml b/lifecycle-operator/config/rbac/keptnworkload_editor_role.yaml similarity index 100% rename from operator/config/rbac/keptnworkload_editor_role.yaml rename to lifecycle-operator/config/rbac/keptnworkload_editor_role.yaml diff --git a/operator/config/rbac/keptnworkload_viewer_role.yaml b/lifecycle-operator/config/rbac/keptnworkload_viewer_role.yaml similarity index 100% rename from operator/config/rbac/keptnworkload_viewer_role.yaml rename to lifecycle-operator/config/rbac/keptnworkload_viewer_role.yaml diff --git a/operator/config/rbac/keptnworkloadinstance_editor_role.yaml b/lifecycle-operator/config/rbac/keptnworkloadinstance_editor_role.yaml similarity index 100% rename from operator/config/rbac/keptnworkloadinstance_editor_role.yaml rename to lifecycle-operator/config/rbac/keptnworkloadinstance_editor_role.yaml diff --git a/operator/config/rbac/keptnworkloadinstance_viewer_role.yaml b/lifecycle-operator/config/rbac/keptnworkloadinstance_viewer_role.yaml similarity index 100% rename from operator/config/rbac/keptnworkloadinstance_viewer_role.yaml rename to lifecycle-operator/config/rbac/keptnworkloadinstance_viewer_role.yaml diff --git a/operator/config/rbac/kustomization.yaml b/lifecycle-operator/config/rbac/kustomization.yaml similarity index 100% rename from operator/config/rbac/kustomization.yaml rename to lifecycle-operator/config/rbac/kustomization.yaml diff --git a/operator/config/rbac/leader_election_role.yaml b/lifecycle-operator/config/rbac/leader_election_role.yaml similarity index 100% rename from operator/config/rbac/leader_election_role.yaml rename to lifecycle-operator/config/rbac/leader_election_role.yaml diff --git a/operator/config/rbac/leader_election_role_binding.yaml b/lifecycle-operator/config/rbac/leader_election_role_binding.yaml similarity index 100% rename from operator/config/rbac/leader_election_role_binding.yaml rename to lifecycle-operator/config/rbac/leader_election_role_binding.yaml diff --git a/operator/config/rbac/lifecycle_keptnapp_editor_role.yaml b/lifecycle-operator/config/rbac/lifecycle_keptnapp_editor_role.yaml similarity index 100% rename from operator/config/rbac/lifecycle_keptnapp_editor_role.yaml rename to lifecycle-operator/config/rbac/lifecycle_keptnapp_editor_role.yaml diff --git a/operator/config/rbac/lifecycle_keptnapp_viewer_role.yaml b/lifecycle-operator/config/rbac/lifecycle_keptnapp_viewer_role.yaml similarity index 100% rename from operator/config/rbac/lifecycle_keptnapp_viewer_role.yaml rename to lifecycle-operator/config/rbac/lifecycle_keptnapp_viewer_role.yaml diff --git a/operator/config/rbac/lifecycle_keptnappcreationrequest_editor_role.yaml b/lifecycle-operator/config/rbac/lifecycle_keptnappcreationrequest_editor_role.yaml similarity index 100% rename from operator/config/rbac/lifecycle_keptnappcreationrequest_editor_role.yaml rename to lifecycle-operator/config/rbac/lifecycle_keptnappcreationrequest_editor_role.yaml diff --git a/operator/config/rbac/lifecycle_keptnappcreationrequest_viewer_role.yaml b/lifecycle-operator/config/rbac/lifecycle_keptnappcreationrequest_viewer_role.yaml similarity index 100% rename from operator/config/rbac/lifecycle_keptnappcreationrequest_viewer_role.yaml rename to lifecycle-operator/config/rbac/lifecycle_keptnappcreationrequest_viewer_role.yaml diff --git a/operator/config/rbac/lifecycle_keptnappversion_editor_role.yaml b/lifecycle-operator/config/rbac/lifecycle_keptnappversion_editor_role.yaml similarity index 100% rename from operator/config/rbac/lifecycle_keptnappversion_editor_role.yaml rename to lifecycle-operator/config/rbac/lifecycle_keptnappversion_editor_role.yaml diff --git a/operator/config/rbac/lifecycle_keptnappversion_viewer_role.yaml b/lifecycle-operator/config/rbac/lifecycle_keptnappversion_viewer_role.yaml similarity index 100% rename from operator/config/rbac/lifecycle_keptnappversion_viewer_role.yaml rename to lifecycle-operator/config/rbac/lifecycle_keptnappversion_viewer_role.yaml diff --git a/operator/config/rbac/lifecycle_keptnevaluation_editor_role.yaml b/lifecycle-operator/config/rbac/lifecycle_keptnevaluation_editor_role.yaml similarity index 100% rename from operator/config/rbac/lifecycle_keptnevaluation_editor_role.yaml rename to lifecycle-operator/config/rbac/lifecycle_keptnevaluation_editor_role.yaml diff --git a/operator/config/rbac/lifecycle_keptnevaluation_viewer_role.yaml b/lifecycle-operator/config/rbac/lifecycle_keptnevaluation_viewer_role.yaml similarity index 100% rename from operator/config/rbac/lifecycle_keptnevaluation_viewer_role.yaml rename to lifecycle-operator/config/rbac/lifecycle_keptnevaluation_viewer_role.yaml diff --git a/operator/config/rbac/lifecycle_keptnevaluationdefinition_editor_role.yaml b/lifecycle-operator/config/rbac/lifecycle_keptnevaluationdefinition_editor_role.yaml similarity index 100% rename from operator/config/rbac/lifecycle_keptnevaluationdefinition_editor_role.yaml rename to lifecycle-operator/config/rbac/lifecycle_keptnevaluationdefinition_editor_role.yaml diff --git a/operator/config/rbac/lifecycle_keptnevaluationdefinition_viewer_role.yaml b/lifecycle-operator/config/rbac/lifecycle_keptnevaluationdefinition_viewer_role.yaml similarity index 100% rename from operator/config/rbac/lifecycle_keptnevaluationdefinition_viewer_role.yaml rename to lifecycle-operator/config/rbac/lifecycle_keptnevaluationdefinition_viewer_role.yaml diff --git a/operator/config/rbac/lifecycle_keptnevaluationprovider_editor_role.yaml b/lifecycle-operator/config/rbac/lifecycle_keptnevaluationprovider_editor_role.yaml similarity index 100% rename from operator/config/rbac/lifecycle_keptnevaluationprovider_editor_role.yaml rename to lifecycle-operator/config/rbac/lifecycle_keptnevaluationprovider_editor_role.yaml diff --git a/operator/config/rbac/lifecycle_keptnevaluationprovider_viewer_role.yaml b/lifecycle-operator/config/rbac/lifecycle_keptnevaluationprovider_viewer_role.yaml similarity index 100% rename from operator/config/rbac/lifecycle_keptnevaluationprovider_viewer_role.yaml rename to lifecycle-operator/config/rbac/lifecycle_keptnevaluationprovider_viewer_role.yaml diff --git a/operator/config/rbac/lifecycle_keptntask_editor_role.yaml b/lifecycle-operator/config/rbac/lifecycle_keptntask_editor_role.yaml similarity index 100% rename from operator/config/rbac/lifecycle_keptntask_editor_role.yaml rename to lifecycle-operator/config/rbac/lifecycle_keptntask_editor_role.yaml diff --git a/operator/config/rbac/lifecycle_keptntask_viewer_role.yaml b/lifecycle-operator/config/rbac/lifecycle_keptntask_viewer_role.yaml similarity index 100% rename from operator/config/rbac/lifecycle_keptntask_viewer_role.yaml rename to lifecycle-operator/config/rbac/lifecycle_keptntask_viewer_role.yaml diff --git a/operator/config/rbac/lifecycle_keptntaskdefinition_editor_role.yaml b/lifecycle-operator/config/rbac/lifecycle_keptntaskdefinition_editor_role.yaml similarity index 100% rename from operator/config/rbac/lifecycle_keptntaskdefinition_editor_role.yaml rename to lifecycle-operator/config/rbac/lifecycle_keptntaskdefinition_editor_role.yaml diff --git a/operator/config/rbac/lifecycle_keptntaskdefinition_viewer_role.yaml b/lifecycle-operator/config/rbac/lifecycle_keptntaskdefinition_viewer_role.yaml similarity index 100% rename from operator/config/rbac/lifecycle_keptntaskdefinition_viewer_role.yaml rename to lifecycle-operator/config/rbac/lifecycle_keptntaskdefinition_viewer_role.yaml diff --git a/operator/config/rbac/lifecycle_keptnworkload_editor_role.yaml b/lifecycle-operator/config/rbac/lifecycle_keptnworkload_editor_role.yaml similarity index 100% rename from operator/config/rbac/lifecycle_keptnworkload_editor_role.yaml rename to lifecycle-operator/config/rbac/lifecycle_keptnworkload_editor_role.yaml diff --git a/operator/config/rbac/lifecycle_keptnworkload_viewer_role.yaml b/lifecycle-operator/config/rbac/lifecycle_keptnworkload_viewer_role.yaml similarity index 100% rename from operator/config/rbac/lifecycle_keptnworkload_viewer_role.yaml rename to lifecycle-operator/config/rbac/lifecycle_keptnworkload_viewer_role.yaml diff --git a/operator/config/rbac/lifecycle_keptnworkloadinstance_editor_role.yaml b/lifecycle-operator/config/rbac/lifecycle_keptnworkloadinstance_editor_role.yaml similarity index 100% rename from operator/config/rbac/lifecycle_keptnworkloadinstance_editor_role.yaml rename to lifecycle-operator/config/rbac/lifecycle_keptnworkloadinstance_editor_role.yaml diff --git a/operator/config/rbac/lifecycle_keptnworkloadinstance_viewer_role.yaml b/lifecycle-operator/config/rbac/lifecycle_keptnworkloadinstance_viewer_role.yaml similarity index 100% rename from operator/config/rbac/lifecycle_keptnworkloadinstance_viewer_role.yaml rename to lifecycle-operator/config/rbac/lifecycle_keptnworkloadinstance_viewer_role.yaml diff --git a/operator/config/rbac/options_keptnconfig_editor_role.yaml b/lifecycle-operator/config/rbac/options_keptnconfig_editor_role.yaml similarity index 100% rename from operator/config/rbac/options_keptnconfig_editor_role.yaml rename to lifecycle-operator/config/rbac/options_keptnconfig_editor_role.yaml diff --git a/operator/config/rbac/options_keptnconfig_viewer_role.yaml b/lifecycle-operator/config/rbac/options_keptnconfig_viewer_role.yaml similarity index 100% rename from operator/config/rbac/options_keptnconfig_viewer_role.yaml rename to lifecycle-operator/config/rbac/options_keptnconfig_viewer_role.yaml diff --git a/operator/config/rbac/role.yaml b/lifecycle-operator/config/rbac/role.yaml similarity index 100% rename from operator/config/rbac/role.yaml rename to lifecycle-operator/config/rbac/role.yaml diff --git a/operator/config/rbac/role_binding.yaml b/lifecycle-operator/config/rbac/role_binding.yaml similarity index 100% rename from operator/config/rbac/role_binding.yaml rename to lifecycle-operator/config/rbac/role_binding.yaml diff --git a/operator/config/rbac/service_account.yaml b/lifecycle-operator/config/rbac/service_account.yaml similarity index 100% rename from operator/config/rbac/service_account.yaml rename to lifecycle-operator/config/rbac/service_account.yaml diff --git a/operator/config/rendered/.gitkeep b/lifecycle-operator/config/rendered/.gitkeep similarity index 100% rename from operator/config/rendered/.gitkeep rename to lifecycle-operator/config/rendered/.gitkeep diff --git a/operator/config/samples/deployment.yaml b/lifecycle-operator/config/samples/deployment.yaml similarity index 100% rename from operator/config/samples/deployment.yaml rename to lifecycle-operator/config/samples/deployment.yaml diff --git a/operator/config/samples/function_execution/task_schedule.yaml b/lifecycle-operator/config/samples/function_execution/task_schedule.yaml similarity index 100% rename from operator/config/samples/function_execution/task_schedule.yaml rename to lifecycle-operator/config/samples/function_execution/task_schedule.yaml diff --git a/operator/config/samples/function_execution/task_slack.yaml b/lifecycle-operator/config/samples/function_execution/task_slack.yaml similarity index 100% rename from operator/config/samples/function_execution/task_slack.yaml rename to lifecycle-operator/config/samples/function_execution/task_slack.yaml diff --git a/operator/config/samples/function_execution/taskdefinition_function.yaml b/lifecycle-operator/config/samples/function_execution/taskdefinition_function.yaml similarity index 100% rename from operator/config/samples/function_execution/taskdefinition_function.yaml rename to lifecycle-operator/config/samples/function_execution/taskdefinition_function.yaml diff --git a/operator/config/samples/function_execution/taskdefinition_function_configmap.yaml b/lifecycle-operator/config/samples/function_execution/taskdefinition_function_configmap.yaml similarity index 100% rename from operator/config/samples/function_execution/taskdefinition_function_configmap.yaml rename to lifecycle-operator/config/samples/function_execution/taskdefinition_function_configmap.yaml diff --git a/operator/config/samples/function_execution/taskdefinition_function_inline.yaml b/lifecycle-operator/config/samples/function_execution/taskdefinition_function_inline.yaml similarity index 100% rename from operator/config/samples/function_execution/taskdefinition_function_inline.yaml rename to lifecycle-operator/config/samples/function_execution/taskdefinition_function_inline.yaml diff --git a/operator/config/samples/function_execution/taskdefinition_function_inline_slack.yaml b/lifecycle-operator/config/samples/function_execution/taskdefinition_function_inline_slack.yaml similarity index 100% rename from operator/config/samples/function_execution/taskdefinition_function_inline_slack.yaml rename to lifecycle-operator/config/samples/function_execution/taskdefinition_function_inline_slack.yaml diff --git a/operator/config/samples/function_execution/taskdefinition_function_upstream.yaml b/lifecycle-operator/config/samples/function_execution/taskdefinition_function_upstream.yaml similarity index 100% rename from operator/config/samples/function_execution/taskdefinition_function_upstream.yaml rename to lifecycle-operator/config/samples/function_execution/taskdefinition_function_upstream.yaml diff --git a/operator/config/samples/function_execution/taskdefinition_function_upstream_scheduler.yaml b/lifecycle-operator/config/samples/function_execution/taskdefinition_function_upstream_scheduler.yaml similarity index 100% rename from operator/config/samples/function_execution/taskdefinition_function_upstream_scheduler.yaml rename to lifecycle-operator/config/samples/function_execution/taskdefinition_function_upstream_scheduler.yaml diff --git a/operator/config/samples/function_execution/taskdefinition_function_upstream_slack.yaml b/lifecycle-operator/config/samples/function_execution/taskdefinition_function_upstream_slack.yaml similarity index 100% rename from operator/config/samples/function_execution/taskdefinition_function_upstream_slack.yaml rename to lifecycle-operator/config/samples/function_execution/taskdefinition_function_upstream_slack.yaml diff --git a/operator/config/samples/lifecycle_v1alpha1_keptnapp.yaml b/lifecycle-operator/config/samples/lifecycle_v1alpha1_keptnapp.yaml similarity index 100% rename from operator/config/samples/lifecycle_v1alpha1_keptnapp.yaml rename to lifecycle-operator/config/samples/lifecycle_v1alpha1_keptnapp.yaml diff --git a/operator/config/samples/lifecycle_v1alpha1_keptnappversion.yaml b/lifecycle-operator/config/samples/lifecycle_v1alpha1_keptnappversion.yaml similarity index 100% rename from operator/config/samples/lifecycle_v1alpha1_keptnappversion.yaml rename to lifecycle-operator/config/samples/lifecycle_v1alpha1_keptnappversion.yaml diff --git a/operator/config/samples/lifecycle_v1alpha1_keptnevaluation.yaml b/lifecycle-operator/config/samples/lifecycle_v1alpha1_keptnevaluation.yaml similarity index 100% rename from operator/config/samples/lifecycle_v1alpha1_keptnevaluation.yaml rename to lifecycle-operator/config/samples/lifecycle_v1alpha1_keptnevaluation.yaml diff --git a/operator/config/samples/lifecycle_v1alpha1_keptnevaluationdefinition.yaml b/lifecycle-operator/config/samples/lifecycle_v1alpha1_keptnevaluationdefinition.yaml similarity index 100% rename from operator/config/samples/lifecycle_v1alpha1_keptnevaluationdefinition.yaml rename to lifecycle-operator/config/samples/lifecycle_v1alpha1_keptnevaluationdefinition.yaml diff --git a/operator/config/samples/lifecycle_v1alpha1_keptnevaluationprovider.yaml b/lifecycle-operator/config/samples/lifecycle_v1alpha1_keptnevaluationprovider.yaml similarity index 100% rename from operator/config/samples/lifecycle_v1alpha1_keptnevaluationprovider.yaml rename to lifecycle-operator/config/samples/lifecycle_v1alpha1_keptnevaluationprovider.yaml diff --git a/operator/config/samples/lifecycle_v1alpha1_keptntask.yaml b/lifecycle-operator/config/samples/lifecycle_v1alpha1_keptntask.yaml similarity index 100% rename from operator/config/samples/lifecycle_v1alpha1_keptntask.yaml rename to lifecycle-operator/config/samples/lifecycle_v1alpha1_keptntask.yaml diff --git a/operator/config/samples/lifecycle_v1alpha1_keptntaskdefinition.yaml b/lifecycle-operator/config/samples/lifecycle_v1alpha1_keptntaskdefinition.yaml similarity index 100% rename from operator/config/samples/lifecycle_v1alpha1_keptntaskdefinition.yaml rename to lifecycle-operator/config/samples/lifecycle_v1alpha1_keptntaskdefinition.yaml diff --git a/operator/config/samples/lifecycle_v1alpha1_keptnworkload.yaml b/lifecycle-operator/config/samples/lifecycle_v1alpha1_keptnworkload.yaml similarity index 100% rename from operator/config/samples/lifecycle_v1alpha1_keptnworkload.yaml rename to lifecycle-operator/config/samples/lifecycle_v1alpha1_keptnworkload.yaml diff --git a/operator/config/samples/lifecycle_v1alpha1_keptnworkloadinstance.yaml b/lifecycle-operator/config/samples/lifecycle_v1alpha1_keptnworkloadinstance.yaml similarity index 100% rename from operator/config/samples/lifecycle_v1alpha1_keptnworkloadinstance.yaml rename to lifecycle-operator/config/samples/lifecycle_v1alpha1_keptnworkloadinstance.yaml diff --git a/operator/config/samples/lifecycle_v1alpha2_keptnapp.yaml b/lifecycle-operator/config/samples/lifecycle_v1alpha2_keptnapp.yaml similarity index 100% rename from operator/config/samples/lifecycle_v1alpha2_keptnapp.yaml rename to lifecycle-operator/config/samples/lifecycle_v1alpha2_keptnapp.yaml diff --git a/operator/config/samples/lifecycle_v1alpha2_keptnappversion.yaml b/lifecycle-operator/config/samples/lifecycle_v1alpha2_keptnappversion.yaml similarity index 100% rename from operator/config/samples/lifecycle_v1alpha2_keptnappversion.yaml rename to lifecycle-operator/config/samples/lifecycle_v1alpha2_keptnappversion.yaml diff --git a/operator/config/samples/lifecycle_v1alpha2_keptnevaluation.yaml b/lifecycle-operator/config/samples/lifecycle_v1alpha2_keptnevaluation.yaml similarity index 100% rename from operator/config/samples/lifecycle_v1alpha2_keptnevaluation.yaml rename to lifecycle-operator/config/samples/lifecycle_v1alpha2_keptnevaluation.yaml diff --git a/operator/config/samples/lifecycle_v1alpha2_keptnevaluationdefinition.yaml b/lifecycle-operator/config/samples/lifecycle_v1alpha2_keptnevaluationdefinition.yaml similarity index 100% rename from operator/config/samples/lifecycle_v1alpha2_keptnevaluationdefinition.yaml rename to lifecycle-operator/config/samples/lifecycle_v1alpha2_keptnevaluationdefinition.yaml diff --git a/operator/config/samples/lifecycle_v1alpha2_keptnevaluationprovider.yaml b/lifecycle-operator/config/samples/lifecycle_v1alpha2_keptnevaluationprovider.yaml similarity index 100% rename from operator/config/samples/lifecycle_v1alpha2_keptnevaluationprovider.yaml rename to lifecycle-operator/config/samples/lifecycle_v1alpha2_keptnevaluationprovider.yaml diff --git a/operator/config/samples/lifecycle_v1alpha2_keptntask.yaml b/lifecycle-operator/config/samples/lifecycle_v1alpha2_keptntask.yaml similarity index 100% rename from operator/config/samples/lifecycle_v1alpha2_keptntask.yaml rename to lifecycle-operator/config/samples/lifecycle_v1alpha2_keptntask.yaml diff --git a/operator/config/samples/lifecycle_v1alpha2_keptntaskdefinition.yaml b/lifecycle-operator/config/samples/lifecycle_v1alpha2_keptntaskdefinition.yaml similarity index 100% rename from operator/config/samples/lifecycle_v1alpha2_keptntaskdefinition.yaml rename to lifecycle-operator/config/samples/lifecycle_v1alpha2_keptntaskdefinition.yaml diff --git a/operator/config/samples/lifecycle_v1alpha2_keptnworkload.yaml b/lifecycle-operator/config/samples/lifecycle_v1alpha2_keptnworkload.yaml similarity index 100% rename from operator/config/samples/lifecycle_v1alpha2_keptnworkload.yaml rename to lifecycle-operator/config/samples/lifecycle_v1alpha2_keptnworkload.yaml diff --git a/operator/config/samples/lifecycle_v1alpha2_keptnworkloadinstance.yaml b/lifecycle-operator/config/samples/lifecycle_v1alpha2_keptnworkloadinstance.yaml similarity index 100% rename from operator/config/samples/lifecycle_v1alpha2_keptnworkloadinstance.yaml rename to lifecycle-operator/config/samples/lifecycle_v1alpha2_keptnworkloadinstance.yaml diff --git a/operator/config/samples/lifecycle_v1alpha3_keptnapp.yaml b/lifecycle-operator/config/samples/lifecycle_v1alpha3_keptnapp.yaml similarity index 100% rename from operator/config/samples/lifecycle_v1alpha3_keptnapp.yaml rename to lifecycle-operator/config/samples/lifecycle_v1alpha3_keptnapp.yaml diff --git a/operator/config/samples/lifecycle_v1alpha3_keptnappcreationrequest.yaml b/lifecycle-operator/config/samples/lifecycle_v1alpha3_keptnappcreationrequest.yaml similarity index 100% rename from operator/config/samples/lifecycle_v1alpha3_keptnappcreationrequest.yaml rename to lifecycle-operator/config/samples/lifecycle_v1alpha3_keptnappcreationrequest.yaml diff --git a/operator/config/samples/lifecycle_v1alpha3_keptnappversion.yaml b/lifecycle-operator/config/samples/lifecycle_v1alpha3_keptnappversion.yaml similarity index 100% rename from operator/config/samples/lifecycle_v1alpha3_keptnappversion.yaml rename to lifecycle-operator/config/samples/lifecycle_v1alpha3_keptnappversion.yaml diff --git a/operator/config/samples/lifecycle_v1alpha3_keptnevaluation.yaml b/lifecycle-operator/config/samples/lifecycle_v1alpha3_keptnevaluation.yaml similarity index 100% rename from operator/config/samples/lifecycle_v1alpha3_keptnevaluation.yaml rename to lifecycle-operator/config/samples/lifecycle_v1alpha3_keptnevaluation.yaml diff --git a/operator/config/samples/lifecycle_v1alpha3_keptnevaluationdefinition.yaml b/lifecycle-operator/config/samples/lifecycle_v1alpha3_keptnevaluationdefinition.yaml similarity index 100% rename from operator/config/samples/lifecycle_v1alpha3_keptnevaluationdefinition.yaml rename to lifecycle-operator/config/samples/lifecycle_v1alpha3_keptnevaluationdefinition.yaml diff --git a/operator/config/samples/lifecycle_v1alpha3_keptnevaluationprovider.yaml b/lifecycle-operator/config/samples/lifecycle_v1alpha3_keptnevaluationprovider.yaml similarity index 100% rename from operator/config/samples/lifecycle_v1alpha3_keptnevaluationprovider.yaml rename to lifecycle-operator/config/samples/lifecycle_v1alpha3_keptnevaluationprovider.yaml diff --git a/operator/config/samples/lifecycle_v1alpha3_keptntask.yaml b/lifecycle-operator/config/samples/lifecycle_v1alpha3_keptntask.yaml similarity index 100% rename from operator/config/samples/lifecycle_v1alpha3_keptntask.yaml rename to lifecycle-operator/config/samples/lifecycle_v1alpha3_keptntask.yaml diff --git a/operator/config/samples/lifecycle_v1alpha3_keptntaskdefinition_container.yaml b/lifecycle-operator/config/samples/lifecycle_v1alpha3_keptntaskdefinition_container.yaml similarity index 100% rename from operator/config/samples/lifecycle_v1alpha3_keptntaskdefinition_container.yaml rename to lifecycle-operator/config/samples/lifecycle_v1alpha3_keptntaskdefinition_container.yaml diff --git a/operator/config/samples/lifecycle_v1alpha3_keptntaskdefinition_js.yaml b/lifecycle-operator/config/samples/lifecycle_v1alpha3_keptntaskdefinition_js.yaml similarity index 100% rename from operator/config/samples/lifecycle_v1alpha3_keptntaskdefinition_js.yaml rename to lifecycle-operator/config/samples/lifecycle_v1alpha3_keptntaskdefinition_js.yaml diff --git a/operator/config/samples/lifecycle_v1alpha3_keptnworkload.yaml b/lifecycle-operator/config/samples/lifecycle_v1alpha3_keptnworkload.yaml similarity index 100% rename from operator/config/samples/lifecycle_v1alpha3_keptnworkload.yaml rename to lifecycle-operator/config/samples/lifecycle_v1alpha3_keptnworkload.yaml diff --git a/operator/config/samples/lifecycle_v1alpha3_keptnworkloadinstance.yaml b/lifecycle-operator/config/samples/lifecycle_v1alpha3_keptnworkloadinstance.yaml similarity index 100% rename from operator/config/samples/lifecycle_v1alpha3_keptnworkloadinstance.yaml rename to lifecycle-operator/config/samples/lifecycle_v1alpha3_keptnworkloadinstance.yaml diff --git a/operator/config/samples/options_v1alpha1_keptnconfig.yaml b/lifecycle-operator/config/samples/options_v1alpha1_keptnconfig.yaml similarity index 100% rename from operator/config/samples/options_v1alpha1_keptnconfig.yaml rename to lifecycle-operator/config/samples/options_v1alpha1_keptnconfig.yaml diff --git a/operator/config/samples/python_execution/taskdefinition_pyfunction_configmap.yaml b/lifecycle-operator/config/samples/python_execution/taskdefinition_pyfunction_configmap.yaml similarity index 100% rename from operator/config/samples/python_execution/taskdefinition_pyfunction_configmap.yaml rename to lifecycle-operator/config/samples/python_execution/taskdefinition_pyfunction_configmap.yaml diff --git a/operator/config/samples/python_execution/taskdefinition_pyfunction_inline.yaml b/lifecycle-operator/config/samples/python_execution/taskdefinition_pyfunction_inline.yaml similarity index 100% rename from operator/config/samples/python_execution/taskdefinition_pyfunction_inline.yaml rename to lifecycle-operator/config/samples/python_execution/taskdefinition_pyfunction_inline.yaml diff --git a/operator/config/samples/python_execution/taskdefinition_pyfunction_inline_printargs_py.yaml b/lifecycle-operator/config/samples/python_execution/taskdefinition_pyfunction_inline_printargs_py.yaml similarity index 100% rename from operator/config/samples/python_execution/taskdefinition_pyfunction_inline_printargs_py.yaml rename to lifecycle-operator/config/samples/python_execution/taskdefinition_pyfunction_inline_printargs_py.yaml diff --git a/operator/config/samples/python_execution/taskdefinition_pyfunction_recursive.yaml b/lifecycle-operator/config/samples/python_execution/taskdefinition_pyfunction_recursive.yaml similarity index 100% rename from operator/config/samples/python_execution/taskdefinition_pyfunction_recursive.yaml rename to lifecycle-operator/config/samples/python_execution/taskdefinition_pyfunction_recursive.yaml diff --git a/operator/config/samples/python_execution/taskdefinition_pyfunction_upstream_hellopy.yaml b/lifecycle-operator/config/samples/python_execution/taskdefinition_pyfunction_upstream_hellopy.yaml similarity index 100% rename from operator/config/samples/python_execution/taskdefinition_pyfunction_upstream_hellopy.yaml rename to lifecycle-operator/config/samples/python_execution/taskdefinition_pyfunction_upstream_hellopy.yaml diff --git a/operator/config/samples/python_execution/taskdefinition_pyfunction_use_envvars.yaml b/lifecycle-operator/config/samples/python_execution/taskdefinition_pyfunction_use_envvars.yaml similarity index 100% rename from operator/config/samples/python_execution/taskdefinition_pyfunction_use_envvars.yaml rename to lifecycle-operator/config/samples/python_execution/taskdefinition_pyfunction_use_envvars.yaml diff --git a/operator/config/webhook/kustomization.yaml b/lifecycle-operator/config/webhook/kustomization.yaml similarity index 100% rename from operator/config/webhook/kustomization.yaml rename to lifecycle-operator/config/webhook/kustomization.yaml diff --git a/operator/config/webhook/kustomizeconfig.yaml b/lifecycle-operator/config/webhook/kustomizeconfig.yaml similarity index 100% rename from operator/config/webhook/kustomizeconfig.yaml rename to lifecycle-operator/config/webhook/kustomizeconfig.yaml diff --git a/operator/config/webhook/manifests.yaml b/lifecycle-operator/config/webhook/manifests.yaml similarity index 100% rename from operator/config/webhook/manifests.yaml rename to lifecycle-operator/config/webhook/manifests.yaml diff --git a/operator/config/webhook/service.yaml b/lifecycle-operator/config/webhook/service.yaml similarity index 100% rename from operator/config/webhook/service.yaml rename to lifecycle-operator/config/webhook/service.yaml diff --git a/operator/controllers/common/config/config.go b/lifecycle-operator/controllers/common/config/config.go similarity index 100% rename from operator/controllers/common/config/config.go rename to lifecycle-operator/controllers/common/config/config.go diff --git a/operator/controllers/common/config/config_test.go b/lifecycle-operator/controllers/common/config/config_test.go similarity index 100% rename from operator/controllers/common/config/config_test.go rename to lifecycle-operator/controllers/common/config/config_test.go diff --git a/operator/controllers/common/config/fake/config_mock.go b/lifecycle-operator/controllers/common/config/fake/config_mock.go similarity index 100% rename from operator/controllers/common/config/fake/config_mock.go rename to lifecycle-operator/controllers/common/config/fake/config_mock.go diff --git a/operator/controllers/common/evaluationhandler.go b/lifecycle-operator/controllers/common/evaluationhandler.go similarity index 86% rename from operator/controllers/common/evaluationhandler.go rename to lifecycle-operator/controllers/common/evaluationhandler.go index 78148b01a7..fa264546c8 100644 --- a/operator/controllers/common/evaluationhandler.go +++ b/lifecycle-operator/controllers/common/evaluationhandler.go @@ -6,10 +6,11 @@ import ( "time" "github.com/go-logr/logr" - klcv1alpha3 "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3" - apicommon "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3/common" - controllererrors "github.com/keptn/lifecycle-toolkit/operator/controllers/errors" - "github.com/keptn/lifecycle-toolkit/operator/controllers/lifecycle/interfaces" + klcv1alpha3 "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3" + apicommon "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3/common" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/controllers/common/telemetry" + controllererrors "github.com/keptn/lifecycle-toolkit/lifecycle-operator/controllers/errors" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/controllers/lifecycle/interfaces" "go.opentelemetry.io/otel/codes" "go.opentelemetry.io/otel/trace" "k8s.io/apimachinery/pkg/api/errors" @@ -21,11 +22,11 @@ import ( type EvaluationHandler struct { client.Client - EventSender EventSender + EventSender IEvent Log logr.Logger Tracer trace.Tracer Scheme *runtime.Scheme - SpanHandler ISpanHandler + SpanHandler telemetry.ISpanHandler } type CreateEvaluationAttributes struct { @@ -55,7 +56,7 @@ func (r EvaluationHandler) ReconcileEvaluations(ctx context.Context, phaseCtx co evaluationExists := false if oldstatus != evaluationStatus.Status { - r.EventSender.SendK8sEvent(apicommon.PhaseReconcileEvaluation, "Normal", reconcileObject, apicommon.PhaseStateStatusChanged, fmt.Sprintf("evaluation status changed from %s to %s", oldstatus, evaluationStatus.Status), piWrapper.GetVersion()) + r.EventSender.Emit(apicommon.PhaseReconcileEvaluation, "Normal", reconcileObject, apicommon.PhaseStateStatusChanged, fmt.Sprintf("evaluation status changed from %s to %s", oldstatus, evaluationStatus.Status), piWrapper.GetVersion()) } // Check if evaluation has already succeeded or failed @@ -126,7 +127,7 @@ func (r EvaluationHandler) CreateKeptnEvaluation(ctx context.Context, namespace err = r.Client.Create(ctx, &newEvaluation) if err != nil { r.Log.Error(err, "could not create KeptnEvaluation") - r.EventSender.SendK8sEvent(phase, "Warning", reconcileObject, apicommon.PhaseStateFailed, "could not create KeptnEvaluation", piWrapper.GetVersion()) + r.EventSender.Emit(phase, "Warning", reconcileObject, apicommon.PhaseStateFailed, "could not create KeptnEvaluation", piWrapper.GetVersion()) return "", err } @@ -142,7 +143,7 @@ func (r EvaluationHandler) emitEvaluationFailureEvents(evaluation *klcv1alpha3.K k8sEventMessage = fmt.Sprintf("%s\n%s", k8sEventMessage, msg) } } - r.EventSender.SendK8sEvent(apicommon.PhaseReconcileEvaluation, "Warning", evaluation, apicommon.PhaseStateFailed, k8sEventMessage, piWrapper.GetVersion()) + r.EventSender.Emit(apicommon.PhaseReconcileEvaluation, "Warning", evaluation, apicommon.PhaseStateFailed, k8sEventMessage, piWrapper.GetVersion()) } func (r EvaluationHandler) setupEvaluations(evaluationCreateAttributes CreateEvaluationAttributes, piWrapper *interfaces.PhaseItemWrapper) ([]string, []klcv1alpha3.ItemStatus) { diff --git a/operator/controllers/common/evaluationhandler_test.go b/lifecycle-operator/controllers/common/evaluationhandler_test.go similarity index 96% rename from operator/controllers/common/evaluationhandler_test.go rename to lifecycle-operator/controllers/common/evaluationhandler_test.go index 9f2394620a..74242b0af5 100644 --- a/operator/controllers/common/evaluationhandler_test.go +++ b/lifecycle-operator/controllers/common/evaluationhandler_test.go @@ -6,10 +6,10 @@ import ( "strings" "testing" - "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3" - apicommon "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3/common" - kltfake "github.com/keptn/lifecycle-toolkit/operator/controllers/common/fake" - controllererrors "github.com/keptn/lifecycle-toolkit/operator/controllers/errors" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3" + apicommon "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3/common" + kltfake "github.com/keptn/lifecycle-toolkit/lifecycle-operator/controllers/common/fake" + controllererrors "github.com/keptn/lifecycle-toolkit/lifecycle-operator/controllers/errors" "github.com/stretchr/testify/require" "go.opentelemetry.io/otel/trace" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" diff --git a/lifecycle-operator/controllers/common/eventsender.go b/lifecycle-operator/controllers/common/eventsender.go new file mode 100644 index 0000000000..b9fa76b5f5 --- /dev/null +++ b/lifecycle-operator/controllers/common/eventsender.go @@ -0,0 +1,42 @@ +package common + +import ( + "fmt" + + apicommon "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3/common" + "k8s.io/client-go/tools/record" + "sigs.k8s.io/controller-runtime/pkg/client" +) + +//go:generate moq -pkg fake -skip-ensure -out ./fake/event_mock.go . IEvent:MockEvent +type IEvent interface { + Emit(phase apicommon.KeptnPhaseType, eventType string, reconcileObject client.Object, status string, message string, version string) +} + +// ===== Main ===== + +func NewEventSender(recorder record.EventRecorder) IEvent { + return newK8sSender(recorder) +} + +// ===== Cloud Event Sender ===== +// TODO: implement Cloud Event logic + +// ===== K8s Event Sender ===== + +type k8sEvent struct { + recorder record.EventRecorder +} + +func newK8sSender(recorder record.EventRecorder) IEvent { + return &k8sEvent{ + recorder: recorder, + } +} + +// SendEvent creates k8s Event and adds it to Eventqueue +func (s *k8sEvent) Emit(phase apicommon.KeptnPhaseType, eventType string, reconcileObject client.Object, status string, message string, version string) { + msg := setEventMessage(phase, reconcileObject, message, version) + annotations := setAnnotations(reconcileObject, phase) + s.recorder.AnnotatedEventf(reconcileObject, annotations, eventType, fmt.Sprintf("%s%s", phase.ShortName, status), msg) +} diff --git a/operator/controllers/common/eventsender_test.go b/lifecycle-operator/controllers/common/eventsender_test.go similarity index 64% rename from operator/controllers/common/eventsender_test.go rename to lifecycle-operator/controllers/common/eventsender_test.go index 9f2138690d..2b8285ea29 100644 --- a/operator/controllers/common/eventsender_test.go +++ b/lifecycle-operator/controllers/common/eventsender_test.go @@ -4,8 +4,8 @@ import ( "fmt" "testing" - "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3" - "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3/common" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3/common" "github.com/stretchr/testify/require" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/client-go/tools/record" @@ -13,9 +13,9 @@ import ( func TestEventSender_SendK8sEvent(t *testing.T) { fakeRecorder := record.NewFakeRecorder(100) - eventSender := NewEventSender(fakeRecorder) + eventSender := newK8sSender(fakeRecorder) - eventSender.SendK8sEvent(common.PhaseAppDeployment, "pre-event", &v1alpha3.KeptnAppVersion{ + eventSender.Emit(common.PhaseAppDeployment, "pre-event", &v1alpha3.KeptnAppVersion{ ObjectMeta: v1.ObjectMeta{ Name: "app", Namespace: "ns", diff --git a/operator/controllers/common/fake/fakeclient.go b/lifecycle-operator/controllers/common/fake/fakeclient.go similarity index 83% rename from operator/controllers/common/fake/fakeclient.go rename to lifecycle-operator/controllers/common/fake/fakeclient.go index 7e911bcb8f..1b5e48eaf7 100644 --- a/operator/controllers/common/fake/fakeclient.go +++ b/lifecycle-operator/controllers/common/fake/fakeclient.go @@ -1,8 +1,8 @@ package fake import ( - lfcv1alpha3 "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3" - optionsv1alpha1 "github.com/keptn/lifecycle-toolkit/operator/apis/options/v1alpha1" + lfcv1alpha3 "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3" + optionsv1alpha1 "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/options/v1alpha1" corev1 "k8s.io/api/core/v1" apiv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" utilruntime "k8s.io/apimachinery/pkg/util/runtime" diff --git a/operator/controllers/common/fake/spanhandler_mock.go b/lifecycle-operator/controllers/common/fake/spanhandler_mock.go similarity index 100% rename from operator/controllers/common/fake/spanhandler_mock.go rename to lifecycle-operator/controllers/common/fake/spanhandler_mock.go diff --git a/operator/controllers/common/fake/tracer_mock.go b/lifecycle-operator/controllers/common/fake/tracer_mock.go similarity index 100% rename from operator/controllers/common/fake/tracer_mock.go rename to lifecycle-operator/controllers/common/fake/tracer_mock.go diff --git a/operator/controllers/common/fake/tracerfactory_mock.go b/lifecycle-operator/controllers/common/fake/tracerfactory_mock.go similarity index 100% rename from operator/controllers/common/fake/tracerfactory_mock.go rename to lifecycle-operator/controllers/common/fake/tracerfactory_mock.go diff --git a/operator/controllers/common/helperfunctions.go b/lifecycle-operator/controllers/common/helperfunctions.go similarity index 93% rename from operator/controllers/common/helperfunctions.go rename to lifecycle-operator/controllers/common/helperfunctions.go index cc9002c24c..333f0be7d2 100644 --- a/operator/controllers/common/helperfunctions.go +++ b/lifecycle-operator/controllers/common/helperfunctions.go @@ -5,9 +5,9 @@ import ( "fmt" "github.com/go-logr/logr" - klcv1alpha3 "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3" - apicommon "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3/common" - "github.com/keptn/lifecycle-toolkit/operator/controllers/lifecycle/interfaces" + klcv1alpha3 "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3" + apicommon "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3/common" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/controllers/lifecycle/interfaces" k8serrors "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/types" "sigs.k8s.io/controller-runtime/pkg/client" diff --git a/operator/controllers/common/helperfunctions_test.go b/lifecycle-operator/controllers/common/helperfunctions_test.go similarity index 98% rename from operator/controllers/common/helperfunctions_test.go rename to lifecycle-operator/controllers/common/helperfunctions_test.go index 33126e8810..3393c9c49d 100644 --- a/operator/controllers/common/helperfunctions_test.go +++ b/lifecycle-operator/controllers/common/helperfunctions_test.go @@ -4,8 +4,8 @@ import ( "context" "testing" - klcv1alpha3 "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3" - apicommon "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3/common" + klcv1alpha3 "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3" + apicommon "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3/common" "github.com/stretchr/testify/require" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/client-go/kubernetes/scheme" diff --git a/operator/controllers/common/phasehandler.go b/lifecycle-operator/controllers/common/phasehandler.go similarity index 79% rename from operator/controllers/common/phasehandler.go rename to lifecycle-operator/controllers/common/phasehandler.go index 4fe8b77158..3ca5ce5c46 100644 --- a/operator/controllers/common/phasehandler.go +++ b/lifecycle-operator/controllers/common/phasehandler.go @@ -5,9 +5,10 @@ import ( "time" "github.com/go-logr/logr" - apicommon "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3/common" - controllererrors "github.com/keptn/lifecycle-toolkit/operator/controllers/errors" - "github.com/keptn/lifecycle-toolkit/operator/controllers/lifecycle/interfaces" + apicommon "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3/common" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/controllers/common/telemetry" + controllererrors "github.com/keptn/lifecycle-toolkit/lifecycle-operator/controllers/errors" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/controllers/lifecycle/interfaces" "go.opentelemetry.io/otel/codes" "go.opentelemetry.io/otel/trace" ctrl "sigs.k8s.io/controller-runtime" @@ -16,9 +17,9 @@ import ( type PhaseHandler struct { client.Client - EventSender EventSender + EventSender IEvent Log logr.Logger - SpanHandler ISpanHandler + SpanHandler telemetry.ISpanHandler } type PhaseResult struct { @@ -39,7 +40,7 @@ func (r PhaseHandler) HandlePhase(ctx context.Context, ctxTrace context.Context, return &PhaseResult{Continue: false, Result: ctrl.Result{}}, nil } if oldPhase != phase.ShortName { - r.EventSender.SendK8sEvent(phase, "Normal", reconcileObject, apicommon.PhaseStateStarted, "has started", piWrapper.GetVersion()) + r.EventSender.Emit(phase, "Normal", reconcileObject, apicommon.PhaseStateStarted, "has started", piWrapper.GetVersion()) piWrapper.SetCurrentPhase(phase.ShortName) } @@ -51,7 +52,7 @@ func (r PhaseHandler) HandlePhase(ctx context.Context, ctxTrace context.Context, state, err := reconcilePhase(spanPhaseCtx) if err != nil { spanPhaseTrace.AddEvent(phase.LongName + " could not get reconciled") - r.EventSender.SendK8sEvent(phase, "Warning", reconcileObject, apicommon.PhaseStateReconcileError, "could not get reconciled", piWrapper.GetVersion()) + r.EventSender.Emit(phase, "Warning", reconcileObject, apicommon.PhaseStateReconcileError, "could not get reconciled", piWrapper.GetVersion()) span.SetStatus(codes.Error, err.Error()) return &PhaseResult{Continue: false, Result: requeueResult}, err } @@ -88,7 +89,7 @@ func (r PhaseHandler) handleCompletedPhase(state apicommon.KeptnState, piWrapper if err := r.SpanHandler.UnbindSpan(reconcileObject, phase.ShortName); err != nil { r.Log.Error(err, controllererrors.ErrCouldNotUnbindSpan, reconcileObject.GetName()) } - r.EventSender.SendK8sEvent(phase, "Warning", reconcileObject, apicommon.PhaseStateFailed, "has failed", piWrapper.GetVersion()) + r.EventSender.Emit(phase, "Warning", reconcileObject, apicommon.PhaseStateFailed, "has failed", piWrapper.GetVersion()) piWrapper.DeprecateRemainingPhases(phase) return &PhaseResult{Continue: false, Result: ctrl.Result{}}, nil } @@ -100,7 +101,7 @@ func (r PhaseHandler) handleCompletedPhase(state apicommon.KeptnState, piWrapper if err := r.SpanHandler.UnbindSpan(reconcileObject, phase.ShortName); err != nil { r.Log.Error(err, controllererrors.ErrCouldNotUnbindSpan, reconcileObject.GetName()) } - r.EventSender.SendK8sEvent(phase, "Normal", reconcileObject, apicommon.PhaseStateFinished, "has finished", piWrapper.GetVersion()) + r.EventSender.Emit(phase, "Normal", reconcileObject, apicommon.PhaseStateFinished, "has finished", piWrapper.GetVersion()) return &PhaseResult{Continue: true, Result: ctrl.Result{Requeue: true, RequeueAfter: 5 * time.Second}}, nil } diff --git a/operator/controllers/common/phasehandler_test.go b/lifecycle-operator/controllers/common/phasehandler_test.go similarity index 92% rename from operator/controllers/common/phasehandler_test.go rename to lifecycle-operator/controllers/common/phasehandler_test.go index 3ab592b814..09a73d0ba6 100644 --- a/operator/controllers/common/phasehandler_test.go +++ b/lifecycle-operator/controllers/common/phasehandler_test.go @@ -6,8 +6,9 @@ import ( "testing" "time" - "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3" - apicommon "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3/common" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3" + apicommon "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3/common" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/controllers/common/telemetry" "github.com/stretchr/testify/require" "go.opentelemetry.io/otel/trace" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -33,7 +34,7 @@ func TestPhaseHandler(t *testing.T) { { name: "deprecated", handler: PhaseHandler{ - SpanHandler: &SpanHandler{}, + SpanHandler: &telemetry.SpanHandler{}, }, object: &v1alpha3.KeptnAppVersion{ Status: v1alpha3.KeptnAppVersionStatus{ @@ -51,7 +52,7 @@ func TestPhaseHandler(t *testing.T) { { name: "reconcilePhase error", handler: PhaseHandler{ - SpanHandler: &SpanHandler{}, + SpanHandler: &telemetry.SpanHandler{}, Log: ctrl.Log.WithName("controller"), EventSender: NewEventSender(record.NewFakeRecorder(100)), Client: fake.NewClientBuilder().WithScheme(scheme.Scheme).Build(), @@ -78,7 +79,7 @@ func TestPhaseHandler(t *testing.T) { { name: "reconcilePhase pending state", handler: PhaseHandler{ - SpanHandler: &SpanHandler{}, + SpanHandler: &telemetry.SpanHandler{}, Log: ctrl.Log.WithName("controller"), EventSender: NewEventSender(record.NewFakeRecorder(100)), Client: fake.NewClientBuilder().WithScheme(scheme.Scheme).Build(), @@ -105,7 +106,7 @@ func TestPhaseHandler(t *testing.T) { { name: "reconcilePhase progressing state", handler: PhaseHandler{ - SpanHandler: &SpanHandler{}, + SpanHandler: &telemetry.SpanHandler{}, Log: ctrl.Log.WithName("controller"), EventSender: NewEventSender(record.NewFakeRecorder(100)), Client: fake.NewClientBuilder().WithScheme(scheme.Scheme).Build(), @@ -132,7 +133,7 @@ func TestPhaseHandler(t *testing.T) { { name: "reconcilePhase succeeded state", handler: PhaseHandler{ - SpanHandler: &SpanHandler{}, + SpanHandler: &telemetry.SpanHandler{}, Log: ctrl.Log.WithName("controller"), EventSender: NewEventSender(record.NewFakeRecorder(100)), Client: fake.NewClientBuilder().WithScheme(scheme.Scheme).Build(), @@ -159,7 +160,7 @@ func TestPhaseHandler(t *testing.T) { { name: "reconcilePhase failed state", handler: PhaseHandler{ - SpanHandler: &SpanHandler{}, + SpanHandler: &telemetry.SpanHandler{}, Log: ctrl.Log.WithName("controller"), EventSender: NewEventSender(record.NewFakeRecorder(100)), Client: fake.NewClientBuilder().WithScheme(scheme.Scheme).Build(), @@ -187,7 +188,7 @@ func TestPhaseHandler(t *testing.T) { { name: "reconcilePhase unknown state", handler: PhaseHandler{ - SpanHandler: &SpanHandler{}, + SpanHandler: &telemetry.SpanHandler{}, Log: ctrl.Log.WithName("controller"), EventSender: NewEventSender(record.NewFakeRecorder(100)), Client: fake.NewClientBuilder().WithScheme(scheme.Scheme).Build(), diff --git a/operator/controllers/common/providers/common.go b/lifecycle-operator/controllers/common/providers/common.go similarity index 100% rename from operator/controllers/common/providers/common.go rename to lifecycle-operator/controllers/common/providers/common.go diff --git a/operator/controllers/common/providers/keptnmetric/keptnmetric.go b/lifecycle-operator/controllers/common/providers/keptnmetric/keptnmetric.go similarity index 93% rename from operator/controllers/common/providers/keptnmetric/keptnmetric.go rename to lifecycle-operator/controllers/common/providers/keptnmetric/keptnmetric.go index 8212fb9af7..5baf001e0e 100644 --- a/operator/controllers/common/providers/keptnmetric/keptnmetric.go +++ b/lifecycle-operator/controllers/common/providers/keptnmetric/keptnmetric.go @@ -5,8 +5,8 @@ import ( "fmt" "github.com/go-logr/logr" - klcv1alpha3 "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3" - "github.com/keptn/lifecycle-toolkit/operator/controllers/common" + klcv1alpha3 "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/controllers/common" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apimachinery/pkg/types" "sigs.k8s.io/controller-runtime/pkg/client" diff --git a/operator/controllers/common/providers/keptnmetric/keptnmetric_test.go b/lifecycle-operator/controllers/common/providers/keptnmetric/keptnmetric_test.go similarity index 94% rename from operator/controllers/common/providers/keptnmetric/keptnmetric_test.go rename to lifecycle-operator/controllers/common/providers/keptnmetric/keptnmetric_test.go index 51152b9487..2383097343 100644 --- a/operator/controllers/common/providers/keptnmetric/keptnmetric_test.go +++ b/lifecycle-operator/controllers/common/providers/keptnmetric/keptnmetric_test.go @@ -4,9 +4,9 @@ import ( "context" "testing" - klcv1alpha3 "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3" - "github.com/keptn/lifecycle-toolkit/operator/controllers/common" - metricsapi "github.com/keptn/lifecycle-toolkit/operator/test/api/metrics/v1alpha3" + klcv1alpha3 "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/controllers/common" + metricsapi "github.com/keptn/lifecycle-toolkit/lifecycle-operator/test/api/metrics/v1alpha3" "github.com/stretchr/testify/require" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" @@ -95,7 +95,7 @@ func Test_keptnmetric(t *testing.T) { r, _, e := kmp.FetchData(context.TODO(), obj, "default") require.Equal(t, tt.out, r) - //require.Equal(t, tt.outraw, raw) + // require.Equal(t, tt.outraw, raw) if tt.wantError != (e != nil) { t.Errorf("want error: %t, got: %v", tt.wantError, e) } diff --git a/operator/controllers/common/taskdefinitionhandler.go b/lifecycle-operator/controllers/common/taskdefinitionhandler.go similarity index 92% rename from operator/controllers/common/taskdefinitionhandler.go rename to lifecycle-operator/controllers/common/taskdefinitionhandler.go index 2ff69b63a6..d744aff584 100644 --- a/operator/controllers/common/taskdefinitionhandler.go +++ b/lifecycle-operator/controllers/common/taskdefinitionhandler.go @@ -4,8 +4,8 @@ import ( "os" "reflect" - klcv1alpha3 "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3" - apicommon "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3/common" + klcv1alpha3 "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3" + apicommon "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3/common" ) const ( diff --git a/operator/controllers/common/taskdefinitionhandler_test.go b/lifecycle-operator/controllers/common/taskdefinitionhandler_test.go similarity index 99% rename from operator/controllers/common/taskdefinitionhandler_test.go rename to lifecycle-operator/controllers/common/taskdefinitionhandler_test.go index f1cab3b329..9fe9eb9699 100644 --- a/operator/controllers/common/taskdefinitionhandler_test.go +++ b/lifecycle-operator/controllers/common/taskdefinitionhandler_test.go @@ -4,7 +4,7 @@ import ( "reflect" "testing" - klcv1alpha3 "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3" + klcv1alpha3 "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3" "github.com/stretchr/testify/require" corev1 "k8s.io/api/core/v1" ) diff --git a/operator/controllers/common/taskhandler.go b/lifecycle-operator/controllers/common/taskhandler.go similarity index 88% rename from operator/controllers/common/taskhandler.go rename to lifecycle-operator/controllers/common/taskhandler.go index eaf790fe8a..63da8745af 100644 --- a/operator/controllers/common/taskhandler.go +++ b/lifecycle-operator/controllers/common/taskhandler.go @@ -6,10 +6,11 @@ import ( "time" "github.com/go-logr/logr" - klcv1alpha3 "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3" - apicommon "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3/common" - controllererrors "github.com/keptn/lifecycle-toolkit/operator/controllers/errors" - "github.com/keptn/lifecycle-toolkit/operator/controllers/lifecycle/interfaces" + klcv1alpha3 "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3" + apicommon "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3/common" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/controllers/common/telemetry" + controllererrors "github.com/keptn/lifecycle-toolkit/lifecycle-operator/controllers/errors" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/controllers/lifecycle/interfaces" "go.opentelemetry.io/otel/codes" "go.opentelemetry.io/otel/trace" "k8s.io/apimachinery/pkg/api/errors" @@ -21,11 +22,11 @@ import ( type TaskHandler struct { client.Client - EventSender EventSender + EventSender IEvent Log logr.Logger Tracer trace.Tracer Scheme *runtime.Scheme - SpanHandler ISpanHandler + SpanHandler telemetry.ISpanHandler } type CreateTaskAttributes struct { @@ -57,7 +58,7 @@ func (r TaskHandler) ReconcileTasks(ctx context.Context, phaseCtx context.Contex taskExists := false if oldstatus != taskStatus.Status { - r.EventSender.SendK8sEvent(phase, "Normal", reconcileObject, apicommon.PhaseStateStatusChanged, fmt.Sprintf("task status changed from %s to %s", oldstatus, taskStatus.Status), piWrapper.GetVersion()) + r.EventSender.Emit(phase, "Normal", reconcileObject, apicommon.PhaseStateStatusChanged, fmt.Sprintf("task status changed from %s to %s", oldstatus, taskStatus.Status), piWrapper.GetVersion()) } // Check if task has already succeeded or failed @@ -130,7 +131,7 @@ func (r TaskHandler) CreateKeptnTask(ctx context.Context, namespace string, reco err = r.Client.Create(ctx, &newTask) if err != nil { r.Log.Error(err, "could not create KeptnTask") - r.EventSender.SendK8sEvent(phase, "Warning", reconcileObject, apicommon.PhaseStateFailed, "could not create KeptnTask", piWrapper.GetVersion()) + r.EventSender.Emit(phase, "Warning", reconcileObject, apicommon.PhaseStateFailed, "could not create KeptnTask", piWrapper.GetVersion()) return "", err } diff --git a/operator/controllers/common/taskhandler_test.go b/lifecycle-operator/controllers/common/taskhandler_test.go similarity index 97% rename from operator/controllers/common/taskhandler_test.go rename to lifecycle-operator/controllers/common/taskhandler_test.go index 285865fdfc..37dad2bf52 100644 --- a/operator/controllers/common/taskhandler_test.go +++ b/lifecycle-operator/controllers/common/taskhandler_test.go @@ -5,10 +5,10 @@ import ( "strings" "testing" - "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3" - apicommon "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3/common" - kltfake "github.com/keptn/lifecycle-toolkit/operator/controllers/common/fake" - controllererrors "github.com/keptn/lifecycle-toolkit/operator/controllers/errors" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3" + apicommon "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3/common" + kltfake "github.com/keptn/lifecycle-toolkit/lifecycle-operator/controllers/common/fake" + controllererrors "github.com/keptn/lifecycle-toolkit/lifecycle-operator/controllers/errors" "github.com/stretchr/testify/require" "go.opentelemetry.io/otel/trace" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" diff --git a/operator/controllers/common/metrics.go b/lifecycle-operator/controllers/common/telemetry/metrics.go similarity index 94% rename from operator/controllers/common/metrics.go rename to lifecycle-operator/controllers/common/telemetry/metrics.go index 298a4b8f78..d96358beec 100644 --- a/operator/controllers/common/metrics.go +++ b/lifecycle-operator/controllers/common/telemetry/metrics.go @@ -1,12 +1,12 @@ -package common +package telemetry import ( "context" "fmt" "strings" - controllererrors "github.com/keptn/lifecycle-toolkit/operator/controllers/errors" - "github.com/keptn/lifecycle-toolkit/operator/controllers/lifecycle/interfaces" + controllererrors "github.com/keptn/lifecycle-toolkit/lifecycle-operator/controllers/errors" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/controllers/lifecycle/interfaces" "go.opentelemetry.io/otel/metric" "sigs.k8s.io/controller-runtime/pkg/client" ) diff --git a/operator/controllers/common/metrics_test.go b/lifecycle-operator/controllers/common/telemetry/metrics_test.go similarity index 97% rename from operator/controllers/common/metrics_test.go rename to lifecycle-operator/controllers/common/telemetry/metrics_test.go index 4bfcfb46f1..3f6ec0bc3e 100644 --- a/operator/controllers/common/metrics_test.go +++ b/lifecycle-operator/controllers/common/telemetry/metrics_test.go @@ -1,13 +1,13 @@ -package common +package telemetry import ( "context" "testing" "time" - lifecyclev1alpha3 "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3" - controllererrors "github.com/keptn/lifecycle-toolkit/operator/controllers/errors" - "github.com/keptn/lifecycle-toolkit/operator/controllers/lifecycle/interfaces" + lifecyclev1alpha3 "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3" + controllererrors "github.com/keptn/lifecycle-toolkit/lifecycle-operator/controllers/errors" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/controllers/lifecycle/interfaces" "github.com/stretchr/testify/require" "go.opentelemetry.io/otel/metric" "go.opentelemetry.io/otel/metric/noop" diff --git a/operator/controllers/common/otel_utils.go b/lifecycle-operator/controllers/common/telemetry/otel_utils.go similarity index 97% rename from operator/controllers/common/otel_utils.go rename to lifecycle-operator/controllers/common/telemetry/otel_utils.go index ef255d830c..abaf933477 100644 --- a/operator/controllers/common/otel_utils.go +++ b/lifecycle-operator/controllers/common/telemetry/otel_utils.go @@ -1,4 +1,4 @@ -package common +package telemetry import ( "context" @@ -7,9 +7,9 @@ import ( "sync" "time" - lifecyclev1alpha3 "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3" - "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3/common" - "github.com/keptn/lifecycle-toolkit/operator/controllers/lifecycle/interfaces" + lifecyclev1alpha3 "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3/common" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/controllers/lifecycle/interfaces" "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc" "go.opentelemetry.io/otel/exporters/stdout/stdouttrace" diff --git a/operator/controllers/common/otel_utils_test.go b/lifecycle-operator/controllers/common/telemetry/otel_utils_test.go similarity index 96% rename from operator/controllers/common/otel_utils_test.go rename to lifecycle-operator/controllers/common/telemetry/otel_utils_test.go index d85cbd58dc..a8d9aa6875 100644 --- a/operator/controllers/common/otel_utils_test.go +++ b/lifecycle-operator/controllers/common/telemetry/otel_utils_test.go @@ -1,11 +1,11 @@ -package common +package telemetry import ( "net" "testing" - "github.com/keptn/lifecycle-toolkit/operator/controllers/lifecycle/interfaces" - "github.com/keptn/lifecycle-toolkit/operator/controllers/lifecycle/interfaces/fake" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/controllers/lifecycle/interfaces" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/controllers/lifecycle/interfaces/fake" "github.com/pkg/errors" "github.com/stretchr/testify/require" "go.opentelemetry.io/otel/metric" @@ -64,7 +64,7 @@ func TestGetOTelTracerProviderOptions(t *testing.T) { } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - //TODO also test underline return + // TODO also test underline return got, _, err := GetOTelTracerProviderOptions(tt.args.oTelCollectorUrl) if (err != nil) != tt.wantErr { t.Errorf("GetOTelTracerProviderOptions() error = %v, wantErr %v", err, tt.wantErr) diff --git a/operator/controllers/common/spanhandler.go b/lifecycle-operator/controllers/common/telemetry/spanhandler.go similarity index 94% rename from operator/controllers/common/spanhandler.go rename to lifecycle-operator/controllers/common/telemetry/spanhandler.go index f45887ac37..ae6342e7e6 100644 --- a/operator/controllers/common/spanhandler.go +++ b/lifecycle-operator/controllers/common/telemetry/spanhandler.go @@ -1,10 +1,10 @@ -package common +package telemetry import ( "context" "sync" - "github.com/keptn/lifecycle-toolkit/operator/controllers/lifecycle/interfaces" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/controllers/lifecycle/interfaces" "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/propagation" "go.opentelemetry.io/otel/trace" diff --git a/operator/controllers/common/spanhandler_test.go b/lifecycle-operator/controllers/common/telemetry/spanhandler_test.go similarity index 92% rename from operator/controllers/common/spanhandler_test.go rename to lifecycle-operator/controllers/common/telemetry/spanhandler_test.go index aba47cec2f..e9d491a732 100644 --- a/operator/controllers/common/spanhandler_test.go +++ b/lifecycle-operator/controllers/common/telemetry/spanhandler_test.go @@ -1,11 +1,11 @@ -package common +package telemetry import ( "context" "testing" - "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3" - apicommon "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3/common" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3" + apicommon "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3/common" "github.com/stretchr/testify/require" "go.opentelemetry.io/otel" "sigs.k8s.io/controller-runtime/pkg/client" diff --git a/operator/controllers/common/tracer.go b/lifecycle-operator/controllers/common/telemetry/tracer.go similarity index 94% rename from operator/controllers/common/tracer.go rename to lifecycle-operator/controllers/common/telemetry/tracer.go index 4fda3a5a96..6c86418830 100644 --- a/operator/controllers/common/tracer.go +++ b/lifecycle-operator/controllers/common/telemetry/tracer.go @@ -1,4 +1,4 @@ -package common +package telemetry import "go.opentelemetry.io/otel/trace" diff --git a/operator/controllers/common/test_utils.go b/lifecycle-operator/controllers/common/test_utils.go similarity index 93% rename from operator/controllers/common/test_utils.go rename to lifecycle-operator/controllers/common/test_utils.go index 6ec5dfd62c..3cd124b1ef 100644 --- a/operator/controllers/common/test_utils.go +++ b/lifecycle-operator/controllers/common/test_utils.go @@ -4,8 +4,8 @@ import ( "context" "fmt" - lfcv1alpha3 "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3" - apicommon "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3/common" + lfcv1alpha3 "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3" + apicommon "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3/common" "go.opentelemetry.io/otel/metric" sdkmetric "go.opentelemetry.io/otel/sdk/metric" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" diff --git a/operator/controllers/errors/errors.go b/lifecycle-operator/controllers/errors/errors.go similarity index 100% rename from operator/controllers/errors/errors.go rename to lifecycle-operator/controllers/errors/errors.go diff --git a/operator/controllers/lifecycle/interfaces/activemetricsobject.go b/lifecycle-operator/controllers/lifecycle/interfaces/activemetricsobject.go similarity index 92% rename from operator/controllers/lifecycle/interfaces/activemetricsobject.go rename to lifecycle-operator/controllers/lifecycle/interfaces/activemetricsobject.go index c75263ae49..d16eb33311 100644 --- a/operator/controllers/lifecycle/interfaces/activemetricsobject.go +++ b/lifecycle-operator/controllers/lifecycle/interfaces/activemetricsobject.go @@ -1,7 +1,7 @@ package interfaces import ( - "github.com/keptn/lifecycle-toolkit/operator/controllers/errors" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/controllers/errors" "go.opentelemetry.io/otel/attribute" "sigs.k8s.io/controller-runtime/pkg/client" ) diff --git a/operator/controllers/lifecycle/interfaces/activemetricsobject_test.go b/lifecycle-operator/controllers/lifecycle/interfaces/activemetricsobject_test.go similarity index 78% rename from operator/controllers/lifecycle/interfaces/activemetricsobject_test.go rename to lifecycle-operator/controllers/lifecycle/interfaces/activemetricsobject_test.go index d0bb0543a7..f14fb8ba50 100644 --- a/operator/controllers/lifecycle/interfaces/activemetricsobject_test.go +++ b/lifecycle-operator/controllers/lifecycle/interfaces/activemetricsobject_test.go @@ -3,9 +3,9 @@ package interfaces import ( "testing" - "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3" - apicommon "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3/common" - "github.com/keptn/lifecycle-toolkit/operator/controllers/lifecycle/interfaces/fake" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3" + apicommon "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3/common" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/controllers/lifecycle/interfaces/fake" "github.com/stretchr/testify/require" "go.opentelemetry.io/otel/attribute" ) diff --git a/operator/controllers/lifecycle/interfaces/controller.go b/lifecycle-operator/controllers/lifecycle/interfaces/controller.go similarity index 100% rename from operator/controllers/lifecycle/interfaces/controller.go rename to lifecycle-operator/controllers/lifecycle/interfaces/controller.go diff --git a/operator/controllers/lifecycle/interfaces/eventobject.go b/lifecycle-operator/controllers/lifecycle/interfaces/eventobject.go similarity index 90% rename from operator/controllers/lifecycle/interfaces/eventobject.go rename to lifecycle-operator/controllers/lifecycle/interfaces/eventobject.go index 43f5f8f8bc..b2732cae77 100644 --- a/operator/controllers/lifecycle/interfaces/eventobject.go +++ b/lifecycle-operator/controllers/lifecycle/interfaces/eventobject.go @@ -1,7 +1,7 @@ package interfaces import ( - "github.com/keptn/lifecycle-toolkit/operator/controllers/errors" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/controllers/errors" "sigs.k8s.io/controller-runtime/pkg/client" ) diff --git a/operator/controllers/lifecycle/interfaces/eventobject_test.go b/lifecycle-operator/controllers/lifecycle/interfaces/eventobject_test.go similarity index 72% rename from operator/controllers/lifecycle/interfaces/eventobject_test.go rename to lifecycle-operator/controllers/lifecycle/interfaces/eventobject_test.go index be6ee7c0e6..20ff4d82f0 100644 --- a/operator/controllers/lifecycle/interfaces/eventobject_test.go +++ b/lifecycle-operator/controllers/lifecycle/interfaces/eventobject_test.go @@ -3,9 +3,9 @@ package interfaces import ( "testing" - "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3" - apicommon "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3/common" - "github.com/keptn/lifecycle-toolkit/operator/controllers/lifecycle/interfaces/fake" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3" + apicommon "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3/common" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/controllers/lifecycle/interfaces/fake" "github.com/stretchr/testify/require" ) diff --git a/operator/controllers/lifecycle/interfaces/fake/activemetricsobject_mock.go b/lifecycle-operator/controllers/lifecycle/interfaces/fake/activemetricsobject_mock.go similarity index 100% rename from operator/controllers/lifecycle/interfaces/fake/activemetricsobject_mock.go rename to lifecycle-operator/controllers/lifecycle/interfaces/fake/activemetricsobject_mock.go diff --git a/operator/controllers/lifecycle/interfaces/fake/eventobject_mock.go b/lifecycle-operator/controllers/lifecycle/interfaces/fake/eventobject_mock.go similarity index 100% rename from operator/controllers/lifecycle/interfaces/fake/eventobject_mock.go rename to lifecycle-operator/controllers/lifecycle/interfaces/fake/eventobject_mock.go diff --git a/operator/controllers/lifecycle/interfaces/fake/listitem_mock.go b/lifecycle-operator/controllers/lifecycle/interfaces/fake/listitem_mock.go similarity index 100% rename from operator/controllers/lifecycle/interfaces/fake/listitem_mock.go rename to lifecycle-operator/controllers/lifecycle/interfaces/fake/listitem_mock.go diff --git a/operator/controllers/lifecycle/interfaces/fake/meter_mock.go b/lifecycle-operator/controllers/lifecycle/interfaces/fake/meter_mock.go similarity index 100% rename from operator/controllers/lifecycle/interfaces/fake/meter_mock.go rename to lifecycle-operator/controllers/lifecycle/interfaces/fake/meter_mock.go diff --git a/operator/controllers/lifecycle/interfaces/fake/metricsobject_mock.go b/lifecycle-operator/controllers/lifecycle/interfaces/fake/metricsobject_mock.go similarity index 100% rename from operator/controllers/lifecycle/interfaces/fake/metricsobject_mock.go rename to lifecycle-operator/controllers/lifecycle/interfaces/fake/metricsobject_mock.go diff --git a/operator/controllers/lifecycle/interfaces/fake/phaseitem_mock.go b/lifecycle-operator/controllers/lifecycle/interfaces/fake/phaseitem_mock.go similarity index 99% rename from operator/controllers/lifecycle/interfaces/fake/phaseitem_mock.go rename to lifecycle-operator/controllers/lifecycle/interfaces/fake/phaseitem_mock.go index 55cb514a1b..2393116cca 100644 --- a/operator/controllers/lifecycle/interfaces/fake/phaseitem_mock.go +++ b/lifecycle-operator/controllers/lifecycle/interfaces/fake/phaseitem_mock.go @@ -4,8 +4,8 @@ package fake import ( - klcv1alpha3 "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3" - apicommon "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3/common" + klcv1alpha3 "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3" + apicommon "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3/common" "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/trace" "sync" diff --git a/operator/controllers/lifecycle/interfaces/fake/spanitem_mock.go b/lifecycle-operator/controllers/lifecycle/interfaces/fake/spanitem_mock.go similarity index 100% rename from operator/controllers/lifecycle/interfaces/fake/spanitem_mock.go rename to lifecycle-operator/controllers/lifecycle/interfaces/fake/spanitem_mock.go diff --git a/operator/controllers/lifecycle/interfaces/listitem.go b/lifecycle-operator/controllers/lifecycle/interfaces/listitem.go similarity index 88% rename from operator/controllers/lifecycle/interfaces/listitem.go rename to lifecycle-operator/controllers/lifecycle/interfaces/listitem.go index ada924123f..45dc896402 100644 --- a/operator/controllers/lifecycle/interfaces/listitem.go +++ b/lifecycle-operator/controllers/lifecycle/interfaces/listitem.go @@ -1,7 +1,7 @@ package interfaces import ( - "github.com/keptn/lifecycle-toolkit/operator/controllers/errors" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/controllers/errors" "sigs.k8s.io/controller-runtime/pkg/client" ) diff --git a/operator/controllers/lifecycle/interfaces/listitem_test.go b/lifecycle-operator/controllers/lifecycle/interfaces/listitem_test.go similarity index 74% rename from operator/controllers/lifecycle/interfaces/listitem_test.go rename to lifecycle-operator/controllers/lifecycle/interfaces/listitem_test.go index e7a0eeb3e1..c4a775f4a8 100644 --- a/operator/controllers/lifecycle/interfaces/listitem_test.go +++ b/lifecycle-operator/controllers/lifecycle/interfaces/listitem_test.go @@ -3,9 +3,9 @@ package interfaces import ( "testing" - "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3" - apicommon "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3/common" - "github.com/keptn/lifecycle-toolkit/operator/controllers/lifecycle/interfaces/fake" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3" + apicommon "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3/common" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/controllers/lifecycle/interfaces/fake" "github.com/stretchr/testify/require" "sigs.k8s.io/controller-runtime/pkg/client" ) diff --git a/operator/controllers/lifecycle/interfaces/meter.go b/lifecycle-operator/controllers/lifecycle/interfaces/meter.go similarity index 100% rename from operator/controllers/lifecycle/interfaces/meter.go rename to lifecycle-operator/controllers/lifecycle/interfaces/meter.go diff --git a/operator/controllers/lifecycle/interfaces/metricsobject.go b/lifecycle-operator/controllers/lifecycle/interfaces/metricsobject.go similarity index 95% rename from operator/controllers/lifecycle/interfaces/metricsobject.go rename to lifecycle-operator/controllers/lifecycle/interfaces/metricsobject.go index 0c43e8c68c..b9c016d35b 100644 --- a/operator/controllers/lifecycle/interfaces/metricsobject.go +++ b/lifecycle-operator/controllers/lifecycle/interfaces/metricsobject.go @@ -3,7 +3,7 @@ package interfaces import ( "time" - "github.com/keptn/lifecycle-toolkit/operator/controllers/errors" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/controllers/errors" "go.opentelemetry.io/otel/attribute" "sigs.k8s.io/controller-runtime/pkg/client" ) diff --git a/operator/controllers/lifecycle/interfaces/metricsobject_test.go b/lifecycle-operator/controllers/lifecycle/interfaces/metricsobject_test.go similarity index 87% rename from operator/controllers/lifecycle/interfaces/metricsobject_test.go rename to lifecycle-operator/controllers/lifecycle/interfaces/metricsobject_test.go index 1f1133b420..91c2b3c59d 100644 --- a/operator/controllers/lifecycle/interfaces/metricsobject_test.go +++ b/lifecycle-operator/controllers/lifecycle/interfaces/metricsobject_test.go @@ -4,9 +4,9 @@ import ( "testing" "time" - "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3" - apicommon "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3/common" - "github.com/keptn/lifecycle-toolkit/operator/controllers/lifecycle/interfaces/fake" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3" + apicommon "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3/common" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/controllers/lifecycle/interfaces/fake" "github.com/stretchr/testify/require" "go.opentelemetry.io/otel/attribute" ) diff --git a/operator/controllers/lifecycle/interfaces/phaseitem.go b/lifecycle-operator/controllers/lifecycle/interfaces/phaseitem.go similarity index 94% rename from operator/controllers/lifecycle/interfaces/phaseitem.go rename to lifecycle-operator/controllers/lifecycle/interfaces/phaseitem.go index cb6b8fe2b7..ce5d7b0647 100644 --- a/operator/controllers/lifecycle/interfaces/phaseitem.go +++ b/lifecycle-operator/controllers/lifecycle/interfaces/phaseitem.go @@ -3,9 +3,9 @@ package interfaces import ( "time" - klcv1alpha3 "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3" - apicommon "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3/common" - "github.com/keptn/lifecycle-toolkit/operator/controllers/errors" + klcv1alpha3 "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3" + apicommon "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3/common" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/controllers/errors" "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/trace" "sigs.k8s.io/controller-runtime/pkg/client" diff --git a/operator/controllers/lifecycle/interfaces/phaseitem_test.go b/lifecycle-operator/controllers/lifecycle/interfaces/phaseitem_test.go similarity index 95% rename from operator/controllers/lifecycle/interfaces/phaseitem_test.go rename to lifecycle-operator/controllers/lifecycle/interfaces/phaseitem_test.go index 87abc9c5de..082b705381 100644 --- a/operator/controllers/lifecycle/interfaces/phaseitem_test.go +++ b/lifecycle-operator/controllers/lifecycle/interfaces/phaseitem_test.go @@ -4,9 +4,9 @@ import ( "testing" "time" - "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3" - apicommon "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3/common" - "github.com/keptn/lifecycle-toolkit/operator/controllers/lifecycle/interfaces/fake" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3" + apicommon "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3/common" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/controllers/lifecycle/interfaces/fake" "github.com/stretchr/testify/require" "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/trace" diff --git a/operator/controllers/lifecycle/interfaces/spanitem.go b/lifecycle-operator/controllers/lifecycle/interfaces/spanitem.go similarity index 93% rename from operator/controllers/lifecycle/interfaces/spanitem.go rename to lifecycle-operator/controllers/lifecycle/interfaces/spanitem.go index 48e77ca0fd..6f868a892b 100644 --- a/operator/controllers/lifecycle/interfaces/spanitem.go +++ b/lifecycle-operator/controllers/lifecycle/interfaces/spanitem.go @@ -1,7 +1,7 @@ package interfaces import ( - "github.com/keptn/lifecycle-toolkit/operator/controllers/errors" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/controllers/errors" "go.opentelemetry.io/otel/propagation" "go.opentelemetry.io/otel/trace" "sigs.k8s.io/controller-runtime/pkg/client" diff --git a/operator/controllers/lifecycle/interfaces/spanitem_test.go b/lifecycle-operator/controllers/lifecycle/interfaces/spanitem_test.go similarity index 84% rename from operator/controllers/lifecycle/interfaces/spanitem_test.go rename to lifecycle-operator/controllers/lifecycle/interfaces/spanitem_test.go index 6d85a24e58..910340d9f2 100644 --- a/operator/controllers/lifecycle/interfaces/spanitem_test.go +++ b/lifecycle-operator/controllers/lifecycle/interfaces/spanitem_test.go @@ -3,9 +3,9 @@ package interfaces import ( "testing" - "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3" - apicommon "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3/common" - "github.com/keptn/lifecycle-toolkit/operator/controllers/lifecycle/interfaces/fake" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3" + apicommon "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3/common" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/controllers/lifecycle/interfaces/fake" "github.com/stretchr/testify/require" "go.opentelemetry.io/otel/propagation" "go.opentelemetry.io/otel/trace" diff --git a/operator/controllers/lifecycle/keptnapp/controller.go b/lifecycle-operator/controllers/lifecycle/keptnapp/controller.go similarity index 86% rename from operator/controllers/lifecycle/keptnapp/controller.go rename to lifecycle-operator/controllers/lifecycle/keptnapp/controller.go index 1582dcaf15..f38a7a3a27 100644 --- a/operator/controllers/lifecycle/keptnapp/controller.go +++ b/lifecycle-operator/controllers/lifecycle/keptnapp/controller.go @@ -21,11 +21,12 @@ import ( "fmt" "github.com/go-logr/logr" - klcv1alpha3 "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3" - "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3/common" - operatorcommon "github.com/keptn/lifecycle-toolkit/operator/common" - controllercommon "github.com/keptn/lifecycle-toolkit/operator/controllers/common" - controllererrors "github.com/keptn/lifecycle-toolkit/operator/controllers/errors" + klcv1alpha3 "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3/common" + operatorcommon "github.com/keptn/lifecycle-toolkit/lifecycle-operator/common" + controllercommon "github.com/keptn/lifecycle-toolkit/lifecycle-operator/controllers/common" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/controllers/common/telemetry" + controllererrors "github.com/keptn/lifecycle-toolkit/lifecycle-operator/controllers/errors" "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/codes" "go.opentelemetry.io/otel/propagation" @@ -41,15 +42,15 @@ import ( "sigs.k8s.io/controller-runtime/pkg/reconcile" ) -const traceComponentName = "keptn/operator/app" +const traceComponentName = "keptn/lifecycle-operator/app" // KeptnAppReconciler reconciles a KeptnApp object type KeptnAppReconciler struct { client.Client Scheme *runtime.Scheme - EventSender controllercommon.EventSender + EventSender controllercommon.IEvent Log logr.Logger - TracerFactory controllercommon.TracerFactory + TracerFactory telemetry.TracerFactory } // +kubebuilder:rbac:groups=lifecycle.keptn.sh,resources=keptnapps,verbs=get;list;watch;create;update;patch;delete @@ -105,7 +106,7 @@ func (r *KeptnAppReconciler) Reconcile(ctx context.Context, req ctrl.Request) (c if err != nil { r.Log.Error(err, "could not create AppVersion") span.SetStatus(codes.Error, err.Error()) - r.EventSender.SendK8sEvent(common.PhaseCreateAppVersion, "Warning", appVersion, common.PhaseStateFailed, "Could not create KeptnAppVersion", appVersion.Spec.Version) + r.EventSender.Emit(common.PhaseCreateAppVersion, "Warning", appVersion, common.PhaseStateFailed, "Could not create KeptnAppVersion", appVersion.Spec.Version) return ctrl.Result{}, err } @@ -171,7 +172,7 @@ func (r *KeptnAppReconciler) handleGenerationBump(ctx context.Context, app *klcv if app.Generation != 1 { if err := r.deprecateAppVersions(ctx, app); err != nil { r.Log.Error(err, "could not deprecate appVersions for appVersion %s", app.GetAppVersionName()) - r.EventSender.SendK8sEvent(common.PhaseDeprecateAppVersion, "Warning", app, common.PhaseStateFailed, fmt.Sprintf("could not deprecate outdated revisions of KeptnAppVersion: %s", app.GetAppVersionName()), app.Spec.Version) + r.EventSender.Emit(common.PhaseDeprecateAppVersion, "Warning", app, common.PhaseStateFailed, fmt.Sprintf("could not deprecate outdated revisions of KeptnAppVersion: %s", app.GetAppVersionName()), app.Spec.Version) return err } } @@ -200,6 +201,6 @@ func (r *KeptnAppReconciler) deprecateAppVersions(ctx context.Context, app *klcv return lastResultErr } -func (r *KeptnAppReconciler) getTracer() controllercommon.ITracer { +func (r *KeptnAppReconciler) getTracer() telemetry.ITracer { return r.TracerFactory.GetTracer(traceComponentName) } diff --git a/operator/controllers/lifecycle/keptnapp/controller_test.go b/lifecycle-operator/controllers/lifecycle/keptnapp/controller_test.go similarity index 92% rename from operator/controllers/lifecycle/keptnapp/controller_test.go rename to lifecycle-operator/controllers/lifecycle/keptnapp/controller_test.go index 65cd0747ec..36bec91f73 100644 --- a/operator/controllers/lifecycle/keptnapp/controller_test.go +++ b/lifecycle-operator/controllers/lifecycle/keptnapp/controller_test.go @@ -6,10 +6,10 @@ import ( "reflect" "testing" - lfcv1alpha3 "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3" - apicommon "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3/common" - controllercommon "github.com/keptn/lifecycle-toolkit/operator/controllers/common" - "github.com/keptn/lifecycle-toolkit/operator/controllers/common/fake" + lfcv1alpha3 "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3" + apicommon "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3/common" + controllercommon "github.com/keptn/lifecycle-toolkit/lifecycle-operator/controllers/common" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/controllers/common/fake" "github.com/magiconair/properties/assert" "github.com/stretchr/testify/require" "go.opentelemetry.io/otel/trace" @@ -113,7 +113,7 @@ func TestKeptnAppReconciler_reconcile(t *testing.T) { }, } - //setting up fakeclient CRD data + // setting up fakeclient CRD data err := controllercommon.AddApp(r.Client, "myapp") require.Nil(t, err) @@ -145,8 +145,8 @@ func TestKeptnAppReconciler_reconcile(t *testing.T) { assert.Equal(t, tracer.StartCalls()[0].SpanName, "reconcile_app") assert.Equal(t, tracer.StartCalls()[1].SpanName, "create_app_version") assert.Equal(t, tracer.StartCalls()[2].SpanName, "myapp-1.0.0-6b86b273") - //case 2 creates no span because notfound - //case 3 reconcile finished crd + // case 2 creates no span because notfound + // case 3 reconcile finished crd assert.Equal(t, tracer.StartCalls()[3].SpanName, "reconcile_app") } @@ -190,13 +190,13 @@ func TestKeptnAppReconciler_deprecateAppVersions(t *testing.T) { } func setupReconciler() (*KeptnAppReconciler, chan string, *fake.ITracerMock) { - //setup logger + // setup logger opts := zap.Options{ Development: true, } ctrl.SetLogger(zap.New(zap.UseFlagOptions(&opts))) - //fake a tracer + // fake a tracer tr := &fake.ITracerMock{StartFunc: func(ctx context.Context, spanName string, opts ...trace.SpanStartOption) (context.Context, trace.Span) { return ctx, trace.SpanFromContext(ctx) }} diff --git a/operator/controllers/lifecycle/keptnappcreationrequest/controller.go b/lifecycle-operator/controllers/lifecycle/keptnappcreationrequest/controller.go similarity index 94% rename from operator/controllers/lifecycle/keptnappcreationrequest/controller.go rename to lifecycle-operator/controllers/lifecycle/keptnappcreationrequest/controller.go index 37fd8ea744..5668fe24e1 100644 --- a/operator/controllers/lifecycle/keptnappcreationrequest/controller.go +++ b/lifecycle-operator/controllers/lifecycle/keptnappcreationrequest/controller.go @@ -26,9 +26,9 @@ import ( "github.com/benbjohnson/clock" "github.com/go-logr/logr" - lifecycle "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3" - "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3/common" - "github.com/keptn/lifecycle-toolkit/operator/controllers/common/config" + lifecycle "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3/common" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/controllers/common/config" "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" @@ -59,9 +59,9 @@ func NewReconciler(client client.Client, scheme *runtime.Scheme, log logr.Logger } } -//+kubebuilder:rbac:groups=lifecycle.keptn.sh,resources=keptnappcreationrequests,verbs=get;list;watch;create;update;patch;delete -//+kubebuilder:rbac:groups=lifecycle.keptn.sh,resources=keptnappcreationrequests/status,verbs=get;update;patch -//+kubebuilder:rbac:groups=lifecycle.keptn.sh,resources=keptnappcreationrequests/finalizers,verbs=update +// +kubebuilder:rbac:groups=lifecycle.keptn.sh,resources=keptnappcreationrequests,verbs=get;list;watch;create;update;patch;delete +// +kubebuilder:rbac:groups=lifecycle.keptn.sh,resources=keptnappcreationrequests/status,verbs=get;update;patch +// +kubebuilder:rbac:groups=lifecycle.keptn.sh,resources=keptnappcreationrequests/finalizers,verbs=update // Reconcile is part of the main kubernetes reconciliation loop which aims to // move the current state of the cluster closer to the desired state. diff --git a/operator/controllers/lifecycle/keptnappcreationrequest/controller_test.go b/lifecycle-operator/controllers/lifecycle/keptnappcreationrequest/controller_test.go similarity index 99% rename from operator/controllers/lifecycle/keptnappcreationrequest/controller_test.go rename to lifecycle-operator/controllers/lifecycle/keptnappcreationrequest/controller_test.go index 967c5f2b78..8c85f953b1 100644 --- a/operator/controllers/lifecycle/keptnappcreationrequest/controller_test.go +++ b/lifecycle-operator/controllers/lifecycle/keptnappcreationrequest/controller_test.go @@ -8,8 +8,8 @@ import ( "github.com/benbjohnson/clock" "github.com/go-logr/logr" - klcv1alpha3 "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3" - "github.com/keptn/lifecycle-toolkit/operator/controllers/common/config/fake" + klcv1alpha3 "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/controllers/common/config/fake" "github.com/stretchr/testify/require" "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" diff --git a/operator/controllers/lifecycle/keptnappversion/controller.go b/lifecycle-operator/controllers/lifecycle/keptnappversion/controller.go similarity index 91% rename from operator/controllers/lifecycle/keptnappversion/controller.go rename to lifecycle-operator/controllers/lifecycle/keptnappversion/controller.go index aaf5387a84..f6e8bf063e 100644 --- a/operator/controllers/lifecycle/keptnappversion/controller.go +++ b/lifecycle-operator/controllers/lifecycle/keptnappversion/controller.go @@ -22,10 +22,11 @@ import ( "time" "github.com/go-logr/logr" - klcv1alpha3 "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3" - apicommon "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3/common" - controllercommon "github.com/keptn/lifecycle-toolkit/operator/controllers/common" - controllererrors "github.com/keptn/lifecycle-toolkit/operator/controllers/errors" + klcv1alpha3 "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3" + apicommon "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3/common" + controllercommon "github.com/keptn/lifecycle-toolkit/lifecycle-operator/controllers/common" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/controllers/common/telemetry" + controllererrors "github.com/keptn/lifecycle-toolkit/lifecycle-operator/controllers/errors" "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/codes" "go.opentelemetry.io/otel/metric" @@ -40,17 +41,17 @@ import ( "sigs.k8s.io/controller-runtime/pkg/reconcile" ) -const traceComponentName = "keptn/operator/appversion" +const traceComponentName = "keptn/lifecycle-operator/appversion" // KeptnAppVersionReconciler reconciles a KeptnAppVersion object type KeptnAppVersionReconciler struct { Scheme *runtime.Scheme client.Client Log logr.Logger - EventSender controllercommon.EventSender - TracerFactory controllercommon.TracerFactory + EventSender controllercommon.IEvent + TracerFactory telemetry.TracerFactory Meters apicommon.KeptnMeters - SpanHandler controllercommon.ISpanHandler + SpanHandler telemetry.ISpanHandler } // +kubebuilder:rbac:groups=lifecycle.keptn.sh,resources=keptnappversions,verbs=get;list;watch;create;update;patch;delete @@ -181,7 +182,7 @@ func (r *KeptnAppVersionReconciler) finishKeptnAppVersionReconcile(ctx context.C return ctrl.Result{Requeue: true}, err } - r.EventSender.SendK8sEvent(apicommon.PhaseAppCompleted, "Normal", appVersion, apicommon.PhaseStateFinished, "has finished", appVersion.GetVersion()) + r.EventSender.Emit(apicommon.PhaseAppCompleted, "Normal", appVersion, apicommon.PhaseStateFinished, "has finished", appVersion.GetVersion()) attrs := appVersion.GetMetricsAttributes() diff --git a/operator/controllers/lifecycle/keptnappversion/controller_test.go b/lifecycle-operator/controllers/lifecycle/keptnappversion/controller_test.go similarity index 94% rename from operator/controllers/lifecycle/keptnappversion/controller_test.go rename to lifecycle-operator/controllers/lifecycle/keptnappversion/controller_test.go index 2832100b0e..3abaa0d795 100644 --- a/operator/controllers/lifecycle/keptnappversion/controller_test.go +++ b/lifecycle-operator/controllers/lifecycle/keptnappversion/controller_test.go @@ -7,10 +7,10 @@ import ( "strings" "testing" - lfcv1alpha3 "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3" - apicommon "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3/common" - controllercommon "github.com/keptn/lifecycle-toolkit/operator/controllers/common" - "github.com/keptn/lifecycle-toolkit/operator/controllers/common/fake" + lfcv1alpha3 "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3" + apicommon "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3/common" + controllercommon "github.com/keptn/lifecycle-toolkit/lifecycle-operator/controllers/common" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/controllers/common/fake" "github.com/stretchr/testify/require" "go.opentelemetry.io/otel/trace" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -36,7 +36,7 @@ func TestKeptnAppVersionReconciler_reconcile(t *testing.T) { name string req ctrl.Request wantErr error - events []string //check correct events are generated + events []string // check correct events are generated startTrace bool }{ { @@ -84,7 +84,7 @@ func TestKeptnAppVersionReconciler_reconcile(t *testing.T) { PostDeploymentEvaluationStatus: apicommon.StatePending, } - //setting up fakeclient CRD data + // setting up fakeclient CRD data err := controllercommon.AddAppVersion(r.Client, "default", "myappversion", "1.0.0", nil, pendingStatus) require.Nil(t, err) @@ -108,7 +108,7 @@ func TestKeptnAppVersionReconciler_reconcile(t *testing.T) { } if tt.startTrace { - //A different trace for each app-version + // A different trace for each app-version require.Equal(t, tracer.StartCalls()[traces].SpanName, "reconcile_app_version") require.Equal(t, tracer.StartCalls()[traces].Ctx.Value(CONTEXTID), tt.req.Name) traces++ @@ -248,13 +248,13 @@ func createFinishedAppVersionStatus() lfcv1alpha3.KeptnAppVersionStatus { } func setupReconcilerWithMeters() *KeptnAppVersionReconciler { - //setup logger + // setup logger opts := zap.Options{ Development: true, } ctrl.SetLogger(zap.New(zap.UseFlagOptions(&opts))) - //fake a tracer + // fake a tracer tr := &fake.ITracerMock{StartFunc: func(ctx context.Context, spanName string, opts ...trace.SpanStartOption) (context.Context, trace.Span) { return ctx, trace.SpanFromContext(ctx) }} @@ -272,13 +272,13 @@ func setupReconcilerWithMeters() *KeptnAppVersionReconciler { } func setupReconciler(objs ...client.Object) (*KeptnAppVersionReconciler, chan string, *fake.ITracerMock, *fake.ISpanHandlerMock) { - //setup logger + // setup logger opts := zap.Options{ Development: true, } ctrl.SetLogger(zap.New(zap.UseFlagOptions(&opts))) - //fake a tracer + // fake a tracer tr := &fake.ITracerMock{StartFunc: func(ctx context.Context, spanName string, opts ...trace.SpanStartOption) (context.Context, trace.Span) { return ctx, trace.SpanFromContext(ctx) }} @@ -287,7 +287,7 @@ func setupReconciler(objs ...client.Object) (*KeptnAppVersionReconciler, chan st return tr }} - //fake span handler + // fake span handler spanRecorder := &fake.ISpanHandlerMock{ GetSpanFunc: func(ctx context.Context, tracer trace.Tracer, reconcileObject client.Object, phase string) (context.Context, trace.Span, error) { diff --git a/operator/controllers/lifecycle/keptnappversion/reconcile_prepostdeployment.go b/lifecycle-operator/controllers/lifecycle/keptnappversion/reconcile_prepostdeployment.go similarity index 82% rename from operator/controllers/lifecycle/keptnappversion/reconcile_prepostdeployment.go rename to lifecycle-operator/controllers/lifecycle/keptnappversion/reconcile_prepostdeployment.go index 6367e857d7..88eb0383f3 100644 --- a/operator/controllers/lifecycle/keptnappversion/reconcile_prepostdeployment.go +++ b/lifecycle-operator/controllers/lifecycle/keptnappversion/reconcile_prepostdeployment.go @@ -5,9 +5,9 @@ import ( "context" "fmt" - klcv1alpha3 "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3" - apicommon "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3/common" - controllercommon "github.com/keptn/lifecycle-toolkit/operator/controllers/common" + klcv1alpha3 "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3" + apicommon "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3/common" + controllercommon "github.com/keptn/lifecycle-toolkit/lifecycle-operator/controllers/common" ) func (r *KeptnAppVersionReconciler) reconcilePrePostDeployment(ctx context.Context, phaseCtx context.Context, appVersion *klcv1alpha3.KeptnAppVersion, checkType apicommon.CheckType) (apicommon.KeptnState, error) { diff --git a/operator/controllers/lifecycle/keptnappversion/reconcile_prepostevaluation.go b/lifecycle-operator/controllers/lifecycle/keptnappversion/reconcile_prepostevaluation.go similarity index 83% rename from operator/controllers/lifecycle/keptnappversion/reconcile_prepostevaluation.go rename to lifecycle-operator/controllers/lifecycle/keptnappversion/reconcile_prepostevaluation.go index d33d8f505f..1fe78bb6e5 100644 --- a/operator/controllers/lifecycle/keptnappversion/reconcile_prepostevaluation.go +++ b/lifecycle-operator/controllers/lifecycle/keptnappversion/reconcile_prepostevaluation.go @@ -5,9 +5,9 @@ import ( "context" "fmt" - klcv1alpha3 "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3" - apicommon "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3/common" - controllercommon "github.com/keptn/lifecycle-toolkit/operator/controllers/common" + klcv1alpha3 "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3" + apicommon "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3/common" + controllercommon "github.com/keptn/lifecycle-toolkit/lifecycle-operator/controllers/common" ) func (r *KeptnAppVersionReconciler) reconcilePrePostEvaluation(ctx context.Context, phaseCtx context.Context, appVersion *klcv1alpha3.KeptnAppVersion, checkType apicommon.CheckType) (apicommon.KeptnState, error) { diff --git a/operator/controllers/lifecycle/keptnappversion/reconcile_workloadsstate.go b/lifecycle-operator/controllers/lifecycle/keptnappversion/reconcile_workloadsstate.go similarity index 87% rename from operator/controllers/lifecycle/keptnappversion/reconcile_workloadsstate.go rename to lifecycle-operator/controllers/lifecycle/keptnappversion/reconcile_workloadsstate.go index 4f1636eb2c..9ac81a6c46 100644 --- a/operator/controllers/lifecycle/keptnappversion/reconcile_workloadsstate.go +++ b/lifecycle-operator/controllers/lifecycle/keptnappversion/reconcile_workloadsstate.go @@ -4,9 +4,9 @@ import ( "context" "fmt" - klcv1alpha3 "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3" - apicommon "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3/common" - operatorcommon "github.com/keptn/lifecycle-toolkit/operator/common" + klcv1alpha3 "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3" + apicommon "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3/common" + operatorcommon "github.com/keptn/lifecycle-toolkit/lifecycle-operator/common" "sigs.k8s.io/controller-runtime/pkg/client" ) @@ -41,7 +41,7 @@ func (r *KeptnAppVersionReconciler) reconcileWorkloads(ctx context.Context, appV } if !found { - r.EventSender.SendK8sEvent(phase, "Warning", appVersion, apicommon.PhaseStateNotFound, fmt.Sprintf("could not find KeptnWorkloadInstance for KeptnWorkload: %s ", w.Name), appVersion.GetVersion()) + r.EventSender.Emit(phase, "Warning", appVersion, apicommon.PhaseStateNotFound, fmt.Sprintf("could not find KeptnWorkloadInstance for KeptnWorkload: %s ", w.Name), appVersion.GetVersion()) } newStatus = append(newStatus, klcv1alpha3.WorkloadStatus{ diff --git a/operator/controllers/lifecycle/keptnappversion/reconcile_workloadstate_test.go b/lifecycle-operator/controllers/lifecycle/keptnappversion/reconcile_workloadstate_test.go similarity index 97% rename from operator/controllers/lifecycle/keptnappversion/reconcile_workloadstate_test.go rename to lifecycle-operator/controllers/lifecycle/keptnappversion/reconcile_workloadstate_test.go index 40edc38a48..c16ad48f86 100644 --- a/operator/controllers/lifecycle/keptnappversion/reconcile_workloadstate_test.go +++ b/lifecycle-operator/controllers/lifecycle/keptnappversion/reconcile_workloadstate_test.go @@ -4,8 +4,8 @@ import ( "context" "testing" - lfcv1alpha3 "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3" - apicommon "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3/common" + lfcv1alpha3 "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3" + apicommon "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3/common" "github.com/stretchr/testify/require" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" diff --git a/operator/controllers/lifecycle/keptnevaluation/common.go b/lifecycle-operator/controllers/lifecycle/keptnevaluation/common.go similarity index 89% rename from operator/controllers/lifecycle/keptnevaluation/common.go rename to lifecycle-operator/controllers/lifecycle/keptnevaluation/common.go index ec11fd5dc3..0b6750751b 100644 --- a/operator/controllers/lifecycle/keptnevaluation/common.go +++ b/lifecycle-operator/controllers/lifecycle/keptnevaluation/common.go @@ -5,7 +5,7 @@ import ( "math" "strconv" - klcv1alpha3 "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3" + klcv1alpha3 "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3" ) func checkValue(objective klcv1alpha3.Objective, item *klcv1alpha3.EvaluationStatusItem) (bool, error) { diff --git a/operator/controllers/lifecycle/keptnevaluation/common_test.go b/lifecycle-operator/controllers/lifecycle/keptnevaluation/common_test.go similarity index 98% rename from operator/controllers/lifecycle/keptnevaluation/common_test.go rename to lifecycle-operator/controllers/lifecycle/keptnevaluation/common_test.go index 8a543c0dfb..521dae6527 100644 --- a/operator/controllers/lifecycle/keptnevaluation/common_test.go +++ b/lifecycle-operator/controllers/lifecycle/keptnevaluation/common_test.go @@ -3,7 +3,7 @@ package keptnevaluation import ( "testing" - klcv1alpha3 "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3" + klcv1alpha3 "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3" "github.com/stretchr/testify/require" ) diff --git a/operator/controllers/lifecycle/keptnevaluation/controller.go b/lifecycle-operator/controllers/lifecycle/keptnevaluation/controller.go similarity index 89% rename from operator/controllers/lifecycle/keptnevaluation/controller.go rename to lifecycle-operator/controllers/lifecycle/keptnevaluation/controller.go index 1b6c5a8029..44423c7179 100644 --- a/operator/controllers/lifecycle/keptnevaluation/controller.go +++ b/lifecycle-operator/controllers/lifecycle/keptnevaluation/controller.go @@ -22,11 +22,12 @@ import ( "time" "github.com/go-logr/logr" - klcv1alpha3 "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3" - apicommon "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3/common" - controllercommon "github.com/keptn/lifecycle-toolkit/operator/controllers/common" - "github.com/keptn/lifecycle-toolkit/operator/controllers/common/providers/keptnmetric" - controllererrors "github.com/keptn/lifecycle-toolkit/operator/controllers/errors" + klcv1alpha3 "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3" + apicommon "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3/common" + controllercommon "github.com/keptn/lifecycle-toolkit/lifecycle-operator/controllers/common" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/controllers/common/providers/keptnmetric" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/controllers/common/telemetry" + controllererrors "github.com/keptn/lifecycle-toolkit/lifecycle-operator/controllers/errors" "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/codes" "go.opentelemetry.io/otel/metric" @@ -40,16 +41,16 @@ import ( "sigs.k8s.io/controller-runtime/pkg/predicate" ) -const traceComponentName = "keptn/operator/evaluation" +const traceComponentName = "keptn/lifecycle-operator/evaluation" // KeptnEvaluationReconciler reconciles a KeptnEvaluation object type KeptnEvaluationReconciler struct { client.Client Scheme *runtime.Scheme - EventSender controllercommon.EventSender + EventSender controllercommon.IEvent Log logr.Logger Meters apicommon.KeptnMeters - TracerFactory controllercommon.TracerFactory + TracerFactory telemetry.TracerFactory Namespace string } @@ -138,7 +139,7 @@ func (r *KeptnEvaluationReconciler) handleEvaluationIncomplete(ctx context.Conte // Evaluation is uncompleted, update status anyway this avoids updating twice in case of completion err := r.Client.Status().Update(ctx, evaluation) if err != nil { - r.EventSender.SendK8sEvent(apicommon.PhaseReconcileEvaluation, "Warning", evaluation, apicommon.PhaseStateReconcileError, "could not update status", "") + r.EventSender.Emit(apicommon.PhaseReconcileEvaluation, "Warning", evaluation, apicommon.PhaseStateReconcileError, "could not update status", "") span.SetStatus(codes.Error, err.Error()) return err } @@ -148,7 +149,7 @@ func (r *KeptnEvaluationReconciler) handleEvaluationIncomplete(ctx context.Conte } func (r *KeptnEvaluationReconciler) handleEvaluationExceededRetries(ctx context.Context, evaluation *klcv1alpha3.KeptnEvaluation, span trace.Span) { - r.EventSender.SendK8sEvent(apicommon.PhaseReconcileEvaluation, "Warning", evaluation, apicommon.PhaseStateReconcileTimeout, "retryCount exceeded", "") + r.EventSender.Emit(apicommon.PhaseReconcileEvaluation, "Warning", evaluation, apicommon.PhaseStateReconcileTimeout, "retryCount exceeded", "") err := controllererrors.ErrRetryCountExceeded span.SetStatus(codes.Error, err.Error()) evaluation.Status.OverallStatus = apicommon.StateFailed @@ -237,7 +238,7 @@ func (r *KeptnEvaluationReconciler) updateFinishedEvaluationMetrics(ctx context. err := r.Client.Status().Update(ctx, evaluation) if err != nil { span.SetStatus(codes.Error, err.Error()) - r.EventSender.SendK8sEvent(apicommon.PhaseReconcileEvaluation, "Warning", evaluation, apicommon.PhaseStateReconcileError, "could not update status", "") + r.EventSender.Emit(apicommon.PhaseReconcileEvaluation, "Warning", evaluation, apicommon.PhaseStateReconcileError, "could not update status", "") return err } @@ -261,6 +262,6 @@ func (r *KeptnEvaluationReconciler) SetupWithManager(mgr ctrl.Manager) error { Complete(r) } -func (r *KeptnEvaluationReconciler) getTracer() controllercommon.ITracer { +func (r *KeptnEvaluationReconciler) getTracer() telemetry.ITracer { return r.TracerFactory.GetTracer(traceComponentName) } diff --git a/operator/controllers/lifecycle/keptnevaluation/controller_test.go b/lifecycle-operator/controllers/lifecycle/keptnevaluation/controller_test.go similarity index 92% rename from operator/controllers/lifecycle/keptnevaluation/controller_test.go rename to lifecycle-operator/controllers/lifecycle/keptnevaluation/controller_test.go index f61f7bcb40..c17e6c0482 100644 --- a/operator/controllers/lifecycle/keptnevaluation/controller_test.go +++ b/lifecycle-operator/controllers/lifecycle/keptnevaluation/controller_test.go @@ -6,11 +6,12 @@ import ( "testing" "github.com/go-logr/logr" - klcv1alpha3 "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3" - "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3/common" - controllercommon "github.com/keptn/lifecycle-toolkit/operator/controllers/common" - "github.com/keptn/lifecycle-toolkit/operator/controllers/common/fake" - metricsapi "github.com/keptn/lifecycle-toolkit/operator/test/api/metrics/v1alpha3" + klcv1alpha3 "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3/common" + controllercommon "github.com/keptn/lifecycle-toolkit/lifecycle-operator/controllers/common" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/controllers/common/fake" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/controllers/common/telemetry" + metricsapi "github.com/keptn/lifecycle-toolkit/lifecycle-operator/test/api/metrics/v1alpha3" "github.com/stretchr/testify/require" "go.opentelemetry.io/otel/sdk/metric" "go.opentelemetry.io/otel/trace" @@ -260,7 +261,7 @@ func setupReconcilerAndClient(t *testing.T, objects ...client.Object) (*KeptnEva Scheme: fakeClient.Scheme(), Log: logr.Logger{}, EventSender: controllercommon.NewEventSender(record.NewFakeRecorder(100)), - Meters: controllercommon.SetUpKeptnTaskMeters(meter), + Meters: telemetry.SetUpKeptnTaskMeters(meter), TracerFactory: tf, } return r, fakeClient diff --git a/operator/controllers/lifecycle/keptntask/container_builder.go b/lifecycle-operator/controllers/lifecycle/keptntask/container_builder.go similarity index 88% rename from operator/controllers/lifecycle/keptntask/container_builder.go rename to lifecycle-operator/controllers/lifecycle/keptntask/container_builder.go index d68f61b584..2ea0c7ad96 100644 --- a/operator/controllers/lifecycle/keptntask/container_builder.go +++ b/lifecycle-operator/controllers/lifecycle/keptntask/container_builder.go @@ -1,8 +1,8 @@ package keptntask import ( - klcv1alpha3 "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3" - "github.com/keptn/lifecycle-toolkit/operator/controllers/common" + klcv1alpha3 "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/controllers/common" "golang.org/x/net/context" corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/resource" diff --git a/operator/controllers/lifecycle/keptntask/container_builder_test.go b/lifecycle-operator/controllers/lifecycle/keptntask/container_builder_test.go similarity index 98% rename from operator/controllers/lifecycle/keptntask/container_builder_test.go rename to lifecycle-operator/controllers/lifecycle/keptntask/container_builder_test.go index beb805b19d..7f535ba65c 100644 --- a/operator/controllers/lifecycle/keptntask/container_builder_test.go +++ b/lifecycle-operator/controllers/lifecycle/keptntask/container_builder_test.go @@ -4,7 +4,7 @@ import ( "context" "testing" - "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3" "github.com/stretchr/testify/require" v1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/resource" diff --git a/operator/controllers/lifecycle/keptntask/controller.go b/lifecycle-operator/controllers/lifecycle/keptntask/controller.go similarity index 88% rename from operator/controllers/lifecycle/keptntask/controller.go rename to lifecycle-operator/controllers/lifecycle/keptntask/controller.go index d3c7ee3286..caf524a57c 100644 --- a/operator/controllers/lifecycle/keptntask/controller.go +++ b/lifecycle-operator/controllers/lifecycle/keptntask/controller.go @@ -21,9 +21,10 @@ import ( "time" "github.com/go-logr/logr" - klcv1alpha3 "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3" - apicommon "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3/common" - controllercommon "github.com/keptn/lifecycle-toolkit/operator/controllers/common" + klcv1alpha3 "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3" + apicommon "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3/common" + controllercommon "github.com/keptn/lifecycle-toolkit/lifecycle-operator/controllers/common" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/controllers/common/telemetry" "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/codes" "go.opentelemetry.io/otel/metric" @@ -37,16 +38,16 @@ import ( "sigs.k8s.io/controller-runtime/pkg/predicate" ) -const traceComponentName = "keptn/operator/task" +const traceComponentName = "keptn/lifecycle-operator/task" // KeptnTaskReconciler reconciles a KeptnTask object type KeptnTaskReconciler struct { client.Client Scheme *runtime.Scheme - EventSender controllercommon.EventSender + EventSender controllercommon.IEvent Log logr.Logger Meters apicommon.KeptnMeters - TracerFactory controllercommon.TracerFactory + TracerFactory telemetry.TracerFactory } // +kubebuilder:rbac:groups=lifecycle.keptn.sh,resources=keptntasks,verbs=get;list;watch;create;update;patch;delete @@ -137,6 +138,6 @@ func (r *KeptnTaskReconciler) SetupWithManager(mgr ctrl.Manager) error { Complete(r) } -func (r *KeptnTaskReconciler) getTracer() controllercommon.ITracer { +func (r *KeptnTaskReconciler) getTracer() telemetry.ITracer { return r.TracerFactory.GetTracer(traceComponentName) } diff --git a/operator/controllers/lifecycle/keptntask/job_runner_builder.go b/lifecycle-operator/controllers/lifecycle/keptntask/job_runner_builder.go similarity index 83% rename from operator/controllers/lifecycle/keptntask/job_runner_builder.go rename to lifecycle-operator/controllers/lifecycle/keptntask/job_runner_builder.go index f784549153..ef2371014f 100644 --- a/operator/controllers/lifecycle/keptntask/job_runner_builder.go +++ b/lifecycle-operator/controllers/lifecycle/keptntask/job_runner_builder.go @@ -2,8 +2,8 @@ package keptntask import ( "github.com/go-logr/logr" - klcv1alpha3 "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3" - controllercommon "github.com/keptn/lifecycle-toolkit/operator/controllers/common" + klcv1alpha3 "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3" + controllercommon "github.com/keptn/lifecycle-toolkit/lifecycle-operator/controllers/common" "golang.org/x/net/context" corev1 "k8s.io/api/core/v1" ctrl "sigs.k8s.io/controller-runtime" @@ -20,7 +20,7 @@ type JobRunnerBuilder interface { // BuilderOptions contains everything needed to build the current job type BuilderOptions struct { client.Client - eventSender controllercommon.EventSender + eventSender controllercommon.IEvent req ctrl.Request Log logr.Logger task *klcv1alpha3.KeptnTask diff --git a/operator/controllers/lifecycle/keptntask/job_runner_builder_test.go b/lifecycle-operator/controllers/lifecycle/keptntask/job_runner_builder_test.go similarity index 92% rename from operator/controllers/lifecycle/keptntask/job_runner_builder_test.go rename to lifecycle-operator/controllers/lifecycle/keptntask/job_runner_builder_test.go index 3bfd781a08..a5a0427309 100644 --- a/operator/controllers/lifecycle/keptntask/job_runner_builder_test.go +++ b/lifecycle-operator/controllers/lifecycle/keptntask/job_runner_builder_test.go @@ -3,7 +3,7 @@ package keptntask import ( "testing" - "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3" "github.com/stretchr/testify/require" v1 "k8s.io/api/core/v1" ) diff --git a/operator/controllers/lifecycle/keptntask/job_utils.go b/lifecycle-operator/controllers/lifecycle/keptntask/job_utils.go similarity index 86% rename from operator/controllers/lifecycle/keptntask/job_utils.go rename to lifecycle-operator/controllers/lifecycle/keptntask/job_utils.go index a0f4068dbf..d336171c91 100644 --- a/operator/controllers/lifecycle/keptntask/job_utils.go +++ b/lifecycle-operator/controllers/lifecycle/keptntask/job_utils.go @@ -4,10 +4,10 @@ import ( "context" "fmt" - klcv1alpha3 "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3" - apicommon "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3/common" - controllercommon "github.com/keptn/lifecycle-toolkit/operator/controllers/common" - controllererrors "github.com/keptn/lifecycle-toolkit/operator/controllers/errors" + klcv1alpha3 "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3" + apicommon "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3/common" + controllercommon "github.com/keptn/lifecycle-toolkit/lifecycle-operator/controllers/common" + controllererrors "github.com/keptn/lifecycle-toolkit/lifecycle-operator/controllers/errors" batchv1 "k8s.io/api/batch/v1" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -21,7 +21,7 @@ func (r *KeptnTaskReconciler) createJob(ctx context.Context, req ctrl.Request, t definition, err := controllercommon.GetTaskDefinition(r.Client, r.Log, ctx, task.Spec.TaskDefinition, req.Namespace) if err != nil { r.Log.Error(err, fmt.Sprintf("could not find KeptnTaskDefinition: %s ", task.Spec.TaskDefinition)) - r.EventSender.SendK8sEvent(apicommon.PhaseCreateTask, "Warning", task, apicommon.PhaseStateNotFound, fmt.Sprintf("could not find KeptnTaskDefinition: %s ", task.Spec.TaskDefinition), "") + r.EventSender.Emit(apicommon.PhaseCreateTask, "Warning", task, apicommon.PhaseStateNotFound, fmt.Sprintf("could not find KeptnTaskDefinition: %s ", task.Spec.TaskDefinition), "") return err } @@ -47,7 +47,7 @@ func (r *KeptnTaskReconciler) createFunctionJob(ctx context.Context, req ctrl.Re err = r.Client.Create(ctx, job) if err != nil { r.Log.Error(err, "could not create Job") - r.EventSender.SendK8sEvent(apicommon.PhaseCreateTask, "Warning", task, apicommon.PhaseStateFailed, fmt.Sprintf("could not create Job: %s ", task.Name), "") + r.EventSender.Emit(apicommon.PhaseCreateTask, "Warning", task, apicommon.PhaseStateFailed, fmt.Sprintf("could not create Job: %s ", task.Name), "") return job.Name, err } diff --git a/operator/controllers/lifecycle/keptntask/job_utils_test.go b/lifecycle-operator/controllers/lifecycle/keptntask/job_utils_test.go similarity index 95% rename from operator/controllers/lifecycle/keptntask/job_utils_test.go rename to lifecycle-operator/controllers/lifecycle/keptntask/job_utils_test.go index 92bdc14d69..6a0cf2eb1c 100644 --- a/operator/controllers/lifecycle/keptntask/job_utils_test.go +++ b/lifecycle-operator/controllers/lifecycle/keptntask/job_utils_test.go @@ -4,10 +4,10 @@ import ( "context" "testing" - klcv1alpha3 "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3" - apicommon "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3/common" - "github.com/keptn/lifecycle-toolkit/operator/controllers/common" - controllercommon "github.com/keptn/lifecycle-toolkit/operator/controllers/common" + klcv1alpha3 "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3" + apicommon "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3/common" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/controllers/common" + controllercommon "github.com/keptn/lifecycle-toolkit/lifecycle-operator/controllers/common" "github.com/stretchr/testify/require" batchv1 "k8s.io/api/batch/v1" v1 "k8s.io/api/core/v1" diff --git a/operator/controllers/lifecycle/keptntask/runtime_builder.go b/lifecycle-operator/controllers/lifecycle/keptntask/runtime_builder.go similarity index 87% rename from operator/controllers/lifecycle/keptntask/runtime_builder.go rename to lifecycle-operator/controllers/lifecycle/keptntask/runtime_builder.go index 633746c5a9..670b46eca2 100644 --- a/operator/controllers/lifecycle/keptntask/runtime_builder.go +++ b/lifecycle-operator/controllers/lifecycle/keptntask/runtime_builder.go @@ -5,10 +5,10 @@ import ( "fmt" "dario.cat/mergo" - klcv1alpha3 "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3" - apicommon "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3/common" - controllercommon "github.com/keptn/lifecycle-toolkit/operator/controllers/common" - controllererrors "github.com/keptn/lifecycle-toolkit/operator/controllers/errors" + klcv1alpha3 "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3" + apicommon "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3/common" + controllercommon "github.com/keptn/lifecycle-toolkit/lifecycle-operator/controllers/common" + controllererrors "github.com/keptn/lifecycle-toolkit/lifecycle-operator/controllers/errors" "golang.org/x/net/context" corev1 "k8s.io/api/core/v1" ) @@ -157,7 +157,7 @@ func (fb *RuntimeBuilder) getParams(ctx context.Context) (*RuntimeExecutionParam if len(fb.options.task.Spec.Parameters.Inline) > 0 { err = mergo.Merge(¶ms.Parameters, fb.options.task.Spec.Parameters.Inline) if err != nil { - fb.options.eventSender.SendK8sEvent(apicommon.PhaseCreateTask, "Warning", fb.options.task, apicommon.PhaseStateFailed, fmt.Sprintf("could not merge KeptnTaskDefinition: %s ", fb.options.task.Spec.TaskDefinition), "") + fb.options.eventSender.Emit(apicommon.PhaseCreateTask, "Warning", fb.options.task, apicommon.PhaseStateFailed, fmt.Sprintf("could not merge KeptnTaskDefinition: %s ", fb.options.task.Spec.TaskDefinition), "") return nil, err } } @@ -211,7 +211,7 @@ func (fb *RuntimeBuilder) handleParent(ctx context.Context, params *RuntimeExecu var parentJobParams RuntimeExecutionParams parentDefinition, err := controllercommon.GetTaskDefinition(fb.options.Client, fb.options.Log, ctx, fb.options.funcSpec.FunctionReference.Name, fb.options.req.Namespace) if err != nil { - fb.options.eventSender.SendK8sEvent(apicommon.PhaseCreateTask, "Warning", fb.options.task, apicommon.PhaseStateNotFound, fmt.Sprintf("could not find KeptnTaskDefinition: %s ", fb.options.task.Spec.TaskDefinition), "") + fb.options.eventSender.Emit(apicommon.PhaseCreateTask, "Warning", fb.options.task, apicommon.PhaseStateNotFound, fmt.Sprintf("could not find KeptnTaskDefinition: %s ", fb.options.task.Spec.TaskDefinition), "") return err } parSpec := controllercommon.GetRuntimeSpec(parentDefinition) @@ -223,7 +223,7 @@ func (fb *RuntimeBuilder) handleParent(ctx context.Context, params *RuntimeExecu // merge parameter to make sure we use child task data for env var and secrets err = mergo.Merge(params, parentJobParams) if err != nil { - fb.options.eventSender.SendK8sEvent(apicommon.PhaseCreateTask, "Warning", fb.options.task, apicommon.PhaseStateFailed, fmt.Sprintf("could not merge KeptnTaskDefinition: %s ", fb.options.task.Spec.TaskDefinition), "") + fb.options.eventSender.Emit(apicommon.PhaseCreateTask, "Warning", fb.options.task, apicommon.PhaseStateFailed, fmt.Sprintf("could not merge KeptnTaskDefinition: %s ", fb.options.task.Spec.TaskDefinition), "") return err } diff --git a/operator/controllers/lifecycle/keptntask/runtime_builder_test.go b/lifecycle-operator/controllers/lifecycle/keptntask/runtime_builder_test.go similarity index 92% rename from operator/controllers/lifecycle/keptntask/runtime_builder_test.go rename to lifecycle-operator/controllers/lifecycle/keptntask/runtime_builder_test.go index 9a864fca75..fe6729853f 100644 --- a/operator/controllers/lifecycle/keptntask/runtime_builder_test.go +++ b/lifecycle-operator/controllers/lifecycle/keptntask/runtime_builder_test.go @@ -4,11 +4,11 @@ import ( "testing" "github.com/go-logr/logr/testr" - klcv1alpha3 "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3" - apicommon "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3/common" - "github.com/keptn/lifecycle-toolkit/operator/controllers/common" - controllercommon "github.com/keptn/lifecycle-toolkit/operator/controllers/common" - "github.com/keptn/lifecycle-toolkit/operator/controllers/common/fake" + klcv1alpha3 "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3" + apicommon "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3/common" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/controllers/common" + controllercommon "github.com/keptn/lifecycle-toolkit/lifecycle-operator/controllers/common" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/controllers/common/fake" "github.com/stretchr/testify/require" "golang.org/x/net/context" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -249,12 +249,12 @@ func TestJSBuilder_getParams(t *testing.T) { }, params: &RuntimeExecutionParams{ ConfigMap: def.Status.Function.ConfigMap, - Parameters: map[string]string{ //maps should be merged + Parameters: map[string]string{ // maps should be merged "DATA2": "parent_data", "DATA1": "child_data", }, - SecureParameters: paramDef.Spec.Deno.SecureParameters.Secret, //uses child - URL: def.Spec.Function.HttpReference.Url, //uses parent + SecureParameters: paramDef.Spec.Deno.SecureParameters.Secret, // uses child + URL: def.Spec.Function.HttpReference.Url, // uses parent Context: klcv1alpha3.TaskContext{ WorkloadName: "my-workload", AppName: "my-app", @@ -281,7 +281,7 @@ func TestJSBuilder_getParams(t *testing.T) { }, params: &RuntimeExecutionParams{ ConfigMap: parentPy.Status.Function.ConfigMap, - URL: parentPy.Spec.Python.HttpReference.Url, //we support a single URL so the original should be taken not the parent one + URL: parentPy.Spec.Python.HttpReference.Url, // we support a single URL so the original should be taken not the parent one Context: klcv1alpha3.TaskContext{ WorkloadName: "my-workload", AppName: "my-app", diff --git a/operator/controllers/lifecycle/keptntaskdefinition/controller.go b/lifecycle-operator/controllers/lifecycle/keptntaskdefinition/controller.go similarity index 83% rename from operator/controllers/lifecycle/keptntaskdefinition/controller.go rename to lifecycle-operator/controllers/lifecycle/keptntaskdefinition/controller.go index 4f75105ae5..0dcb3daf01 100644 --- a/operator/controllers/lifecycle/keptntaskdefinition/controller.go +++ b/lifecycle-operator/controllers/lifecycle/keptntaskdefinition/controller.go @@ -21,9 +21,9 @@ import ( "time" "github.com/go-logr/logr" - klcv1alpha3 "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3" - "github.com/keptn/lifecycle-toolkit/operator/controllers/common" - controllercommon "github.com/keptn/lifecycle-toolkit/operator/controllers/common" + klcv1alpha3 "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/controllers/common" + controllercommon "github.com/keptn/lifecycle-toolkit/lifecycle-operator/controllers/common" corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/runtime" @@ -36,7 +36,7 @@ type KeptnTaskDefinitionReconciler struct { client.Client Scheme *runtime.Scheme Log logr.Logger - EventSender controllercommon.EventSender + EventSender controllercommon.IEvent } // +kubebuilder:rbac:groups=lifecycle.keptn.sh,resources=keptntaskdefinitions,verbs=get;list;watch;create;update;patch;delete @@ -59,14 +59,14 @@ func (r *KeptnTaskDefinitionReconciler) Reconcile(ctx context.Context, req ctrl. return ctrl.Result{Requeue: true, RequeueAfter: 30 * time.Second}, nil } defSpec := common.GetRuntimeSpec(definition) - if definition.Spec.Container == nil && defSpec != nil { //if the spec is well-defined + if definition.Spec.Container == nil && defSpec != nil { // if the spec is well-defined // get configmap reference either existing configmap name or inline generated one cmName := controllercommon.GetCmName(definition.Name, defSpec) - //get existing configmap either generated from inline or user defined + // get existing configmap either generated from inline or user defined cm, err := r.getConfigMap(ctx, cmName, req.Namespace) - //if IsNotFound we need to create it + // if IsNotFound we need to create it if err != nil && !errors.IsNotFound(err) { return ctrl.Result{}, nil } @@ -76,11 +76,11 @@ func (r *KeptnTaskDefinitionReconciler) Reconcile(ctx context.Context, req ctrl. if common.IsInline(defSpec) { functionCm = r.generateConfigMap(defSpec, cmName, definition.Namespace) } - //compare and handle updated and existing + // compare and handle updated and existing r.reconcileConfigMap(ctx, functionCm, cm) - /// if neither exist remove from status + // / if neither exist remove from status r.updateTaskDefinitionStatus(functionCm, definition) - //now we know that the reference to the config map is valid, so we update the definition + // now we know that the reference to the config map is valid, so we update the definition err = r.Client.Status().Update(ctx, definition) if err != nil { r.Log.Error(err, "could not update configmap status reference for: "+definition.Name) diff --git a/operator/controllers/lifecycle/keptntaskdefinition/reconcile_function.go b/lifecycle-operator/controllers/lifecycle/keptntaskdefinition/reconcile_function.go similarity index 73% rename from operator/controllers/lifecycle/keptntaskdefinition/reconcile_function.go rename to lifecycle-operator/controllers/lifecycle/keptntaskdefinition/reconcile_function.go index 25d5d51f4d..1734b6c242 100644 --- a/operator/controllers/lifecycle/keptntaskdefinition/reconcile_function.go +++ b/lifecycle-operator/controllers/lifecycle/keptntaskdefinition/reconcile_function.go @@ -4,8 +4,8 @@ import ( "context" "reflect" - klcv1alpha3 "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3" - apicommon "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3/common" + klcv1alpha3 "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3" + apicommon "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3/common" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" @@ -28,22 +28,22 @@ func (r *KeptnTaskDefinitionReconciler) generateConfigMap(spec *klcv1alpha3.Runt func (r *KeptnTaskDefinitionReconciler) reconcileConfigMap(ctx context.Context, functionCm *corev1.ConfigMap, cm *corev1.ConfigMap) { - if (cm == nil || reflect.DeepEqual(cm, &corev1.ConfigMap{})) && functionCm != nil { //cm does not exist or new taskdef with inline func + if (cm == nil || reflect.DeepEqual(cm, &corev1.ConfigMap{})) && functionCm != nil { // cm does not exist or new taskdef with inline func err := r.Client.Create(ctx, functionCm) if err != nil { r.Log.Error(err, "could not create ConfigMap") - r.EventSender.SendK8sEvent(apicommon.PhaseReconcileTask, "Warning", functionCm, apicommon.PhaseStateFailed, "could not create configmap", "") + r.EventSender.Emit(apicommon.PhaseReconcileTask, "Warning", functionCm, apicommon.PhaseStateFailed, "could not create configmap", "") return } - } else if !reflect.DeepEqual(cm, functionCm) && functionCm != nil { //cm and inline func exists but differ + } else if !reflect.DeepEqual(cm, functionCm) && functionCm != nil { // cm and inline func exists but differ err := r.Client.Update(ctx, functionCm) if err != nil { r.Log.Error(err, "could not update ConfigMap") - r.EventSender.SendK8sEvent(apicommon.PhaseReconcileTask, "Warning", functionCm, apicommon.PhaseStateFailed, "could not update configmap", "") + r.EventSender.Emit(apicommon.PhaseReconcileTask, "Warning", functionCm, apicommon.PhaseStateFailed, "could not update configmap", "") return } } - //nothing changed + // nothing changed } func (r *KeptnTaskDefinitionReconciler) getConfigMap(ctx context.Context, cmName string, namespace string) (*corev1.ConfigMap, error) { @@ -58,9 +58,9 @@ func (r *KeptnTaskDefinitionReconciler) getConfigMap(ctx context.Context, cmName func (r *KeptnTaskDefinitionReconciler) updateTaskDefinitionStatus(functionCm *corev1.ConfigMap, definition *klcv1alpha3.KeptnTaskDefinition) { // config map referenced but does not exist we can use the status to signify that - if functionCm != nil && definition.Status.Function.ConfigMap != functionCm.Name { //configmap referenced exists but old + if functionCm != nil && definition.Status.Function.ConfigMap != functionCm.Name { // configmap referenced exists but old definition.Status.Function.ConfigMap = functionCm.Name - //and make sure that the definition controls the config map + // and make sure that the definition controls the config map err := controllerutil.SetControllerReference(definition, functionCm, r.Scheme) if err != nil { r.Log.Error(err, "could not set controller reference for ConfigMap: "+functionCm.Name) diff --git a/operator/controllers/lifecycle/keptnworkload/controller.go b/lifecycle-operator/controllers/lifecycle/keptnworkload/controller.go similarity index 87% rename from operator/controllers/lifecycle/keptnworkload/controller.go rename to lifecycle-operator/controllers/lifecycle/keptnworkload/controller.go index ee906024c7..0cf60216ea 100644 --- a/operator/controllers/lifecycle/keptnworkload/controller.go +++ b/lifecycle-operator/controllers/lifecycle/keptnworkload/controller.go @@ -21,10 +21,11 @@ import ( "fmt" "github.com/go-logr/logr" - klcv1alpha3 "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3" - apicommon "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3/common" - controllercommon "github.com/keptn/lifecycle-toolkit/operator/controllers/common" - controllererrors "github.com/keptn/lifecycle-toolkit/operator/controllers/errors" + klcv1alpha3 "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3" + apicommon "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3/common" + controllercommon "github.com/keptn/lifecycle-toolkit/lifecycle-operator/controllers/common" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/controllers/common/telemetry" + controllererrors "github.com/keptn/lifecycle-toolkit/lifecycle-operator/controllers/errors" "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/codes" "go.opentelemetry.io/otel/propagation" @@ -40,15 +41,15 @@ import ( "sigs.k8s.io/controller-runtime/pkg/reconcile" ) -const traceComponentName = "keptn/operator/workload" +const traceComponentName = "keptn/lifecycle-operator/workload" // KeptnWorkloadReconciler reconciles a KeptnWorkload object type KeptnWorkloadReconciler struct { client.Client Scheme *runtime.Scheme - EventSender controllercommon.EventSender + EventSender controllercommon.IEvent Log logr.Logger - TracerFactory controllercommon.TracerFactory + TracerFactory telemetry.TracerFactory } // +kubebuilder:rbac:groups=lifecycle.keptn.sh,resources=keptnworkloads,verbs=get;list;watch;create;update;patch;delete @@ -104,7 +105,7 @@ func (r *KeptnWorkloadReconciler) Reconcile(ctx context.Context, req ctrl.Reques if err != nil { r.Log.Error(err, "could not create WorkloadInstance") span.SetStatus(codes.Error, err.Error()) - r.EventSender.SendK8sEvent(apicommon.PhaseCreateWorklodInstance, "Warning", workloadInstance, apicommon.PhaseStateFailed, "could not create KeptnWorkloadInstance ", workloadInstance.Spec.Version) + r.EventSender.Emit(apicommon.PhaseCreateWorklodInstance, "Warning", workloadInstance, apicommon.PhaseStateFailed, "could not create KeptnWorkloadInstance ", workloadInstance.Spec.Version) return ctrl.Result{}, err } workload.Status.CurrentVersion = workload.Spec.Version @@ -161,6 +162,6 @@ func (r *KeptnWorkloadReconciler) createWorkloadInstance(ctx context.Context, wo return &workloadInstance, err } -func (r *KeptnWorkloadReconciler) getTracer() controllercommon.ITracer { +func (r *KeptnWorkloadReconciler) getTracer() telemetry.ITracer { return r.TracerFactory.GetTracer(traceComponentName) } diff --git a/operator/controllers/lifecycle/keptnworkloadinstance/controller.go b/lifecycle-operator/controllers/lifecycle/keptnworkloadinstance/controller.go similarity index 91% rename from operator/controllers/lifecycle/keptnworkloadinstance/controller.go rename to lifecycle-operator/controllers/lifecycle/keptnworkloadinstance/controller.go index 23d3571b0d..ee887ec721 100644 --- a/operator/controllers/lifecycle/keptnworkloadinstance/controller.go +++ b/lifecycle-operator/controllers/lifecycle/keptnworkloadinstance/controller.go @@ -22,10 +22,11 @@ import ( "time" "github.com/go-logr/logr" - klcv1alpha3 "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3" - apicommon "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3/common" - controllercommon "github.com/keptn/lifecycle-toolkit/operator/controllers/common" - controllererrors "github.com/keptn/lifecycle-toolkit/operator/controllers/errors" + klcv1alpha3 "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3" + apicommon "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3/common" + controllercommon "github.com/keptn/lifecycle-toolkit/lifecycle-operator/controllers/common" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/controllers/common/telemetry" + controllererrors "github.com/keptn/lifecycle-toolkit/lifecycle-operator/controllers/errors" "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/codes" "go.opentelemetry.io/otel/metric" @@ -40,17 +41,17 @@ import ( "sigs.k8s.io/controller-runtime/pkg/reconcile" ) -const traceComponentName = "keptn/operator/workloadinstance" +const traceComponentName = "keptn/lifecycle-operator/workloadinstance" // KeptnWorkloadInstanceReconciler reconciles a KeptnWorkloadInstance object type KeptnWorkloadInstanceReconciler struct { client.Client Scheme *runtime.Scheme - EventSender controllercommon.EventSender + EventSender controllercommon.IEvent Log logr.Logger Meters apicommon.KeptnMeters - SpanHandler *controllercommon.SpanHandler - TracerFactory controllercommon.TracerFactory + SpanHandler *telemetry.SpanHandler + TracerFactory telemetry.TracerFactory } // +kubebuilder:rbac:groups=lifecycle.keptn.sh,resources=keptnworkloadinstances,verbs=get;list;watch;create;update;patch;delete @@ -190,7 +191,7 @@ func (r *KeptnWorkloadInstanceReconciler) finishKeptnWorkloadInstanceReconcile(c return ctrl.Result{Requeue: true}, err } - r.EventSender.SendK8sEvent(apicommon.PhaseWorkloadCompleted, "Normal", workloadInstance, apicommon.PhaseStateFinished, "has finished", workloadInstance.GetVersion()) + r.EventSender.Emit(apicommon.PhaseWorkloadCompleted, "Normal", workloadInstance, apicommon.PhaseStateFinished, "has finished", workloadInstance.GetVersion()) attrs := workloadInstance.GetMetricsAttributes() @@ -224,7 +225,7 @@ func (r *KeptnWorkloadInstanceReconciler) SetupWithManager(mgr ctrl.Manager) err func (r *KeptnWorkloadInstanceReconciler) sendUnfinishedPreEvaluationEvents(appPreEvalStatus apicommon.KeptnState, phase apicommon.KeptnPhaseType, workloadInstance *klcv1alpha3.KeptnWorkloadInstance) { if appPreEvalStatus.IsFailed() { - r.EventSender.SendK8sEvent(phase, "Warning", workloadInstance, apicommon.PhaseStateFailed, "has failed since app has failed", workloadInstance.GetVersion()) + r.EventSender.Emit(phase, "Warning", workloadInstance, apicommon.PhaseStateFailed, "has failed since app has failed", workloadInstance.GetVersion()) } } @@ -260,11 +261,11 @@ func (r *KeptnWorkloadInstanceReconciler) checkPreEvaluationStatusOfApp(ctx cont found, appVersion, err := r.getAppVersionForWorkloadInstance(ctx, workloadInstance) if err != nil { span.SetStatus(codes.Error, err.Error()) - r.EventSender.SendK8sEvent(phase, "Warning", workloadInstance, "GetAppVersionFailed", "has failed since app could not be retrieved", workloadInstance.GetVersion()) + r.EventSender.Emit(phase, "Warning", workloadInstance, "GetAppVersionFailed", "has failed since app could not be retrieved", workloadInstance.GetVersion()) return true, fmt.Errorf(controllererrors.ErrCannotFetchAppVersionForWorkloadInstanceMsg + err.Error()) } else if !found { span.SetStatus(codes.Error, "app could not be found") - r.EventSender.SendK8sEvent(phase, "Warning", workloadInstance, "AppVersionNotFound", "has failed since app could not be found", workloadInstance.GetVersion()) + r.EventSender.Emit(phase, "Warning", workloadInstance, "AppVersionNotFound", "has failed since app could not be found", workloadInstance.GetVersion()) return true, fmt.Errorf(controllererrors.ErrCannotFetchAppVersionForWorkloadInstanceMsg) } @@ -314,7 +315,7 @@ func (r *KeptnWorkloadInstanceReconciler) getAppVersionForWorkloadInstance(ctx c return true, latestVersion, nil } -func (r *KeptnWorkloadInstanceReconciler) getTracer() controllercommon.ITracer { +func (r *KeptnWorkloadInstanceReconciler) getTracer() telemetry.ITracer { return r.TracerFactory.GetTracer(traceComponentName) } diff --git a/operator/controllers/lifecycle/keptnworkloadinstance/controller_test.go b/lifecycle-operator/controllers/lifecycle/keptnworkloadinstance/controller_test.go similarity index 97% rename from operator/controllers/lifecycle/keptnworkloadinstance/controller_test.go rename to lifecycle-operator/controllers/lifecycle/keptnworkloadinstance/controller_test.go index 67a5020cd6..d5f10c2a86 100644 --- a/operator/controllers/lifecycle/keptnworkloadinstance/controller_test.go +++ b/lifecycle-operator/controllers/lifecycle/keptnworkloadinstance/controller_test.go @@ -7,11 +7,12 @@ import ( "testing" "time" - klcv1alpha3 "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3" - apicommon "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3/common" - controllercommon "github.com/keptn/lifecycle-toolkit/operator/controllers/common" - "github.com/keptn/lifecycle-toolkit/operator/controllers/common/fake" - controllererrors "github.com/keptn/lifecycle-toolkit/operator/controllers/errors" + klcv1alpha3 "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3" + apicommon "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3/common" + controllercommon "github.com/keptn/lifecycle-toolkit/lifecycle-operator/controllers/common" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/controllers/common/fake" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/controllers/common/telemetry" + controllererrors "github.com/keptn/lifecycle-toolkit/lifecycle-operator/controllers/errors" "github.com/magiconair/properties/assert" "github.com/stretchr/testify/require" testrequire "github.com/stretchr/testify/require" @@ -1043,13 +1044,13 @@ func TestKeptnWorkloadInstanceReconciler_ReconcileDoNotRetryAfterFailedPhase(t * } func setupReconciler() (*KeptnWorkloadInstanceReconciler, chan string, *fake.ITracerMock) { - //setup logger + // setup logger opts := zap.Options{ Development: true, } ctrl.SetLogger(zap.New(zap.UseFlagOptions(&opts))) - //fake a tracer + // fake a tracer tr := &fake.ITracerMock{StartFunc: func(ctx context.Context, spanName string, opts ...trace.SpanStartOption) (context.Context, trace.Span) { return ctx, trace.SpanFromContext(ctx) }} @@ -1067,7 +1068,7 @@ func setupReconciler() (*KeptnWorkloadInstanceReconciler, chan string, *fake.ITr Log: ctrl.Log.WithName("test-appController"), TracerFactory: tf, Meters: controllercommon.InitAppMeters(), - SpanHandler: &controllercommon.SpanHandler{}, + SpanHandler: &telemetry.SpanHandler{}, } return r, recorder.Events, tr } diff --git a/operator/controllers/lifecycle/keptnworkloadinstance/reconcile_deploymentstate.go b/lifecycle-operator/controllers/lifecycle/keptnworkloadinstance/reconcile_deploymentstate.go similarity index 93% rename from operator/controllers/lifecycle/keptnworkloadinstance/reconcile_deploymentstate.go rename to lifecycle-operator/controllers/lifecycle/keptnworkloadinstance/reconcile_deploymentstate.go index 3a6e560445..11075b5747 100644 --- a/operator/controllers/lifecycle/keptnworkloadinstance/reconcile_deploymentstate.go +++ b/lifecycle-operator/controllers/lifecycle/keptnworkloadinstance/reconcile_deploymentstate.go @@ -4,9 +4,9 @@ import ( "context" argov1alpha1 "github.com/argoproj/argo-rollouts/pkg/apis/rollouts/v1alpha1" - klcv1alpha3 "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3" - apicommon "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3/common" - controllererrors "github.com/keptn/lifecycle-toolkit/operator/controllers/errors" + klcv1alpha3 "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3" + apicommon "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3/common" + controllererrors "github.com/keptn/lifecycle-toolkit/lifecycle-operator/controllers/errors" appsv1 "k8s.io/api/apps/v1" corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/types" diff --git a/operator/controllers/lifecycle/keptnworkloadinstance/reconcile_prepostdeployment.go b/lifecycle-operator/controllers/lifecycle/keptnworkloadinstance/reconcile_prepostdeployment.go similarity index 83% rename from operator/controllers/lifecycle/keptnworkloadinstance/reconcile_prepostdeployment.go rename to lifecycle-operator/controllers/lifecycle/keptnworkloadinstance/reconcile_prepostdeployment.go index 237657a2da..8717c0c74d 100644 --- a/operator/controllers/lifecycle/keptnworkloadinstance/reconcile_prepostdeployment.go +++ b/lifecycle-operator/controllers/lifecycle/keptnworkloadinstance/reconcile_prepostdeployment.go @@ -5,9 +5,9 @@ import ( "context" "fmt" - klcv1alpha3 "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3" - apicommon "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3/common" - controllercommon "github.com/keptn/lifecycle-toolkit/operator/controllers/common" + klcv1alpha3 "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3" + apicommon "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3/common" + controllercommon "github.com/keptn/lifecycle-toolkit/lifecycle-operator/controllers/common" ) func (r *KeptnWorkloadInstanceReconciler) reconcilePrePostDeployment(ctx context.Context, phaseCtx context.Context, workloadInstance *klcv1alpha3.KeptnWorkloadInstance, checkType apicommon.CheckType) (apicommon.KeptnState, error) { diff --git a/operator/controllers/lifecycle/keptnworkloadinstance/reconcile_prepostevaluation.go b/lifecycle-operator/controllers/lifecycle/keptnworkloadinstance/reconcile_prepostevaluation.go similarity index 84% rename from operator/controllers/lifecycle/keptnworkloadinstance/reconcile_prepostevaluation.go rename to lifecycle-operator/controllers/lifecycle/keptnworkloadinstance/reconcile_prepostevaluation.go index b854d271c5..79d3482f45 100644 --- a/operator/controllers/lifecycle/keptnworkloadinstance/reconcile_prepostevaluation.go +++ b/lifecycle-operator/controllers/lifecycle/keptnworkloadinstance/reconcile_prepostevaluation.go @@ -5,9 +5,9 @@ import ( "context" "fmt" - klcv1alpha3 "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3" - apicommon "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3/common" - controllercommon "github.com/keptn/lifecycle-toolkit/operator/controllers/common" + klcv1alpha3 "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3" + apicommon "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3/common" + controllercommon "github.com/keptn/lifecycle-toolkit/lifecycle-operator/controllers/common" ) func (r *KeptnWorkloadInstanceReconciler) reconcilePrePostEvaluation(ctx context.Context, phaseCtx context.Context, workloadInstance *klcv1alpha3.KeptnWorkloadInstance, checkType apicommon.CheckType) (apicommon.KeptnState, error) { diff --git a/operator/controllers/options/keptnconfig_controller.go b/lifecycle-operator/controllers/options/keptnconfig_controller.go similarity index 78% rename from operator/controllers/options/keptnconfig_controller.go rename to lifecycle-operator/controllers/options/keptnconfig_controller.go index f7926027f2..b0a97ed80a 100644 --- a/operator/controllers/options/keptnconfig_controller.go +++ b/lifecycle-operator/controllers/options/keptnconfig_controller.go @@ -22,9 +22,10 @@ import ( "time" "github.com/go-logr/logr" - optionsv1alpha1 "github.com/keptn/lifecycle-toolkit/operator/apis/options/v1alpha1" - controllercommon "github.com/keptn/lifecycle-toolkit/operator/controllers/common" - controllererrors "github.com/keptn/lifecycle-toolkit/operator/controllers/errors" + optionsv1alpha1 "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/options/v1alpha1" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/controllers/common/config" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/controllers/common/telemetry" + controllererrors "github.com/keptn/lifecycle-toolkit/lifecycle-operator/controllers/errors" "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/runtime" ctrl "sigs.k8s.io/controller-runtime" @@ -49,8 +50,8 @@ type KeptnConfigReconciler struct { func (r *KeptnConfigReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) { r.Log.Info("Searching for KeptnConfig") - config := &optionsv1alpha1.KeptnConfig{} - err := r.Get(ctx, req.NamespacedName, config) + cfg := &optionsv1alpha1.KeptnConfig{} + err := r.Get(ctx, req.NamespacedName, cfg) if errors.IsNotFound(err) { return reconcile.Result{}, nil } @@ -63,18 +64,21 @@ func (r *KeptnConfigReconciler) Reconcile(ctx context.Context, req ctrl.Request) r.initConfig() } - result, err := r.reconcileOtelCollectorUrl(config) + result, err := r.reconcileOtelCollectorUrl(cfg) if err != nil { return result, err } + // reconcile config values + cfgInstance := config.Instance() + cfgInstance.SetCreationRequestTimeout(time.Duration(cfg.Spec.KeptnAppCreationRequestTimeoutSeconds) * time.Second) - r.LastAppliedSpec = &config.Spec + r.LastAppliedSpec = &cfg.Spec return ctrl.Result{}, nil } func (r *KeptnConfigReconciler) reconcileOtelCollectorUrl(config *optionsv1alpha1.KeptnConfig) (ctrl.Result, error) { r.Log.Info(fmt.Sprintf("reconciling Keptn Config: %s", config.Name)) - otelConfig := controllercommon.GetOtelInstance() + otelConfig := telemetry.GetOtelInstance() if err := otelConfig.InitOtelCollector(config.Spec.OTelCollectorUrl); err != nil { r.Log.Error(err, "unable to initialize OTel tracer options") diff --git a/operator/controllers/options/keptnconfig_controller_test.go b/lifecycle-operator/controllers/options/keptnconfig_controller_test.go similarity index 97% rename from operator/controllers/options/keptnconfig_controller_test.go rename to lifecycle-operator/controllers/options/keptnconfig_controller_test.go index a61fb28594..327d07efba 100644 --- a/operator/controllers/options/keptnconfig_controller_test.go +++ b/lifecycle-operator/controllers/options/keptnconfig_controller_test.go @@ -7,8 +7,8 @@ import ( "time" "github.com/go-logr/logr" - optionsv1alpha1 "github.com/keptn/lifecycle-toolkit/operator/apis/options/v1alpha1" - "github.com/keptn/lifecycle-toolkit/operator/controllers/common/fake" + optionsv1alpha1 "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/options/v1alpha1" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/controllers/common/fake" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/types" @@ -262,7 +262,7 @@ func setupReconciler() *KeptnConfigReconciler { }, } - //setup logger + // setup logger opts := zap.Options{ Development: true, } diff --git a/operator/go.mod b/lifecycle-operator/go.mod similarity index 97% rename from operator/go.mod rename to lifecycle-operator/go.mod index 3253d16f1c..760ae15b2f 100644 --- a/operator/go.mod +++ b/lifecycle-operator/go.mod @@ -1,4 +1,4 @@ -module github.com/keptn/lifecycle-toolkit/operator +module github.com/keptn/lifecycle-toolkit/lifecycle-operator go 1.20 @@ -8,10 +8,10 @@ require ( github.com/benbjohnson/clock v1.3.5 github.com/go-logr/logr v1.2.4 github.com/kelseyhightower/envconfig v1.4.0 - github.com/keptn/lifecycle-toolkit/klt-cert-manager v0.0.0-20230727070347-cba2de5a5cd0 + github.com/keptn/lifecycle-toolkit/klt-cert-manager v0.0.0-20230807110601-88a54f97c157 github.com/magiconair/properties v1.8.7 github.com/onsi/ginkgo/v2 v2.11.0 - github.com/onsi/gomega v1.27.9 + github.com/onsi/gomega v1.27.10 github.com/pkg/errors v0.9.1 github.com/prometheus/client_golang v1.16.0 github.com/stretchr/testify v1.8.4 diff --git a/operator/go.sum b/lifecycle-operator/go.sum similarity index 99% rename from operator/go.sum rename to lifecycle-operator/go.sum index 8c4175e19d..658c15ffb9 100644 --- a/operator/go.sum +++ b/lifecycle-operator/go.sum @@ -208,8 +208,8 @@ github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1 github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= github.com/kelseyhightower/envconfig v1.4.0 h1:Im6hONhd3pLkfDFsbRgu68RDNkGF1r3dvMUtDTo2cv8= github.com/kelseyhightower/envconfig v1.4.0/go.mod h1:cccZRl6mQpaq41TPp5QxidR+Sa3axMbJDNb//FQX6Gg= -github.com/keptn/lifecycle-toolkit/klt-cert-manager v0.0.0-20230727070347-cba2de5a5cd0 h1:e0PiUPwUQhm/GeN9SBAZ0qCT/MWmgvxCJ6Fa2TLOsJM= -github.com/keptn/lifecycle-toolkit/klt-cert-manager v0.0.0-20230727070347-cba2de5a5cd0/go.mod h1:c4dEFwlXo62YVmFw4I5cxgSC/gK96NeE9mDxayHasV0= +github.com/keptn/lifecycle-toolkit/klt-cert-manager v0.0.0-20230807110601-88a54f97c157 h1:qEhM16/Ce2+eeeSyJEIDU7a7UVlM2uBPDFQgXneA/7Y= +github.com/keptn/lifecycle-toolkit/klt-cert-manager v0.0.0-20230807110601-88a54f97c157/go.mod h1:c4dEFwlXo62YVmFw4I5cxgSC/gK96NeE9mDxayHasV0= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg= @@ -236,8 +236,8 @@ github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= github.com/onsi/ginkgo/v2 v2.11.0 h1:WgqUCUt/lT6yXoQ8Wef0fsNn5cAuMK7+KT9UFRz2tcU= github.com/onsi/ginkgo/v2 v2.11.0/go.mod h1:ZhrRA5XmEE3x3rhlzamx/JJvujdZoJ2uvgI7kR0iZvM= -github.com/onsi/gomega v1.27.9 h1:qIyVWbOsvQEye2QCqLsNSeH/5L1RS9vS382erEWfT3o= -github.com/onsi/gomega v1.27.9/go.mod h1:RsS8tutOdbdgzbPtzzATp12yT7kM5I5aElG3evPbQ0M= +github.com/onsi/gomega v1.27.10 h1:naR28SdDFlqrG6kScpT8VWpu1xWY5nJRCF3XaYyBjhI= +github.com/onsi/gomega v1.27.10/go.mod h1:RsS8tutOdbdgzbPtzzATp12yT7kM5I5aElG3evPbQ0M= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= diff --git a/operator/hack/boilerplate.go.txt b/lifecycle-operator/hack/boilerplate.go.txt similarity index 100% rename from operator/hack/boilerplate.go.txt rename to lifecycle-operator/hack/boilerplate.go.txt diff --git a/operator/main.go b/lifecycle-operator/main.go similarity index 87% rename from operator/main.go rename to lifecycle-operator/main.go index 2bea149f92..72943d3fcc 100644 --- a/operator/main.go +++ b/lifecycle-operator/main.go @@ -28,21 +28,22 @@ import ( "github.com/keptn/lifecycle-toolkit/klt-cert-manager/pkg/certificates" certCommon "github.com/keptn/lifecycle-toolkit/klt-cert-manager/pkg/common" "github.com/keptn/lifecycle-toolkit/klt-cert-manager/pkg/webhook" - lifecyclev1alpha1 "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha1" - lifecyclev1alpha2 "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha2" - lifecyclev1alpha3 "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3" - optionsv1alpha1 "github.com/keptn/lifecycle-toolkit/operator/apis/options/v1alpha1" - controllercommon "github.com/keptn/lifecycle-toolkit/operator/controllers/common" - "github.com/keptn/lifecycle-toolkit/operator/controllers/lifecycle/keptnapp" - "github.com/keptn/lifecycle-toolkit/operator/controllers/lifecycle/keptnappcreationrequest" - "github.com/keptn/lifecycle-toolkit/operator/controllers/lifecycle/keptnappversion" - "github.com/keptn/lifecycle-toolkit/operator/controllers/lifecycle/keptnevaluation" - "github.com/keptn/lifecycle-toolkit/operator/controllers/lifecycle/keptntask" - "github.com/keptn/lifecycle-toolkit/operator/controllers/lifecycle/keptntaskdefinition" - "github.com/keptn/lifecycle-toolkit/operator/controllers/lifecycle/keptnworkload" - "github.com/keptn/lifecycle-toolkit/operator/controllers/lifecycle/keptnworkloadinstance" - controlleroptions "github.com/keptn/lifecycle-toolkit/operator/controllers/options" - "github.com/keptn/lifecycle-toolkit/operator/webhooks/pod_mutator" + lifecyclev1alpha1 "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha1" + lifecyclev1alpha2 "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha2" + lifecyclev1alpha3 "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3" + optionsv1alpha1 "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/options/v1alpha1" + controllercommon "github.com/keptn/lifecycle-toolkit/lifecycle-operator/controllers/common" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/controllers/common/telemetry" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/controllers/lifecycle/keptnapp" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/controllers/lifecycle/keptnappcreationrequest" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/controllers/lifecycle/keptnappversion" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/controllers/lifecycle/keptnevaluation" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/controllers/lifecycle/keptntask" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/controllers/lifecycle/keptntaskdefinition" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/controllers/lifecycle/keptnworkload" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/controllers/lifecycle/keptnworkloadinstance" + controlleroptions "github.com/keptn/lifecycle-toolkit/lifecycle-operator/controllers/options" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/webhooks/pod_mutator" "github.com/prometheus/client_golang/prometheus/promhttp" "go.opentelemetry.io/otel" otelprom "go.opentelemetry.io/otel/exporters/prometheus" @@ -71,7 +72,7 @@ func init() { utilruntime.Must(optionsv1alpha1.AddToScheme(scheme)) utilruntime.Must(lifecyclev1alpha3.AddToScheme(scheme)) utilruntime.Must(argov1alpha1.AddToScheme(scheme)) - //+kubebuilder:scaffold:scheme + // +kubebuilder:scaffold:scheme } type envConfig struct { @@ -115,7 +116,7 @@ func main() { } provider := metric.NewMeterProvider(metric.WithReader(exporter)) meter := provider.Meter("keptn/task") - keptnMeters := controllercommon.SetUpKeptnTaskMeters(meter) + keptnMeters := telemetry.SetUpKeptnTaskMeters(meter) // Start the prometheus HTTP server and pass the exporter Collector to it go serveMetrics() @@ -164,12 +165,12 @@ func main() { } // Enabling OTel - err = controllercommon.GetOtelInstance().InitOtelCollector("") + err = telemetry.GetOtelInstance().InitOtelCollector("") if err != nil { setupLog.Error(err, "unable to initialize OTel tracer options") } - spanHandler := &controllercommon.SpanHandler{} + spanHandler := &telemetry.SpanHandler{} taskLogger := ctrl.Log.WithName("KeptnTask Controller") taskReconciler := &keptntask.KeptnTaskReconciler{ @@ -178,7 +179,7 @@ func main() { Log: taskLogger.V(env.KeptnTaskControllerLogLevel), EventSender: controllercommon.NewEventSender(mgr.GetEventRecorderFor("keptntask-controller")), Meters: keptnMeters, - TracerFactory: controllercommon.GetOtelInstance(), + TracerFactory: telemetry.GetOtelInstance(), } if err = (taskReconciler).SetupWithManager(mgr); err != nil { setupLog.Error(err, "unable to create controller", "controller", "KeptnTask") @@ -203,7 +204,7 @@ func main() { Scheme: mgr.GetScheme(), Log: appLogger.V(env.KeptnAppControllerLogLevel), EventSender: controllercommon.NewEventSender(mgr.GetEventRecorderFor("keptnapp-controller")), - TracerFactory: controllercommon.GetOtelInstance(), + TracerFactory: telemetry.GetOtelInstance(), } if err = (appReconciler).SetupWithManager(mgr); err != nil { setupLog.Error(err, "unable to create controller", "controller", "KeptnApp") @@ -227,7 +228,7 @@ func main() { Scheme: mgr.GetScheme(), Log: workloadLogger.V(env.KeptnWorkloadControllerLogLevel), EventSender: controllercommon.NewEventSender(mgr.GetEventRecorderFor("keptnworkload-controller")), - TracerFactory: controllercommon.GetOtelInstance(), + TracerFactory: telemetry.GetOtelInstance(), } if err = (workloadReconciler).SetupWithManager(mgr); err != nil { setupLog.Error(err, "unable to create controller", "controller", "KeptnWorkload") @@ -241,7 +242,7 @@ func main() { Log: workloadInstanceLogger.V(env.KeptnWorkloadInstanceControllerLogLevel), EventSender: controllercommon.NewEventSender(mgr.GetEventRecorderFor("keptnworkloadinstance-controller")), Meters: keptnMeters, - TracerFactory: controllercommon.GetOtelInstance(), + TracerFactory: telemetry.GetOtelInstance(), SpanHandler: spanHandler, } if err = (workloadInstanceReconciler).SetupWithManager(mgr); err != nil { @@ -255,7 +256,7 @@ func main() { Scheme: mgr.GetScheme(), Log: appVersionLogger.V(env.KeptnAppVersionControllerLogLevel), EventSender: controllercommon.NewEventSender(mgr.GetEventRecorderFor("keptnappversion-controller")), - TracerFactory: controllercommon.GetOtelInstance(), + TracerFactory: telemetry.GetOtelInstance(), Meters: keptnMeters, SpanHandler: spanHandler, } @@ -270,7 +271,7 @@ func main() { Scheme: mgr.GetScheme(), Log: evaluationLogger.V(env.KeptnEvaluationControllerLogLevel), EventSender: controllercommon.NewEventSender(mgr.GetEventRecorderFor("keptnevaluation-controller")), - TracerFactory: controllercommon.GetOtelInstance(), + TracerFactory: telemetry.GetOtelInstance(), Meters: keptnMeters, Namespace: env.PodNamespace, } @@ -313,7 +314,7 @@ func main() { } // +kubebuilder:scaffold:builder - controllercommon.SetUpKeptnMeters(meter, mgr.GetClient()) + telemetry.SetUpKeptnMeters(meter, mgr.GetClient()) if err := mgr.AddHealthzCheck("healthz", healthz.Ping); err != nil { setupLog.Error(err, "unable to set up health check") diff --git a/operator/test/api/metrics/v1alpha3/groupversion_info.go b/lifecycle-operator/test/api/metrics/v1alpha3/groupversion_info.go similarity index 100% rename from operator/test/api/metrics/v1alpha3/groupversion_info.go rename to lifecycle-operator/test/api/metrics/v1alpha3/groupversion_info.go diff --git a/operator/test/api/metrics/v1alpha3/keptnmetric_types.go b/lifecycle-operator/test/api/metrics/v1alpha3/keptnmetric_types.go similarity index 100% rename from operator/test/api/metrics/v1alpha3/keptnmetric_types.go rename to lifecycle-operator/test/api/metrics/v1alpha3/keptnmetric_types.go diff --git a/operator/test/api/metrics/v1alpha3/zz_generated.deepcopy.go b/lifecycle-operator/test/api/metrics/v1alpha3/zz_generated.deepcopy.go similarity index 100% rename from operator/test/api/metrics/v1alpha3/zz_generated.deepcopy.go rename to lifecycle-operator/test/api/metrics/v1alpha3/zz_generated.deepcopy.go diff --git a/operator/test/component/DEVELOPER.md b/lifecycle-operator/test/component/DEVELOPER.md similarity index 100% rename from operator/test/component/DEVELOPER.md rename to lifecycle-operator/test/component/DEVELOPER.md diff --git a/operator/test/component/app/app_suite_test.go b/lifecycle-operator/test/component/app/app_suite_test.go similarity index 80% rename from operator/test/component/app/app_suite_test.go rename to lifecycle-operator/test/component/app/app_suite_test.go index 58028bda63..255681189e 100644 --- a/operator/test/component/app/app_suite_test.go +++ b/lifecycle-operator/test/component/app/app_suite_test.go @@ -6,9 +6,9 @@ import ( "testing" "time" - controllercommon "github.com/keptn/lifecycle-toolkit/operator/controllers/common" - "github.com/keptn/lifecycle-toolkit/operator/controllers/lifecycle/keptnapp" - "github.com/keptn/lifecycle-toolkit/operator/test/component/common" + controllercommon "github.com/keptn/lifecycle-toolkit/lifecycle-operator/controllers/common" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/controllers/lifecycle/keptnapp" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/test/component/common" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" otelsdk "go.opentelemetry.io/otel/sdk/trace" @@ -36,7 +36,7 @@ var _ = BeforeSuite(func() { var readyToStart chan struct{} ctx, k8sManager, tracer, spanRecorder, k8sClient, readyToStart = common.InitSuite() - ////setup controllers here + // //setup controllers here controller := &keptnapp.KeptnAppReconciler{ Client: k8sManager.GetClient(), Scheme: k8sManager.GetScheme(), @@ -49,7 +49,7 @@ var _ = BeforeSuite(func() { }) var _ = ReportAfterSuite("custom report", func(report Report) { - f, err := os.Create("report.app-operator") + f, err := os.Create("report.app-lifecycle-operator") Expect(err).ToNot(HaveOccurred(), "failed to generate report") for _, specReport := range report.SpecReports { common.WriteReport(specReport, f) diff --git a/operator/test/component/app/app_test.go b/lifecycle-operator/test/component/app/app_test.go similarity index 91% rename from operator/test/component/app/app_test.go rename to lifecycle-operator/test/component/app/app_test.go index 377b171908..4a565f53c1 100644 --- a/operator/test/component/app/app_test.go +++ b/lifecycle-operator/test/component/app/app_test.go @@ -3,9 +3,9 @@ package app_test import ( "fmt" - klcv1alpha3 "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3" - apicommon "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3/common" - "github.com/keptn/lifecycle-toolkit/operator/test/component/common" + klcv1alpha3 "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3" + apicommon "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3/common" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/test/component/common" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" otelsdk "go.opentelemetry.io/otel/sdk/trace" diff --git a/operator/test/component/appversion/appversion_suite_test.go b/lifecycle-operator/test/component/appversion/appversion_suite_test.go similarity index 76% rename from operator/test/component/appversion/appversion_suite_test.go rename to lifecycle-operator/test/component/appversion/appversion_suite_test.go index 03fde57f76..08a389e7aa 100644 --- a/operator/test/component/appversion/appversion_suite_test.go +++ b/lifecycle-operator/test/component/appversion/appversion_suite_test.go @@ -6,9 +6,10 @@ import ( "testing" "time" - controllercommon "github.com/keptn/lifecycle-toolkit/operator/controllers/common" - "github.com/keptn/lifecycle-toolkit/operator/controllers/lifecycle/keptnappversion" - "github.com/keptn/lifecycle-toolkit/operator/test/component/common" + controllercommon "github.com/keptn/lifecycle-toolkit/lifecycle-operator/controllers/common" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/controllers/common/telemetry" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/controllers/lifecycle/keptnappversion" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/test/component/common" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" otelsdk "go.opentelemetry.io/otel/sdk/trace" @@ -36,14 +37,14 @@ var _ = BeforeSuite(func() { var readyToStart chan struct{} ctx, k8sManager, tracer, spanRecorder, k8sClient, readyToStart = common.InitSuite() - ////setup controllers here + // //setup controllers here controller := &keptnappversion.KeptnAppVersionReconciler{ Client: k8sManager.GetClient(), Scheme: k8sManager.GetScheme(), EventSender: controllercommon.NewEventSender(k8sManager.GetEventRecorderFor("test-appversion-controller")), Log: GinkgoLogr, Meters: common.InitKeptnMeters(), - SpanHandler: &controllercommon.SpanHandler{}, + SpanHandler: &telemetry.SpanHandler{}, TracerFactory: &common.TracerFactory{Tracer: tracer}, } Eventually(controller.SetupWithManager(k8sManager)).WithTimeout(30 * time.Second).WithPolling(time.Second).Should(Succeed()) @@ -51,7 +52,7 @@ var _ = BeforeSuite(func() { }) var _ = ReportAfterSuite("custom report", func(report Report) { - f, err := os.Create("report.appversion-operator") + f, err := os.Create("report.appversion-lifecycle-operator") Expect(err).ToNot(HaveOccurred(), "failed to generate report") for _, specReport := range report.SpecReports { common.WriteReport(specReport, f) diff --git a/operator/test/component/appversion/appversion_test.go b/lifecycle-operator/test/component/appversion/appversion_test.go similarity index 95% rename from operator/test/component/appversion/appversion_test.go rename to lifecycle-operator/test/component/appversion/appversion_test.go index e657882680..1cd4a403ad 100644 --- a/operator/test/component/appversion/appversion_test.go +++ b/lifecycle-operator/test/component/appversion/appversion_test.go @@ -5,9 +5,9 @@ import ( "strings" "time" - klcv1alpha3 "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3" - apicommon "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3/common" - "github.com/keptn/lifecycle-toolkit/operator/test/component/common" + klcv1alpha3 "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3" + apicommon "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3/common" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/test/component/common" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" corev1 "k8s.io/api/core/v1" diff --git a/operator/test/component/common/common.go b/lifecycle-operator/test/component/common/common.go similarity index 94% rename from operator/test/component/common/common.go rename to lifecycle-operator/test/component/common/common.go index 3dbffcfa17..3f82e8abad 100644 --- a/operator/test/component/common/common.go +++ b/lifecycle-operator/test/component/common/common.go @@ -8,10 +8,10 @@ import ( "strings" "time" - klcv1alpha3 "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3" - apicommon "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3/common" - controllercommon "github.com/keptn/lifecycle-toolkit/operator/controllers/common" - metricsapi "github.com/keptn/lifecycle-toolkit/operator/test/api/metrics/v1alpha3" + klcv1alpha3 "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3" + apicommon "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3/common" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/controllers/common/telemetry" + metricsapi "github.com/keptn/lifecycle-toolkit/lifecycle-operator/test/api/metrics/v1alpha3" . "github.com/onsi/ginkgo/v2" ginkgotypes "github.com/onsi/ginkgo/v2/types" . "github.com/onsi/gomega" @@ -63,7 +63,7 @@ type TracerFactory struct { Tracer trace.TracerProvider } -func (f *TracerFactory) GetTracer(name string) controllercommon.ITracer { +func (f *TracerFactory) GetTracer(name string) telemetry.ITracer { return f.Tracer.Tracer(name) } diff --git a/operator/test/component/evaluation/evaluation_suite_test.go b/lifecycle-operator/test/component/evaluation/evaluation_suite_test.go similarity index 82% rename from operator/test/component/evaluation/evaluation_suite_test.go rename to lifecycle-operator/test/component/evaluation/evaluation_suite_test.go index 5275362a48..3bf626377e 100644 --- a/operator/test/component/evaluation/evaluation_suite_test.go +++ b/lifecycle-operator/test/component/evaluation/evaluation_suite_test.go @@ -6,9 +6,9 @@ import ( "testing" "time" - controllercommon "github.com/keptn/lifecycle-toolkit/operator/controllers/common" - "github.com/keptn/lifecycle-toolkit/operator/controllers/lifecycle/keptnevaluation" - "github.com/keptn/lifecycle-toolkit/operator/test/component/common" + controllercommon "github.com/keptn/lifecycle-toolkit/lifecycle-operator/controllers/common" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/controllers/lifecycle/keptnevaluation" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/test/component/common" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" otelsdk "go.opentelemetry.io/otel/sdk/trace" @@ -40,7 +40,7 @@ var _ = BeforeSuite(func() { var readyToStart chan struct{} ctx, k8sManager, tracer, spanRecorder, k8sClient, readyToStart = common.InitSuite() - ////setup controllers here + // //setup controllers here controller := &keptnevaluation.KeptnEvaluationReconciler{ Client: k8sManager.GetClient(), Scheme: k8sManager.GetScheme(), @@ -57,7 +57,7 @@ var _ = BeforeSuite(func() { }) var _ = ReportAfterSuite("custom report", func(report Report) { - f, err := os.Create("report.evaluation-operator") + f, err := os.Create("report.evaluation-lifecycle-operator") Expect(err).ToNot(HaveOccurred(), "failed to generate report") for _, specReport := range report.SpecReports { common.WriteReport(specReport, f) diff --git a/operator/test/component/evaluation/evaluation_test.go b/lifecycle-operator/test/component/evaluation/evaluation_test.go similarity index 95% rename from operator/test/component/evaluation/evaluation_test.go rename to lifecycle-operator/test/component/evaluation/evaluation_test.go index 4fb3f2fd29..da0a442c43 100644 --- a/operator/test/component/evaluation/evaluation_test.go +++ b/lifecycle-operator/test/component/evaluation/evaluation_test.go @@ -5,11 +5,11 @@ import ( "fmt" "time" - klcv1alpha3 "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3" - apicommon "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3/common" - controllercommon "github.com/keptn/lifecycle-toolkit/operator/controllers/common" - metricsapi "github.com/keptn/lifecycle-toolkit/operator/test/api/metrics/v1alpha3" - "github.com/keptn/lifecycle-toolkit/operator/test/component/common" + klcv1alpha3 "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3" + apicommon "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3/common" + controllercommon "github.com/keptn/lifecycle-toolkit/lifecycle-operator/controllers/common" + metricsapi "github.com/keptn/lifecycle-toolkit/lifecycle-operator/test/api/metrics/v1alpha3" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/test/component/common" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" v1 "k8s.io/api/core/v1" diff --git a/operator/test/component/load/load_suite_test.go b/lifecycle-operator/test/component/load/load_suite_test.go similarity index 80% rename from operator/test/component/load/load_suite_test.go rename to lifecycle-operator/test/component/load/load_suite_test.go index 1b4812bfbd..d86bd61a08 100644 --- a/operator/test/component/load/load_suite_test.go +++ b/lifecycle-operator/test/component/load/load_suite_test.go @@ -6,9 +6,9 @@ import ( "testing" "time" - controllercommon "github.com/keptn/lifecycle-toolkit/operator/controllers/common" - "github.com/keptn/lifecycle-toolkit/operator/controllers/lifecycle/keptnapp" - "github.com/keptn/lifecycle-toolkit/operator/test/component/common" + controllercommon "github.com/keptn/lifecycle-toolkit/lifecycle-operator/controllers/common" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/controllers/lifecycle/keptnapp" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/test/component/common" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" otelsdk "go.opentelemetry.io/otel/sdk/trace" @@ -36,7 +36,7 @@ var _ = BeforeSuite(func() { var readyToStart chan struct{} ctx, k8sManager, tracer, spanRecorder, k8sClient, readyToStart = common.InitSuite() - ////setup controllers here + // //setup controllers here controller := &keptnapp.KeptnAppReconciler{ Client: k8sManager.GetClient(), Scheme: k8sManager.GetScheme(), @@ -49,7 +49,7 @@ var _ = BeforeSuite(func() { }) var _ = ReportAfterSuite("custom report", func(report Report) { - f, err := os.Create("report.load-operator") + f, err := os.Create("report.load-lifecycle-operator") Expect(err).ToNot(HaveOccurred(), "failed to generate report") for _, specReport := range report.SpecReports { common.WriteReport(specReport, f) diff --git a/operator/test/component/load/load_test.go b/lifecycle-operator/test/component/load/load_test.go similarity index 89% rename from operator/test/component/load/load_test.go rename to lifecycle-operator/test/component/load/load_test.go index 0e0eaf9861..ad6f99d3bf 100644 --- a/operator/test/component/load/load_test.go +++ b/lifecycle-operator/test/component/load/load_test.go @@ -7,8 +7,8 @@ import ( "path" "time" - klcv1alpha3 "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3" - "github.com/keptn/lifecycle-toolkit/operator/test/component/common" + klcv1alpha3 "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/test/component/common" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -23,7 +23,7 @@ const LOAD = 100 var _ = Describe("Load", Ordered, func() { var ( - apps []*klcv1alpha3.KeptnApp //Shelf is declared here + apps []*klcv1alpha3.KeptnApp // Shelf is declared here appVersions []*klcv1alpha3.KeptnAppVersion metrics Metric ) diff --git a/operator/test/component/task/task_suite_test.go b/lifecycle-operator/test/component/task/task_suite_test.go similarity index 81% rename from operator/test/component/task/task_suite_test.go rename to lifecycle-operator/test/component/task/task_suite_test.go index b2c82a3098..abf0b7ae54 100644 --- a/operator/test/component/task/task_suite_test.go +++ b/lifecycle-operator/test/component/task/task_suite_test.go @@ -6,9 +6,9 @@ import ( "testing" "time" - controllercommon "github.com/keptn/lifecycle-toolkit/operator/controllers/common" - "github.com/keptn/lifecycle-toolkit/operator/controllers/lifecycle/keptntask" - "github.com/keptn/lifecycle-toolkit/operator/test/component/common" + controllercommon "github.com/keptn/lifecycle-toolkit/lifecycle-operator/controllers/common" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/controllers/lifecycle/keptntask" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/test/component/common" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" otelsdk "go.opentelemetry.io/otel/sdk/trace" @@ -37,7 +37,7 @@ var _ = BeforeSuite(func() { _ = os.Setenv(controllercommon.FunctionRuntimeImageKey, "my-image-js") _ = os.Setenv(controllercommon.PythonRuntimeImageKey, "my-image-py") - ////setup controllers here + // //setup controllers here controller := &keptntask.KeptnTaskReconciler{ Client: k8sManager.GetClient(), Scheme: k8sManager.GetScheme(), @@ -51,7 +51,7 @@ var _ = BeforeSuite(func() { }) var _ = ReportAfterSuite("custom report", func(report Report) { - f, err := os.Create("report.task-operator") + f, err := os.Create("report.task-lifecycle-operator") Expect(err).ToNot(HaveOccurred(), "failed to generate report") for _, specReport := range report.SpecReports { common.WriteReport(specReport, f) diff --git a/operator/test/component/task/task_test.go b/lifecycle-operator/test/component/task/task_test.go similarity index 96% rename from operator/test/component/task/task_test.go rename to lifecycle-operator/test/component/task/task_test.go index 6b10c509b8..26586a6490 100644 --- a/operator/test/component/task/task_test.go +++ b/lifecycle-operator/test/component/task/task_test.go @@ -3,10 +3,10 @@ package task_test import ( "context" - klcv1alpha3 "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3" - apicommon "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3/common" - controllercommon "github.com/keptn/lifecycle-toolkit/operator/controllers/common" - "github.com/keptn/lifecycle-toolkit/operator/test/component/common" + klcv1alpha3 "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3" + apicommon "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3/common" + controllercommon "github.com/keptn/lifecycle-toolkit/lifecycle-operator/controllers/common" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/test/component/common" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" batchv1 "k8s.io/api/batch/v1" diff --git a/operator/test/component/taskdefinition/taskdefinition_suite_test.go b/lifecycle-operator/test/component/taskdefinition/taskdefinition_suite_test.go similarity index 77% rename from operator/test/component/taskdefinition/taskdefinition_suite_test.go rename to lifecycle-operator/test/component/taskdefinition/taskdefinition_suite_test.go index 3f91a8e071..d332e236bf 100644 --- a/operator/test/component/taskdefinition/taskdefinition_suite_test.go +++ b/lifecycle-operator/test/component/taskdefinition/taskdefinition_suite_test.go @@ -5,9 +5,9 @@ import ( "testing" "time" - controllercommon "github.com/keptn/lifecycle-toolkit/operator/controllers/common" - "github.com/keptn/lifecycle-toolkit/operator/controllers/lifecycle/keptntaskdefinition" - "github.com/keptn/lifecycle-toolkit/operator/test/component/common" + controllercommon "github.com/keptn/lifecycle-toolkit/lifecycle-operator/controllers/common" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/controllers/lifecycle/keptntaskdefinition" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/test/component/common" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" ctrl "sigs.k8s.io/controller-runtime" @@ -30,7 +30,7 @@ var _ = BeforeSuite(func() { var readyToStart chan struct{} _, k8sManager, _, _, k8sClient, readyToStart = common.InitSuite() - ////setup controllers here + // //setup controllers here controller := &keptntaskdefinition.KeptnTaskDefinitionReconciler{ Client: k8sManager.GetClient(), Scheme: k8sManager.GetScheme(), @@ -42,7 +42,7 @@ var _ = BeforeSuite(func() { }) var _ = ReportAfterSuite("custom report", func(report Report) { - f, err := os.Create("report.taskdefinition-operator") + f, err := os.Create("report.taskdefinition-lifecycle-operator") Expect(err).ToNot(HaveOccurred(), "failed to generate report") for _, specReport := range report.SpecReports { common.WriteReport(specReport, f) diff --git a/operator/test/component/taskdefinition/taskdefinition_test.go b/lifecycle-operator/test/component/taskdefinition/taskdefinition_test.go similarity index 97% rename from operator/test/component/taskdefinition/taskdefinition_test.go rename to lifecycle-operator/test/component/taskdefinition/taskdefinition_test.go index c08ab34a96..10405d5838 100644 --- a/operator/test/component/taskdefinition/taskdefinition_test.go +++ b/lifecycle-operator/test/component/taskdefinition/taskdefinition_test.go @@ -3,8 +3,8 @@ package taskdefinition_test import ( "context" - klcv1alpha3 "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3" - "github.com/keptn/lifecycle-toolkit/operator/test/component/common" + klcv1alpha3 "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/test/component/common" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" v1 "k8s.io/api/core/v1" diff --git a/operator/test/component/workload/workload_suite_test.go b/lifecycle-operator/test/component/workload/workload_suite_test.go similarity index 80% rename from operator/test/component/workload/workload_suite_test.go rename to lifecycle-operator/test/component/workload/workload_suite_test.go index 0cf832cd46..a930493afd 100644 --- a/operator/test/component/workload/workload_suite_test.go +++ b/lifecycle-operator/test/component/workload/workload_suite_test.go @@ -6,9 +6,9 @@ import ( "testing" "time" - controllercommon "github.com/keptn/lifecycle-toolkit/operator/controllers/common" - "github.com/keptn/lifecycle-toolkit/operator/controllers/lifecycle/keptnworkload" - "github.com/keptn/lifecycle-toolkit/operator/test/component/common" + controllercommon "github.com/keptn/lifecycle-toolkit/lifecycle-operator/controllers/common" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/controllers/lifecycle/keptnworkload" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/test/component/common" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" otelsdk "go.opentelemetry.io/otel/sdk/trace" @@ -36,7 +36,7 @@ var _ = BeforeSuite(func() { var readyToStart chan struct{} ctx, k8sManager, tracer, spanRecorder, k8sClient, readyToStart = common.InitSuite() - ////setup controllers here + // //setup controllers here controller := &keptnworkload.KeptnWorkloadReconciler{ Client: k8sManager.GetClient(), Scheme: k8sManager.GetScheme(), @@ -49,7 +49,7 @@ var _ = BeforeSuite(func() { }) var _ = ReportAfterSuite("custom report", func(report Report) { - f, err := os.Create("report.workload-operator") + f, err := os.Create("report.workload-lifecycle-operator") Expect(err).ToNot(HaveOccurred(), "failed to generate report") for _, specReport := range report.SpecReports { common.WriteReport(specReport, f) diff --git a/operator/test/component/workload/workload_test.go b/lifecycle-operator/test/component/workload/workload_test.go similarity index 93% rename from operator/test/component/workload/workload_test.go rename to lifecycle-operator/test/component/workload/workload_test.go index 7447dbe779..c083b53170 100644 --- a/operator/test/component/workload/workload_test.go +++ b/lifecycle-operator/test/component/workload/workload_test.go @@ -4,9 +4,9 @@ import ( "context" "fmt" - klcv1alpha3 "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3" - apicommon "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3/common" - "github.com/keptn/lifecycle-toolkit/operator/test/component/common" + klcv1alpha3 "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3" + apicommon "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3/common" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/test/component/common" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" otelsdk "go.opentelemetry.io/otel/sdk/trace" diff --git a/operator/test/component/workloadinstance/workloadinstance_suite_test.go b/lifecycle-operator/test/component/workloadinstance/workloadinstance_suite_test.go similarity index 76% rename from operator/test/component/workloadinstance/workloadinstance_suite_test.go rename to lifecycle-operator/test/component/workloadinstance/workloadinstance_suite_test.go index 86774f19cd..446fa3b491 100644 --- a/operator/test/component/workloadinstance/workloadinstance_suite_test.go +++ b/lifecycle-operator/test/component/workloadinstance/workloadinstance_suite_test.go @@ -6,9 +6,10 @@ import ( "testing" "time" - controllercommon "github.com/keptn/lifecycle-toolkit/operator/controllers/common" - "github.com/keptn/lifecycle-toolkit/operator/controllers/lifecycle/keptnworkloadinstance" - "github.com/keptn/lifecycle-toolkit/operator/test/component/common" + controllercommon "github.com/keptn/lifecycle-toolkit/lifecycle-operator/controllers/common" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/controllers/common/telemetry" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/controllers/lifecycle/keptnworkloadinstance" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/test/component/common" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" otelsdk "go.opentelemetry.io/otel/sdk/trace" @@ -36,14 +37,14 @@ var _ = BeforeSuite(func() { var readyToStart chan struct{} ctx, k8sManager, tracer, spanRecorder, k8sClient, readyToStart = common.InitSuite() - ////setup controllers here + // //setup controllers here controller := &keptnworkloadinstance.KeptnWorkloadInstanceReconciler{ Client: k8sManager.GetClient(), Scheme: k8sManager.GetScheme(), EventSender: controllercommon.NewEventSender(k8sManager.GetEventRecorderFor("test-workloadinstance-controller")), Log: GinkgoLogr, Meters: common.InitKeptnMeters(), - SpanHandler: &controllercommon.SpanHandler{}, + SpanHandler: &telemetry.SpanHandler{}, TracerFactory: &common.TracerFactory{Tracer: tracer}, } Eventually(controller.SetupWithManager(k8sManager)).WithTimeout(30 * time.Second).WithPolling(time.Second).Should(Succeed()) @@ -51,7 +52,7 @@ var _ = BeforeSuite(func() { }) var _ = ReportAfterSuite("custom report", func(report Report) { - f, err := os.Create("report.workloadinstance-operator") + f, err := os.Create("report.workloadinstance-lifecycle-operator") Expect(err).ToNot(HaveOccurred(), "failed to generate report") for _, specReport := range report.SpecReports { common.WriteReport(specReport, f) diff --git a/operator/test/component/workloadinstance/workloadinstance_test.go b/lifecycle-operator/test/component/workloadinstance/workloadinstance_test.go similarity index 98% rename from operator/test/component/workloadinstance/workloadinstance_test.go rename to lifecycle-operator/test/component/workloadinstance/workloadinstance_test.go index 29ab3491fe..5550f1f1c2 100644 --- a/operator/test/component/workloadinstance/workloadinstance_test.go +++ b/lifecycle-operator/test/component/workloadinstance/workloadinstance_test.go @@ -5,9 +5,9 @@ import ( "strings" "time" - klcv1alpha3 "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3" - apicommon "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3/common" - "github.com/keptn/lifecycle-toolkit/operator/test/component/common" + klcv1alpha3 "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3" + apicommon "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3/common" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/test/component/common" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" appsv1 "k8s.io/api/apps/v1" diff --git a/operator/test/e2e/DEVELOPER.md b/lifecycle-operator/test/e2e/DEVELOPER.md similarity index 97% rename from operator/test/e2e/DEVELOPER.md rename to lifecycle-operator/test/e2e/DEVELOPER.md index 65952c9267..4ab5ecefdf 100644 --- a/operator/test/e2e/DEVELOPER.md +++ b/lifecycle-operator/test/e2e/DEVELOPER.md @@ -7,7 +7,7 @@ This test suite can run test verifying the operator ```shell kind create cluster cd lifecycle-toolkit -make build-deploy-operator RELEASE_REGISTRY=yourregistry +make build-deploy-lifecycle-operator RELEASE_REGISTRY=yourregistry ``` diff --git a/operator/test/e2e/operator_test.go b/lifecycle-operator/test/e2e/operator_test.go similarity index 100% rename from operator/test/e2e/operator_test.go rename to lifecycle-operator/test/e2e/operator_test.go diff --git a/operator/test/e2e/suite_test.go b/lifecycle-operator/test/e2e/suite_test.go similarity index 95% rename from operator/test/e2e/suite_test.go rename to lifecycle-operator/test/e2e/suite_test.go index f7fe0a185a..833e25c678 100644 --- a/operator/test/e2e/suite_test.go +++ b/lifecycle-operator/test/e2e/suite_test.go @@ -24,7 +24,7 @@ import ( "testing" "time" - klcv1alpha3 "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3" + klcv1alpha3 "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3" . "github.com/onsi/ginkgo/v2" "github.com/onsi/ginkgo/v2/types" . "github.com/onsi/gomega" @@ -99,7 +99,7 @@ func ignoreAlreadyExists(err error) error { } var _ = ReportAfterSuite("custom report", func(report Report) { - f, err := os.Create("report.E2E-operator") + f, err := os.Create("report.E2E-lifecycle-operator") Expect(err).ToNot(HaveOccurred(), "failed to generate report") fmt.Fprintf(f, "%s \n", time.Now().UTC()) diff --git a/operator/webhooks/config.go b/lifecycle-operator/webhooks/config.go similarity index 100% rename from operator/webhooks/config.go rename to lifecycle-operator/webhooks/config.go diff --git a/operator/webhooks/pod_mutator/pod_mutating_webhook.go b/lifecycle-operator/webhooks/pod_mutator/pod_mutating_webhook.go similarity index 94% rename from operator/webhooks/pod_mutator/pod_mutating_webhook.go rename to lifecycle-operator/webhooks/pod_mutator/pod_mutating_webhook.go index d7183acf8c..c291fe5616 100644 --- a/operator/webhooks/pod_mutator/pod_mutating_webhook.go +++ b/lifecycle-operator/webhooks/pod_mutator/pod_mutating_webhook.go @@ -11,11 +11,11 @@ import ( argov1alpha1 "github.com/argoproj/argo-rollouts/pkg/apis/rollouts/v1alpha1" "github.com/go-logr/logr" - klcv1alpha3 "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3" - apicommon "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3/common" - "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3/semconv" - operatorcommon "github.com/keptn/lifecycle-toolkit/operator/common" - controllercommon "github.com/keptn/lifecycle-toolkit/operator/controllers/common" + klcv1alpha3 "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3" + apicommon "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3/common" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3/semconv" + operatorcommon "github.com/keptn/lifecycle-toolkit/lifecycle-operator/common" + controllercommon "github.com/keptn/lifecycle-toolkit/lifecycle-operator/controllers/common" "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/codes" "go.opentelemetry.io/otel/propagation" @@ -39,7 +39,7 @@ type PodMutatingWebhook struct { Client client.Client Tracer trace.Tracer Decoder *admission.Decoder - EventSender controllercommon.EventSender + EventSender controllercommon.IEvent Log logr.Logger } @@ -288,7 +288,7 @@ func (a *PodMutatingWebhook) handleWorkload(ctx context.Context, logger logr.Log err = a.Client.Create(ctx, workload) if err != nil { logger.Error(err, "Could not create Workload") - a.EventSender.SendK8sEvent(apicommon.PhaseCreateWorkload, "Warning", workload, apicommon.PhaseStateFailed, "could not create KeptnWorkload", workload.Spec.Version) + a.EventSender.Emit(apicommon.PhaseCreateWorkload, "Warning", workload, apicommon.PhaseStateFailed, "could not create KeptnWorkload", workload.Spec.Version) span.SetStatus(codes.Error, err.Error()) return err } @@ -312,7 +312,7 @@ func (a *PodMutatingWebhook) handleWorkload(ctx context.Context, logger logr.Log err = a.Client.Update(ctx, workload) if err != nil { logger.Error(err, "Could not update Workload") - a.EventSender.SendK8sEvent(apicommon.PhaseUpdateWorkload, "Warning", workload, apicommon.PhaseStateFailed, "could not update KeptnWorkload", workload.Spec.Version) + a.EventSender.Emit(apicommon.PhaseUpdateWorkload, "Warning", workload, apicommon.PhaseStateFailed, "could not update KeptnWorkload", workload.Spec.Version) span.SetStatus(codes.Error, err.Error()) return err } @@ -340,7 +340,7 @@ func (a *PodMutatingWebhook) handleApp(ctx context.Context, logger logr.Logger, err = a.Client.Create(ctx, appCreationRequest) if err != nil { logger.Error(err, "Could not create AppCreationRequest") - a.EventSender.SendK8sEvent(apicommon.PhaseCreateAppCreationRequest, "Warning", appCreationRequest, apicommon.PhaseStateFailed, "could not create KeptnAppCreationRequest", appCreationRequest.Spec.AppName) + a.EventSender.Emit(apicommon.PhaseCreateAppCreationRequest, "Warning", appCreationRequest, apicommon.PhaseStateFailed, "could not create KeptnAppCreationRequest", appCreationRequest.Spec.AppName) span.SetStatus(codes.Error, err.Error()) return err } diff --git a/operator/webhooks/pod_mutator/pod_mutating_webhook_test.go b/lifecycle-operator/webhooks/pod_mutator/pod_mutating_webhook_test.go similarity index 98% rename from operator/webhooks/pod_mutator/pod_mutating_webhook_test.go rename to lifecycle-operator/webhooks/pod_mutator/pod_mutating_webhook_test.go index 67971737bf..1fb0c46d06 100644 --- a/operator/webhooks/pod_mutator/pod_mutating_webhook_test.go +++ b/lifecycle-operator/webhooks/pod_mutator/pod_mutating_webhook_test.go @@ -8,10 +8,10 @@ import ( "github.com/go-logr/logr" "github.com/go-logr/logr/testr" - klcv1alpha3 "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3" - apicommon "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3/common" - controllercommon "github.com/keptn/lifecycle-toolkit/operator/controllers/common" - fakeclient "github.com/keptn/lifecycle-toolkit/operator/controllers/common/fake" + klcv1alpha3 "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3" + apicommon "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3/common" + controllercommon "github.com/keptn/lifecycle-toolkit/lifecycle-operator/controllers/common" + fakeclient "github.com/keptn/lifecycle-toolkit/lifecycle-operator/controllers/common/fake" "github.com/stretchr/testify/require" "go.opentelemetry.io/otel/trace" admissionv1 "k8s.io/api/admission/v1" @@ -31,7 +31,7 @@ func TestPodMutatingWebhook_getOwnerReference(t *testing.T) { Client client.Client Tracer trace.Tracer Decoder *admission.Decoder - EventSender controllercommon.EventSender + EventSender controllercommon.IEvent Log logr.Logger } type args struct { @@ -104,7 +104,7 @@ func TestPodMutatingWebhook_getAppName(t *testing.T) { Client client.Client Tracer trace.Tracer Decoder *admission.Decoder - EventSender controllercommon.EventSender + EventSender controllercommon.IEvent Log logr.Logger } type args struct { @@ -180,7 +180,7 @@ func TestPodMutatingWebhook_getWorkloadName(t *testing.T) { Client client.Client Tracer trace.Tracer Decoder *admission.Decoder - EventSender controllercommon.EventSender + EventSender controllercommon.IEvent Log logr.Logger } type args struct { @@ -370,7 +370,7 @@ func TestPodMutatingWebhook_isPodAnnotated(t *testing.T) { Client client.Client Tracer trace.Tracer Decoder *admission.Decoder - EventSender controllercommon.EventSender + EventSender controllercommon.IEvent Log logr.Logger } type args struct { @@ -541,7 +541,7 @@ func TestPodMutatingWebhook_copyAnnotationsIfParentAnnotated(t *testing.T) { Client client.Client Tracer trace.Tracer Decoder *admission.Decoder - EventSender controllercommon.EventSender + EventSender controllercommon.IEvent Log logr.Logger } type args struct { @@ -711,7 +711,7 @@ func TestPodMutatingWebhook_copyResourceLabelsIfPresent(t *testing.T) { Client client.Client Tracer trace.Tracer Decoder *admission.Decoder - EventSender controllercommon.EventSender + EventSender controllercommon.IEvent Log logr.Logger } type args struct { @@ -873,7 +873,7 @@ func TestPodMutatingWebhook_isAppAnnotationPresent(t *testing.T) { Client client.Client Tracer trace.Tracer Decoder *admission.Decoder - EventSender controllercommon.EventSender + EventSender controllercommon.IEvent Log logr.Logger } type args struct { diff --git a/metrics-operator/Dockerfile b/metrics-operator/Dockerfile index 74d0133568..c71dd3c1f9 100644 --- a/metrics-operator/Dockerfile +++ b/metrics-operator/Dockerfile @@ -45,9 +45,9 @@ ENTRYPOINT ["/manager"] FROM gcr.io/distroless/static-debian11:nonroot AS production -LABEL org.opencontainers.image.source="https://github.com/keptn/lifecycle-toolkit" \ +LABEL org.opencontainers.image.source="https://github.com/keptn/lifecycle-toolkit/metrics-operator" \ org.opencontainers.image.url="https://keptn.sh" \ - org.opencontainers.image.title="Keptn Lifecycle Operator" \ + org.opencontainers.image.title="Keptn Metrics Operator" \ org.opencontainers.image.vendor="Keptn" \ org.opencontainers.image.licenses="Apache-2.0" diff --git a/metrics-operator/api/v1alpha2/keptnmetricsprovider_types.go b/metrics-operator/api/v1alpha2/keptnmetricsprovider_types.go index f6ebbacd00..0193b5b11f 100644 --- a/metrics-operator/api/v1alpha2/keptnmetricsprovider_types.go +++ b/metrics-operator/api/v1alpha2/keptnmetricsprovider_types.go @@ -29,11 +29,9 @@ type KeptnMetricsProviderSpec struct { SecretKeyRef corev1.SecretKeySelector `json:"secretKeyRef,omitempty"` } -type EmptyStatus struct{} - -//+kubebuilder:object:root=true -//+kubebuilder:subresource:status -//+kubebuilder:resource:path=keptnmetricsproviders,shortName=kmp +// +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:resource:path=keptnmetricsproviders,shortName=kmp // KeptnMetricsProvider is the Schema for the keptnmetricsproviders API type KeptnMetricsProvider struct { @@ -42,10 +40,10 @@ type KeptnMetricsProvider struct { Spec KeptnMetricsProviderSpec `json:"spec,omitempty"` // unused field - Status EmptyStatus `json:"status,omitempty"` + Status string `json:"status,omitempty"` } -//+kubebuilder:object:root=true +// +kubebuilder:object:root=true // KeptnMetricsProviderList contains a list of KeptnMetricsProvider type KeptnMetricsProviderList struct { diff --git a/metrics-operator/api/v1alpha2/zz_generated.deepcopy.go b/metrics-operator/api/v1alpha2/zz_generated.deepcopy.go index e156bcfc40..c160923088 100644 --- a/metrics-operator/api/v1alpha2/zz_generated.deepcopy.go +++ b/metrics-operator/api/v1alpha2/zz_generated.deepcopy.go @@ -25,21 +25,6 @@ import ( runtime "k8s.io/apimachinery/pkg/runtime" ) -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *EmptyStatus) DeepCopyInto(out *EmptyStatus) { - *out = *in -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EmptyStatus. -func (in *EmptyStatus) DeepCopy() *EmptyStatus { - if in == nil { - return nil - } - out := new(EmptyStatus) - in.DeepCopyInto(out) - return out -} - // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *KeptnMetric) DeepCopyInto(out *KeptnMetric) { *out = *in @@ -142,7 +127,6 @@ func (in *KeptnMetricsProvider) DeepCopyInto(out *KeptnMetricsProvider) { out.TypeMeta = in.TypeMeta in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) in.Spec.DeepCopyInto(&out.Spec) - out.Status = in.Status } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KeptnMetricsProvider. diff --git a/metrics-operator/api/v1alpha3/keptnmetric_types.go b/metrics-operator/api/v1alpha3/keptnmetric_types.go index 85f1b3628c..823773a6f9 100644 --- a/metrics-operator/api/v1alpha3/keptnmetric_types.go +++ b/metrics-operator/api/v1alpha3/keptnmetric_types.go @@ -60,6 +60,9 @@ type RangeSpec struct { Interval string `json:"interval,omitempty"` // Step represents the query resolution step width for the data query Step string `json:"step,omitempty"` + // Aggregation defines as the type of aggregation function to be applied on the data. Accepted values: p90, p95, p99, max, min, avg, median + // +kubebuilder:validation:Enum:=p90;p95;p99;max;min;avg;median + Aggregation string `json:"aggregation,omitempty"` } // +kubebuilder:object:root=true diff --git a/metrics-operator/api/v1alpha3/keptnmetric_webhook.go b/metrics-operator/api/v1alpha3/keptnmetric_webhook.go index c3d3baa174..e4c3a2db0b 100644 --- a/metrics-operator/api/v1alpha3/keptnmetric_webhook.go +++ b/metrics-operator/api/v1alpha3/keptnmetric_webhook.go @@ -72,6 +72,9 @@ func (s *KeptnMetric) validateKeptnMetric() error { if err = s.validateRangeStep(); err != nil { allErrs = append(allErrs, err) } + if err = s.validateAggregation(); err != nil { + allErrs = append(allErrs, err) + } if len(allErrs) == 0 { return nil } @@ -110,3 +113,22 @@ func (s *KeptnMetric) validateRangeStep() *field.Error { } return nil } + +func (s *KeptnMetric) validateAggregation() *field.Error { + if s.Spec.Range == nil { + return nil + } + if s.Spec.Range.Step != "" && s.Spec.Range.Aggregation == "" { + return field.Required( + field.NewPath("spec").Child("range").Child("aggregation"), + errors.New("Forbidden! Aggregation field is required if defining the step field").Error(), + ) + } + if s.Spec.Range.Step == "" && s.Spec.Range.Aggregation != "" { + return field.Required( + field.NewPath("spec").Child("range").Child("step"), + errors.New("Forbidden! Step interval is required for the aggregation to work").Error(), + ) + } + return nil +} diff --git a/metrics-operator/api/v1alpha3/keptnmetric_webhook_test.go b/metrics-operator/api/v1alpha3/keptnmetric_webhook_test.go index 9866c28109..b89e66db29 100644 --- a/metrics-operator/api/v1alpha3/keptnmetric_webhook_test.go +++ b/metrics-operator/api/v1alpha3/keptnmetric_webhook_test.go @@ -152,17 +152,29 @@ func TestKeptnMetric_validateRangeStep(t *testing.T) { oldSpec runtime.Object }{ { - name: "create-with-wrong-step", + name: "create-with-right-step-right-aggregation", verb: "create", Spec: KeptnMetricSpec{ Range: &RangeSpec{ - Interval: "5m", - Step: "1mins", + Interval: "5m", + Step: "1m", + Aggregation: "p90", + }, + }, + }, + { + name: "create-with-wrong-step-right-aggregation", + verb: "create", + Spec: KeptnMetricSpec{ + Range: &RangeSpec{ + Interval: "5m", + Step: "1mins", + Aggregation: "p90", }, }, want: apierrors.NewInvalid( schema.GroupKind{Group: "metrics.keptn.sh", Kind: "KeptnMetric"}, - "create-with-wrong-step", + "create-with-wrong-step-right-aggregation", field.ErrorList{ field.Invalid( field.NewPath("spec").Child("range").Child("step"), @@ -173,64 +185,156 @@ func TestKeptnMetric_validateRangeStep(t *testing.T) { ), }, { - name: "create-with-empty-step", + name: "create-with-right-step-wrong-aggregation", verb: "create", Spec: KeptnMetricSpec{ Range: &RangeSpec{ - Interval: "5m", - Step: "", + Interval: "5m", + Step: "1m", + Aggregation: "p91", }, }, }, { - name: "create-with-right-step", + name: "create-with-wrong-step-wrong-aggregation", + verb: "create", + Spec: KeptnMetricSpec{ + Range: &RangeSpec{ + Interval: "5m", + Step: "1mins", + Aggregation: "p91", + }, + }, + want: apierrors.NewInvalid( + schema.GroupKind{Group: "metrics.keptn.sh", Kind: "KeptnMetric"}, + "create-with-wrong-step-wrong-aggregation", + field.ErrorList{ + field.Invalid( + field.NewPath("spec").Child("range").Child("step"), + "1mins", + "Forbidden! The time interval cannot be parsed. Please check for suitable conventions", + ), + }, + ), + }, + { + name: "create-with-empty-step-empty-aggregation", verb: "create", Spec: KeptnMetricSpec{ Range: &RangeSpec{ - Interval: "5m", - Step: "1m", + Interval: "5m", + Step: "", + Aggregation: "", }, }, }, { - name: "create-with-wrong-interval-right-step", - verb: "update", + name: "create-with-step-empty-aggregation", + verb: "create", Spec: KeptnMetricSpec{ Range: &RangeSpec{ - Interval: "5mins", - Step: "1m", + Interval: "5m", + Step: "1m", + Aggregation: "", }, }, want: apierrors.NewInvalid( schema.GroupKind{Group: "metrics.keptn.sh", Kind: "KeptnMetric"}, - "create-with-wrong-interval-right-step", + "create-with-step-empty-aggregation", field.ErrorList{ - field.Invalid( - field.NewPath("spec").Child("range").Child("interval"), - "5mins", - "Forbidden! The time interval cannot be parsed. Please check for suitable conventions", + field.Required( + field.NewPath("spec").Child("range").Child("aggregation"), + "Forbidden! Aggregation field is required if defining the step field", ), }, ), }, { - name: "create-with-wrong-interval-wrong-step", + name: "create-empty-step-with-aggregation", + verb: "create", + Spec: KeptnMetricSpec{ + Range: &RangeSpec{ + Interval: "5m", + Step: "", + Aggregation: "p90", + }, + }, + want: apierrors.NewInvalid( + schema.GroupKind{Group: "metrics.keptn.sh", Kind: "KeptnMetric"}, + "create-empty-step-with-aggregation", + field.ErrorList{ + field.Required( + field.NewPath("spec").Child("range").Child("step"), + "Forbidden! Step interval is required for the aggregation to work", + ), + }, + ), + }, + { + name: "update-with-right-step-right-aggregation", + verb: "update", + Spec: KeptnMetricSpec{ + Range: &RangeSpec{ + Interval: "5m", + Step: "1m", + Aggregation: "p90", + }, + }, + oldSpec: &KeptnMetric{ + Spec: KeptnMetricSpec{ + Range: &RangeSpec{ + Interval: "5m", + Step: "1mins", + Aggregation: "p91", + }, + }, + }, + }, + { + name: "update-with-wrong-step-wrong-aggregation", verb: "update", Spec: KeptnMetricSpec{ Range: &RangeSpec{ - Interval: "5mins", - Step: "1mins", + Interval: "5m", + Step: "1mins", + Aggregation: "p91", }, }, want: apierrors.NewInvalid( schema.GroupKind{Group: "metrics.keptn.sh", Kind: "KeptnMetric"}, - "create-with-wrong-interval-wrong-step", + "update-with-wrong-step-wrong-aggregation", field.ErrorList{ field.Invalid( - field.NewPath("spec").Child("range").Child("interval"), - "5mins", + field.NewPath("spec").Child("range").Child("step"), + "1mins", "Forbidden! The time interval cannot be parsed. Please check for suitable conventions", ), + }, + ), + oldSpec: &KeptnMetric{ + Spec: KeptnMetricSpec{ + Range: &RangeSpec{ + Interval: "5m", + Step: "1m", + Aggregation: "p90", + }, + }, + }, + }, + { + name: "update-with-wrong-step-right-aggregation", + verb: "update", + Spec: KeptnMetricSpec{ + Range: &RangeSpec{ + Interval: "5m", + Step: "1mins", + Aggregation: "p90", + }, + }, + want: apierrors.NewInvalid( + schema.GroupKind{Group: "metrics.keptn.sh", Kind: "KeptnMetric"}, + "update-with-wrong-step-right-aggregation", + field.ErrorList{ field.Invalid( field.NewPath("spec").Child("range").Child("step"), "1mins", @@ -238,50 +342,112 @@ func TestKeptnMetric_validateRangeStep(t *testing.T) { ), }, ), + oldSpec: &KeptnMetric{ + Spec: KeptnMetricSpec{ + Range: &RangeSpec{ + Interval: "5m", + Step: "1m", + Aggregation: "p90", + }, + }, + }, + }, + { + name: "update-with-right-step-wrong-aggregation", + verb: "update", + Spec: KeptnMetricSpec{ + Range: &RangeSpec{ + Interval: "5m", + Step: "1m", + Aggregation: "p91", + }, + }, + oldSpec: &KeptnMetric{ + Spec: KeptnMetricSpec{ + Range: &RangeSpec{ + Interval: "5m", + Step: "1m", + Aggregation: "p90", + }, + }, + }, }, { - name: "update-with-right-step", + name: "update-with-empty-step-empty-aggregation", verb: "update", Spec: KeptnMetricSpec{ Range: &RangeSpec{ - Interval: "5m", - Step: "1m", + Interval: "5m", + Step: "", + Aggregation: "", }, }, oldSpec: &KeptnMetric{ Spec: KeptnMetricSpec{ Range: &RangeSpec{ - Interval: "5m", - Step: "1mins", + Interval: "5m", + Step: "1m", + Aggregation: "p90", }, }, }, }, { - name: "update-with-wrong-step", + name: "update-with-empty-step-with-aggregation", verb: "update", Spec: KeptnMetricSpec{ Range: &RangeSpec{ - Interval: "5m", - Step: "1mins", + Interval: "5m", + Step: "", + Aggregation: "p90", }, }, want: apierrors.NewInvalid( schema.GroupKind{Group: "metrics.keptn.sh", Kind: "KeptnMetric"}, - "update-with-wrong-step", + "update-with-empty-step-with-aggregation", field.ErrorList{ - field.Invalid( + field.Required( field.NewPath("spec").Child("range").Child("step"), - "1mins", - "Forbidden! The time interval cannot be parsed. Please check for suitable conventions", + "Forbidden! Step interval is required for the aggregation to work", + ), + }, + ), + oldSpec: &KeptnMetric{ + Spec: KeptnMetricSpec{ + Range: &RangeSpec{ + Interval: "5m", + Step: "1m", + Aggregation: "p90", + }, + }, + }, + }, + { + name: "update-with-step-empty-aggregation", + verb: "update", + Spec: KeptnMetricSpec{ + Range: &RangeSpec{ + Interval: "5m", + Step: "1m", + Aggregation: "", + }, + }, + want: apierrors.NewInvalid( + schema.GroupKind{Group: "metrics.keptn.sh", Kind: "KeptnMetric"}, + "update-with-step-empty-aggregation", + field.ErrorList{ + field.Required( + field.NewPath("spec").Child("range").Child("aggregation"), + "Forbidden! Aggregation field is required if defining the step field", ), }, ), oldSpec: &KeptnMetric{ Spec: KeptnMetricSpec{ Range: &RangeSpec{ - Interval: "5m", - Step: "1m", + Interval: "5m", + Step: "1m", + Aggregation: "p90", }, }, }, @@ -302,7 +468,7 @@ func TestKeptnMetric_validateRangeStep(t *testing.T) { } else { s = &KeptnMetric{ ObjectMeta: metav1.ObjectMeta{Name: tt.name}, - Spec: KeptnMetricSpec{Range: &RangeSpec{Interval: tt.Spec.Range.Interval, Step: tt.Spec.Range.Step}}, + Spec: KeptnMetricSpec{Range: &RangeSpec{Interval: tt.Spec.Range.Interval, Step: tt.Spec.Range.Step, Aggregation: tt.Spec.Range.Aggregation}}, } } var err error diff --git a/metrics-operator/api/v1alpha3/keptnmetricsprovider_types.go b/metrics-operator/api/v1alpha3/keptnmetricsprovider_types.go index 4614280ba2..f60e6749ef 100644 --- a/metrics-operator/api/v1alpha3/keptnmetricsprovider_types.go +++ b/metrics-operator/api/v1alpha3/keptnmetricsprovider_types.go @@ -36,8 +36,6 @@ type KeptnMetricsProviderSpec struct { SecretKeyRef corev1.SecretKeySelector `json:"secretKeyRef,omitempty"` } -type EmptyStatus struct{} - // +kubebuilder:object:root=true // +kubebuilder:subresource:status // +kubebuilder:resource:path=keptnmetricsproviders,shortName=kmp @@ -50,7 +48,7 @@ type KeptnMetricsProvider struct { Spec KeptnMetricsProviderSpec `json:"spec,omitempty"` // unused field - Status EmptyStatus `json:"status,omitempty"` + Status string `json:"status,omitempty"` } // +kubebuilder:object:root=true diff --git a/metrics-operator/api/v1alpha3/zz_generated.deepcopy.go b/metrics-operator/api/v1alpha3/zz_generated.deepcopy.go index 707a32bb29..e52006c8e0 100644 --- a/metrics-operator/api/v1alpha3/zz_generated.deepcopy.go +++ b/metrics-operator/api/v1alpha3/zz_generated.deepcopy.go @@ -25,21 +25,6 @@ import ( "k8s.io/apimachinery/pkg/runtime" ) -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *EmptyStatus) DeepCopyInto(out *EmptyStatus) { - *out = *in -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EmptyStatus. -func (in *EmptyStatus) DeepCopy() *EmptyStatus { - if in == nil { - return nil - } - out := new(EmptyStatus) - in.DeepCopyInto(out) - return out -} - // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *KeptnMetric) DeepCopyInto(out *KeptnMetric) { *out = *in @@ -147,7 +132,6 @@ func (in *KeptnMetricsProvider) DeepCopyInto(out *KeptnMetricsProvider) { out.TypeMeta = in.TypeMeta in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) in.Spec.DeepCopyInto(&out.Spec) - out.Status = in.Status } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KeptnMetricsProvider. diff --git a/metrics-operator/config/crd/bases/metrics.keptn.sh_keptnmetrics.yaml b/metrics-operator/config/crd/bases/metrics.keptn.sh_keptnmetrics.yaml index 8b8586c32a..cca55c3374 100644 --- a/metrics-operator/config/crd/bases/metrics.keptn.sh_keptnmetrics.yaml +++ b/metrics-operator/config/crd/bases/metrics.keptn.sh_keptnmetrics.yaml @@ -219,6 +219,19 @@ spec: description: Range represents the time range for which data is to be queried properties: + aggregation: + description: 'Aggregation defines as the type of aggregation function + to be applied on the data. Accepted values: p90, p95, p99, max, + min, avg, median' + enum: + - p90 + - p95 + - p99 + - max + - min + - avg + - median + type: string interval: default: 5m description: Interval specifies the duration of the time interval diff --git a/metrics-operator/config/crd/bases/metrics.keptn.sh_keptnmetricsproviders.yaml b/metrics-operator/config/crd/bases/metrics.keptn.sh_keptnmetricsproviders.yaml index bf3b531ea6..886d2a7da9 100644 --- a/metrics-operator/config/crd/bases/metrics.keptn.sh_keptnmetricsproviders.yaml +++ b/metrics-operator/config/crd/bases/metrics.keptn.sh_keptnmetricsproviders.yaml @@ -62,7 +62,7 @@ spec: type: object status: description: unused field - type: object + type: string type: object served: true storage: false @@ -122,7 +122,7 @@ spec: type: object status: description: unused field - type: object + type: string type: object served: true storage: true diff --git a/metrics-operator/go.mod b/metrics-operator/go.mod index b3d0f4f74b..554931a08b 100644 --- a/metrics-operator/go.mod +++ b/metrics-operator/go.mod @@ -3,12 +3,12 @@ module github.com/keptn/lifecycle-toolkit/metrics-operator go 1.20 require ( - github.com/DataDog/datadog-api-client-go/v2 v2.14.0 + github.com/DataDog/datadog-api-client-go/v2 v2.15.0 github.com/benbjohnson/clock v1.3.5 github.com/go-logr/logr v1.2.4 github.com/gorilla/mux v1.8.0 github.com/kelseyhightower/envconfig v1.4.0 - github.com/keptn/lifecycle-toolkit/klt-cert-manager v0.0.0-20230727070347-cba2de5a5cd0 + github.com/keptn/lifecycle-toolkit/klt-cert-manager v0.0.0-20230807110601-88a54f97c157 github.com/open-feature/go-sdk v1.4.0 github.com/pkg/errors v0.9.1 github.com/prometheus/client_golang v1.16.0 @@ -48,6 +48,7 @@ require ( github.com/go-openapi/jsonpointer v0.19.5 // indirect github.com/go-openapi/jsonreference v0.20.0 // indirect github.com/go-openapi/swag v0.22.3 // indirect + github.com/goccy/go-json v0.10.2 // indirect github.com/gogo/protobuf v1.3.2 // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect github.com/golang/protobuf v1.5.3 // indirect diff --git a/metrics-operator/go.sum b/metrics-operator/go.sum index df879087a3..86f0d3c38a 100644 --- a/metrics-operator/go.sum +++ b/metrics-operator/go.sum @@ -43,8 +43,8 @@ dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7 github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= -github.com/DataDog/datadog-api-client-go/v2 v2.14.0 h1:cLkqg/D63I6BAxIIg6g8xMWjrAMXcvb5vbD8ixOVVyo= -github.com/DataDog/datadog-api-client-go/v2 v2.14.0/go.mod h1:kntOqXEh1SmjwSDzW/eJkr9kS7EqttvEkelglWtJRbg= +github.com/DataDog/datadog-api-client-go/v2 v2.15.0 h1:5UVON1xs6Lul4d6R5TmLDqqSJxOkunkm/UdM/fjm+zc= +github.com/DataDog/datadog-api-client-go/v2 v2.15.0/go.mod h1:ZG8wS+y2rUmkRDJZQq7Og7EAPFPage+7vXcmuah2I9o= github.com/DataDog/zstd v1.5.2 h1:vUG4lAyuPCXO0TLbXvPv7EB7cNK1QV/luu55UHLrrn8= github.com/DataDog/zstd v1.5.2/go.mod h1:g4AWEaM3yOg3HYfnJ3YIawPnVdXJh9QME85blwSAmyw= github.com/NYTimes/gziphandler v1.1.1 h1:ZUDjpQae29j0ryrS0u/B8HZfJBtBQHjqw2rQ2cqUQ3I= @@ -148,6 +148,8 @@ github.com/go-openapi/swag v0.22.3 h1:yMBqmnQ0gyZvEb/+KzuWZOXgllrXT4SADYbvDaXHv/ github.com/go-openapi/swag v0.22.3/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI= +github.com/goccy/go-json v0.10.2 h1:CrxCmQqYDkv1z7lO7Wbh2HN93uovUHgrECaO5ZrCXAU= +github.com/goccy/go-json v0.10.2/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= @@ -265,8 +267,8 @@ github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7V github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= github.com/kelseyhightower/envconfig v1.4.0 h1:Im6hONhd3pLkfDFsbRgu68RDNkGF1r3dvMUtDTo2cv8= github.com/kelseyhightower/envconfig v1.4.0/go.mod h1:cccZRl6mQpaq41TPp5QxidR+Sa3axMbJDNb//FQX6Gg= -github.com/keptn/lifecycle-toolkit/klt-cert-manager v0.0.0-20230727070347-cba2de5a5cd0 h1:e0PiUPwUQhm/GeN9SBAZ0qCT/MWmgvxCJ6Fa2TLOsJM= -github.com/keptn/lifecycle-toolkit/klt-cert-manager v0.0.0-20230727070347-cba2de5a5cd0/go.mod h1:c4dEFwlXo62YVmFw4I5cxgSC/gK96NeE9mDxayHasV0= +github.com/keptn/lifecycle-toolkit/klt-cert-manager v0.0.0-20230807110601-88a54f97c157 h1:qEhM16/Ce2+eeeSyJEIDU7a7UVlM2uBPDFQgXneA/7Y= +github.com/keptn/lifecycle-toolkit/klt-cert-manager v0.0.0-20230807110601-88a54f97c157/go.mod h1:c4dEFwlXo62YVmFw4I5cxgSC/gK96NeE9mDxayHasV0= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= diff --git a/operator/controllers/common/eventsender.go b/operator/controllers/common/eventsender.go deleted file mode 100644 index efbcf3131f..0000000000 --- a/operator/controllers/common/eventsender.go +++ /dev/null @@ -1,26 +0,0 @@ -package common - -import ( - "fmt" - - apicommon "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3/common" - "k8s.io/client-go/tools/record" - "sigs.k8s.io/controller-runtime/pkg/client" -) - -type EventSender struct { - recorder record.EventRecorder -} - -func NewEventSender(recorder record.EventRecorder) EventSender { - return EventSender{ - recorder: recorder, - } -} - -// SendK8sEvent creates k8s Event and adds it to Eventqueue -func (s *EventSender) SendK8sEvent(phase apicommon.KeptnPhaseType, eventType string, reconcileObject client.Object, shortReason string, longReason string, version string) { - msg := setEventMessage(phase, reconcileObject, longReason, version) - annotations := setAnnotations(reconcileObject, phase) - s.recorder.AnnotatedEventf(reconcileObject, annotations, eventType, fmt.Sprintf("%s%s", phase.ShortName, shortReason), msg) -} diff --git a/release-please-config.json b/release-please-config.json index 9af8770b58..543fce77c1 100644 --- a/release-please-config.json +++ b/release-please-config.json @@ -1,6 +1,6 @@ { "separate-pull-requests": true, - "last-release-sha": "b37aed920eb766c33ae765ed740bc5e508ac430a", + "last-release-sha": "9bb78bb1c74aeb3524fb258d8c77d8493c42cd4f", "bump-minor-pre-major": true, "bump-patch-for-minor-pre-major": true, "pull-request-title-pattern": "chore: release${component} ${version}", @@ -12,7 +12,7 @@ "prerelease": false, "monorepo-tags": "klt", "draft": false, - "exclude-paths": ["klt-cert-manager"], + "exclude-paths": ["klt-cert-manager", "metrics-operator"], "extra-files": [ "README.md", "operator/config/manager/manager.yaml", @@ -20,7 +20,6 @@ "Makefile", "operator/Makefile", "scheduler/Makefile", - "metrics-operator/Makefile", "docs/content/en/docs/snippets/tasks/install.md", "helm/chart/values.yaml", "helm/chart/README.md" @@ -36,6 +35,17 @@ "extra-files": [ "Makefile" ] + }, + "metrics-operator": { + "package-name": "metrics-operator", + "changelog-path": "CHANGELOG.md", + "release-type": "go", + "monorepo-tags": "metrics-operator", + "prerelease": false, + "draft": false, + "extra-files": [ + "Makefile" + ] } }, "changelog-sections": [ diff --git a/scheduler/go.mod b/scheduler/go.mod index a1c2c97d8b..863e9224c3 100644 --- a/scheduler/go.mod +++ b/scheduler/go.mod @@ -5,7 +5,7 @@ go 1.20 require ( github.com/kelseyhightower/envconfig v1.4.0 github.com/onsi/ginkgo/v2 v2.11.0 - github.com/onsi/gomega v1.27.9 + github.com/onsi/gomega v1.27.10 github.com/pkg/errors v0.9.1 github.com/stretchr/testify v1.8.4 go.opentelemetry.io/otel v0.20.0 diff --git a/scheduler/go.sum b/scheduler/go.sum index e634967b6b..40cb58bb9d 100644 --- a/scheduler/go.sum +++ b/scheduler/go.sum @@ -274,8 +274,8 @@ github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE= github.com/onsi/ginkgo/v2 v2.11.0 h1:WgqUCUt/lT6yXoQ8Wef0fsNn5cAuMK7+KT9UFRz2tcU= github.com/onsi/ginkgo/v2 v2.11.0/go.mod h1:ZhrRA5XmEE3x3rhlzamx/JJvujdZoJ2uvgI7kR0iZvM= -github.com/onsi/gomega v1.27.9 h1:qIyVWbOsvQEye2QCqLsNSeH/5L1RS9vS382erEWfT3o= -github.com/onsi/gomega v1.27.9/go.mod h1:RsS8tutOdbdgzbPtzzATp12yT7kM5I5aElG3evPbQ0M= +github.com/onsi/gomega v1.27.10 h1:naR28SdDFlqrG6kScpT8VWpu1xWY5nJRCF3XaYyBjhI= +github.com/onsi/gomega v1.27.10/go.mod h1:RsS8tutOdbdgzbPtzzATp12yT7kM5I5aElG3evPbQ0M= github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= github.com/opencontainers/selinux v1.10.0 h1:rAiKF8hTcgLI3w0DHm6i0ylVVcOrlgR1kK99DRLDhyU= diff --git a/test/integration/expose-keptn-metric/job-existing-metric.yaml b/test/integration/expose-keptn-metric/job-existing-metric.yaml index 2da9c6d111..17d627edae 100644 --- a/test/integration/expose-keptn-metric/job-existing-metric.yaml +++ b/test/integration/expose-keptn-metric/job-existing-metric.yaml @@ -20,7 +20,7 @@ spec: spec: containers: - name: test-prometheus - image: curlimages/curl:8.1.2 + image: curlimages/curl:8.2.1 args: - /bin/sh - -ec @@ -33,7 +33,7 @@ spec: fi exit 1 - name: test-api-endpoint - image: curlimages/curl:8.1.2 + image: curlimages/curl:8.2.1 # yamllint disable rule:line-length args: - /bin/sh diff --git a/test/integration/expose-keptn-metric/job-no-metric.yaml b/test/integration/expose-keptn-metric/job-no-metric.yaml index da39fd4852..7cbddb06c4 100644 --- a/test/integration/expose-keptn-metric/job-no-metric.yaml +++ b/test/integration/expose-keptn-metric/job-no-metric.yaml @@ -9,7 +9,7 @@ spec: spec: containers: - name: test-prometheus - image: curlimages/curl:8.1.2 + image: curlimages/curl:8.2.1 args: - /bin/sh - -ec @@ -20,7 +20,7 @@ spec: exit 1 fi - name: test-api-endpoint - image: curlimages/curl:8.1.2 + image: curlimages/curl:8.2.1 args: - /bin/sh - -ec diff --git a/test/integration/metrics/01-teststep-install.yaml b/test/integration/metrics/01-teststep-install.yaml index df18fd2531..387c432e30 100644 --- a/test/integration/metrics/01-teststep-install.yaml +++ b/test/integration/metrics/01-teststep-install.yaml @@ -7,5 +7,5 @@ apply: - goodmetric4.yaml - goodmetric5.yaml commands: - - command: kubectl apply -f badmetric1.yaml badmetric2.yaml + - command: kubectl apply -f badmetric1.yaml badmetric2.yaml badmetric3.yaml ignoreFailure: true # we must install ignoring the validating webhook error to proceed with the test diff --git a/test/integration/metrics/02-teststep-assert.yaml b/test/integration/metrics/02-teststep-assert.yaml index 800b17487b..e6f95ad931 100644 --- a/test/integration/metrics/02-teststep-assert.yaml +++ b/test/integration/metrics/02-teststep-assert.yaml @@ -3,6 +3,7 @@ kind: TestStep error: # this checks that kubectl get resource fails, AKA bad CRD not added - badmetric1.yaml - badmetric2.yaml + - badmetric3.yaml assert: # this checks that kubectl get resource succeeds - goodmetric1.yaml - goodmetric2.yaml diff --git a/test/integration/metrics/badmetric3.yaml b/test/integration/metrics/badmetric3.yaml new file mode 100644 index 0000000000..b93558a173 --- /dev/null +++ b/test/integration/metrics/badmetric3.yaml @@ -0,0 +1,13 @@ +apiVersion: metrics.keptn.sh/v1alpha3 +kind: KeptnMetric +metadata: + name: podtato-head1 +spec: + provider: + name: "my-provider" + query: "sum(kube_pod_container_resource_limits{resource='cpu'})" + fetchIntervalSeconds: 5 + range: + interval: "5m" + step: "1m" + aggreagation: "p91" diff --git a/test/integration/metrics/goodmetric5.yaml b/test/integration/metrics/goodmetric5.yaml index c75927e64c..554a7121a6 100644 --- a/test/integration/metrics/goodmetric5.yaml +++ b/test/integration/metrics/goodmetric5.yaml @@ -10,3 +10,4 @@ spec: range: interval: "5m" step: "1m" + aggregation: "p90"