Skip to content

Commit

Permalink
Merge branch 'main' into feat/613/kacr-controller
Browse files Browse the repository at this point in the history
  • Loading branch information
bacherfl authored Apr 18, 2023
2 parents 002fbe3 + 80d0045 commit 802425d
Show file tree
Hide file tree
Showing 74 changed files with 656 additions and 264 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/CI.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ jobs:
run: rsync -av --delete --exclude='charts/*.tgz' ./helm/chart/ ./helm-charts-repository/charts/keptn-lifecycle-toolkit/

- name: Create Pull Request
uses: peter-evans/create-pull-request@v4
uses: peter-evans/create-pull-request@v5
with:
token: ${{ secrets.KEPTN_BOT_TOKEN }}
path: ./helm-charts-repository
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ jobs:
password: ${{ secrets.GITHUB_TOKEN }}

- name: Set up Cosign
uses: sigstore/[email protected].1
uses: sigstore/[email protected].2

- name: Build Docker Image
id: docker_build_image
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/security-scans.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:
echo "RUN_ID=$RUN_ID" >> $GITHUB_OUTPUT
- name: Download all artifacts from last successful build of main branch
uses: dawidd6/[email protected].0
uses: dawidd6/[email protected].1
id: download_artifacts_push
with:
# Download last successful artifact from a CI build
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/set-date.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ jobs:
}
}' -f org=$ORGANIZATION -F number=$PROJECT_NUMBER > project_data.json
echo 'PROJECT_ID='$(jq '.data.organization.projectV2.id' project_data.json) >> $GITHUB_ENV
echo 'START_DATE_FIELD_ID='\
$(jq '.data.organization.projectV2.fields.nodes[] | select(.name== "Start Date") | .id' project_data.json) >> $GITHUB_ENV
echo 'END_DATE_FIELD_ID='\
$(jq '.data.organization.projectV2.fields.nodes[] | select(.name== "End Date") | .id' project_data.json) >> $GITHUB_ENV
echo 'START_DATE_FIELD_ID='$(jq '.data.organization.projectV2.fields.nodes[] | select(.name== "Start Date") | .id' project_data.json) \
>> $GITHUB_ENV
echo 'END_DATE_FIELD_ID='$(jq '.data.organization.projectV2.fields.nodes[] | select(.name== "End Date") | .id' project_data.json) \
>> $GITHUB_ENV
- name: Get date
run: echo "DATE=$(date +"%Y-%m-%d")" >> $GITHUB_ENV
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ manifests/
## Kubebuilder
**/kubebuilder
/docs/tmp/
/docs/.hugo_build.lock
/docs/resources/_gen
/docs/public
node_modules

# Helm readme generator project
readme-generator-for-helm/
Expand Down
20 changes: 20 additions & 0 deletions .markdownlint-cli2.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
config:
line-length:
line_length: 120
tables: false
code_blocks: false
no-inline-html:
allowed_elements:
- details
- summary
github-admonition: true
max-one-sentence-per-line: true

customRules:
- "./docs/rules/admonition.js"
- "./docs/rules/max-one-sentence-per-line.js"

ignores:
- "CHANGELOG.md"
- "node_modules"
- "docs/tmp"
8 changes: 0 additions & 8 deletions .markdownlint.yaml

This file was deleted.

1 change: 0 additions & 1 deletion .markdownlintignore

This file was deleted.

2 changes: 1 addition & 1 deletion .yamllint
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ rules:
key-duplicates: enable
key-ordering: disable
line-length:
max: 150
max: 155
new-line-at-end-of-file: enable
new-lines: enable
octal-values: enable
Expand Down
3 changes: 2 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,8 @@ git push --set-upstream origin feature/123/foo
> Note:
All PRs must include a commit message with a description of the changes made!

Make sure you **sign off your commits**. To do this automatically check [this](https://github.com/keptn/lifecycle-toolkit/blob/main/CONTRIBUTING.md#auto-signoff-commit-messages).
Make sure you **sign off your commits**.
To do this automatically check [this](https://github.com/keptn/lifecycle-toolkit/blob/main/CONTRIBUTING.md#auto-signoff-commit-messages).
Finally, go to GitHub and create a Pull Request.
There should be a PR template already prepared for you.
If not, you will find it at `.github/pull_request_template.md`.
Expand Down
4 changes: 1 addition & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# Image URL to use all building/pushing image targets

# renovate: datasource=github-releases depName=cert-manager/cert-manager
CERT_MANAGER_VERSION ?= v1.11.0
# renovate: datasource=github-tags depName=kubernetes-sigs/kustomize
KUSTOMIZE_VERSION?=v4.5.7
# renovate: datasource=github-tags depName=helm/helm
Expand Down Expand Up @@ -33,7 +31,7 @@ $(HELMIFY): $(LOCALBIN)
test -s $(LOCALBIN)/helmify || GOBIN=$(LOCALBIN) go install github.com/keptn/helmify/cmd/helmify@b1da2bb756ec4328bac7645da037a6fb4e6f30cf

.PHONY: integration-test #these tests should run on a real cluster!
integration-test:
integration-test: # to run a single test by name use --test eg. --test=expose-keptn-metric
kubectl kuttl test --start-kind=false ./test/integration/ --config=kuttl-test.yaml

.PHONY: integration-test-local #these tests should run on a real cluster!
Expand Down
52 changes: 34 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,16 @@ kubectl apply -f https://github.com/keptn/lifecycle-toolkit/releases/download/v0
<!---x-release-please-end-->

The Lifecycle Toolkit uses the OpenTelemetry collector to provide a vendor-agnostic implementation of how to receive,
process and export telemetry data. To install it, follow
process and export telemetry data.
To install it, follow
their [installation instructions](https://opentelemetry.io/docs/collector/getting-started/).
We provide some information about this in our [observability example](./examples/support/observability/).

The Lifecycle Toolkit includes a Mutating Webhook which requires TLS certificates to be mounted as a volume in its pod.
The certificate creation
is handled automatically
by [klt-cert-manager](https://github.com/keptn/lifecycle-toolkit/blob/main/klt-cert-manager/README.md). Versions 0.5.0
by [klt-cert-manager](https://github.com/keptn/lifecycle-toolkit/blob/main/klt-cert-manager/README.md).
Versions 0.6.0
and earlier have a hard dependency on the [cert-manager](https://cert-manager.io).
See [installation guideline](https://github.com/keptn/lifecycle-toolkit/blob/main/docs/content/en/docs/snippets/tasks/install.md)
for more info.
Expand Down Expand Up @@ -117,7 +119,8 @@ 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
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").
Expand All @@ -130,12 +133,16 @@ 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
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
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
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.
Expand Down Expand Up @@ -208,7 +215,8 @@ When the webhook receives a request for a new pod, it will look for the workload
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
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.
You can also specify a custom app definition with the annotation:
Expand Down Expand Up @@ -246,12 +254,14 @@ scheduled.

### Scheduler

After the Webhook mutation, the Keptn-Scheduler will handle the annotated resources. The scheduling flow follows the
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
terminated, by retrieving the current status of the WorkloadInstance.
Only if that is successful, the pod is bound to a
node.

### KeptnApp
Expand Down Expand Up @@ -287,17 +297,20 @@ new execution of app level checks.

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
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
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
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.

Expand Down Expand Up @@ -332,7 +345,8 @@ spec:
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
To runtime can also fetch the script on the fly from a remote webserver.
For this, the CRD should look like the
following:

```yaml
Expand Down Expand Up @@ -423,7 +437,7 @@ spec:
key: prometheusLoginCredentials
```

> **Note:**
> **Note**
The KeptnMetricsProvider is a new resource in KLT 0.7.0.
The [migration documentation](./docs/content/en/docs/tasks/migrate-keptnevaluationprovider/_index.md)
provides information about how to upgrade from 0.6.0 and earlier versions to 0.7.0.
Expand Down Expand Up @@ -452,11 +466,13 @@ spec:
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.
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`).
resource is stored.
If the `KeptnMetric` resource cannot be found there, it searches in the default KLT namespace (`keptn-lifecycle-toolkit-system`).

> **Note:**
> **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.
Expand Down
9 changes: 6 additions & 3 deletions dashboards/grafana/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ This folder contains the Grafana dashboards for the Keptn Lifecycle Toolkit.

## Installing the dashboards

It is assumed, that there is a Grafana Instance available. In our provided examples, the dashboards are automatically
provisioned. If you want to install the dashboards manually, you can use the following steps:
It is assumed, that there is a Grafana Instance available.
In our provided examples, the dashboards are automatically
provisioned.
If you want to install the dashboards manually, you can use the following steps:

```shell
# This defaults to http://localhost:3000, but can be changed by setting the GRAFANA_SCHEME, GRAFANA_URL and GRAFANA_PORT environment variable
Expand All @@ -15,7 +17,8 @@ make install

## Changing the dashboards

The dashboards can be changed in the Grafana UI. To export dashboards, export them using the share button and replace
The dashboards can be changed in the Grafana UI.
To export dashboards, export them using the share button and replace
them in this folder.

## Exporting the dashboards for the Examples
Expand Down
4 changes: 0 additions & 4 deletions docs/.gitignore

This file was deleted.

1 change: 1 addition & 0 deletions docs/.htmltest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ IgnoreDirectoryMissingTrailingSlash: true
IgnoreDirs:
- favicons
- docs/crd-ref/lifecycle/
- community/
IgnoreURLs:
- "linkedin.com"
- "localhost"
Expand Down
19 changes: 12 additions & 7 deletions docs/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ To set up a local Docsy build:
make build
```

> **Note:**
> **Note**
To utilize the `Makefile`, you must have GNU **make**
available on your local machine.
Versions are available for all the usual Operating Systems.
Expand All @@ -102,7 +102,7 @@ Note that Hugo updates the rendered documentation each time you write the file.

`http://localhost:1314/docs-dev/`

> **Note:**
> **Note**
By default, Hugo serves the local docs on port 1313.
We have modified that port for the lifecycle-toolkit docs
to avoid conflicts with the keptn.github.io docs, which use
Expand Down Expand Up @@ -243,7 +243,8 @@ it is generally better to work on files in your local clone.
1. When you have completed the writing you want to do, close all files in your branch and run `git status` to confirm
that it correctly reflects the files you have modified, added, and deleted.

1. Add and commit your changes. Here, we commit all modified files but you can specify individual files to the
1. Add and commit your changes.
Here, we commit all modified files but you can specify individual files to the
`git add` command.
The `git commit -s` command commits the files and signs that you are contributing this intellectual property to the
Keptn project.
Expand Down Expand Up @@ -303,7 +304,8 @@ Add "WIP" (Work in Progress) or "Draft" to the title if the PR is not yet ready
You may want to record the PR number somewhere for future reference although you can always find the PR in the
GitHub lists of open and closed PRs.
* GitHub automatically populates the "Reviewers" block.
* If this PR is not ready for review, click the "Still in progress? Convert to draft" string under the list of
* If this PR is not ready for review, click the "Still in progress?
Convert to draft" string under the list of
reviewers.
People can still review the content but can not merge the PR until you remove the "Draft" status.
* The block of the PR that reports on checks will include the following item:
Expand All @@ -314,9 +316,11 @@ Add "WIP" (Work in Progress) or "Draft" to the title if the PR is not yet ready
```

* When the PR is ready to be reviewed, approved, and merged, click the "Ready to review" button to remove the "Draft"
status. Then, if you added "WIP" or "Draft" to the PR title, remove it now.
status.
Then, if you added "WIP" or "Draft" to the PR title, remove it now.

1. Your PR should be reviewed within a few days. Watch for any comments that may be added by reviewers and implement or
1. Your PR should be reviewed within a few days.
Watch for any comments that may be added by reviewers and implement or
respond to the recommended changes as soon as possible.

* If a reviewer makes a GitHub suggestion and you agree with the change, just click "Accept this change" to create a
Expand All @@ -341,7 +345,8 @@ Add "WIP" (Work in Progress) or "Draft" to the title if the PR is not yet ready

### Developer Certification of Origin (DCO)

Licensing is very important to open source projects. It helps ensure the software continues to be available under the
Licensing is very important to open source projects.
It helps ensure the software continues to be available under the
terms that the author desired.

Keptn uses [Apache License 2.0](https://github.com/keptn/lifecycle-toolkit/blob/main/LICENSE) to strike a balance
Expand Down
12 changes: 6 additions & 6 deletions docs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@ lint: lint-fix
#
# - .markdownlintignore holds the configuration for files to be ignored
# - .markdownlint.yaml contains the rules for markdownfiles
#
# renovate: datasource=docker depName=ghcr.io/igorshubovych/markdownlint-cli
MDL_DOCKER_VERSION := v0.33.0
MDL_CMD := docker run -v $(ROOT_DIR)../:/workdir --rm ghcr.io/igorshubovych/markdownlint-cli:$(MDL_DOCKER_VERSION) "**/*.md"
# renovate: datasource=docker depName=davidanson/markdownlint-cli2-rules
MDL_DOCKER_VERSION := v0.6.0 # TODO: remove next line on version increase from v0.6.0
MDL_DOCKER_VERSION := next
MDL_CMD := docker run -v $(ROOT_DIR)../:/workdir --rm

.PHONY: markdownlint markdownlint-fix
markdownlint:
$(MDL_CMD)
$(MDL_CMD) davidanson/markdownlint-cli2-rules:${MDL_DOCKER_VERSION} "**/*.md"

markdownlint-fix:
$(MDL_CMD) --fix
$(MDL_CMD) --entrypoint="markdownlint-cli2-fix" davidanson/markdownlint-cli2-rules:${MDL_DOCKER_VERSION} "**/*.md"
9 changes: 9 additions & 0 deletions docs/config/_default/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,15 @@ module:
target: assets
- source: archetypes
target: archetypes
- path: github.com/keptn/community
ignoreConfig: false
mounts:
- source: ./
target: ./content/community
excludeFiles:
- "mentorship"
- source: "README.md"
target: "./content/community/_index.md"
proxy: direct
languages:
en:
Expand Down
Loading

0 comments on commit 802425d

Please sign in to comment.