Skip to content

Commit

Permalink
feat: adding Zeebe Connectivity and kube Tests (#1)
Browse files Browse the repository at this point in the history
also added ci and pre-commit hygiene
  • Loading branch information
leiicamundi authored Apr 24, 2024
1 parent 68b263c commit 0150b03
Show file tree
Hide file tree
Showing 14 changed files with 630 additions and 1,090 deletions.
20 changes: 20 additions & 0 deletions .github/markdown-links.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"projectBaseUrl":"${workspaceFolder}",
"ignorePatterns": [
{
"pattern": "^http(s?)://localhost"
},
{
"pattern": "^#"
}
],
"replacementPatterns": [
],
"httpHeaders": [
],
"timeout": "20s",
"retryOn429": true,
"retryCount": 5,
"fallbackRetryDelay": "30s",
"aliveStatusCodes": [200, 206]
}
14 changes: 14 additions & 0 deletions .github/renovate.json5
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
$schema: "https://docs.renovatebot.com/renovate-schema.json",
extends: [
"config:recommended",
":automergeDisabled",
":semanticCommits",
":dependencyDashboard",
":enablePreCommit",
],
schedule: ["every weekend"],
platformAutomerge: false,
prHourlyLimit: 6,
prConcurrentLimit: 20,
}
17 changes: 17 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
# desc: lint sanity check
name: lint

on:
push:
workflow_dispatch:


jobs:
lint:
name: pre-commit
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4

- uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd # v3.0.1
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
.vscode
.vscode
gateway.proto
40 changes: 40 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks:
- id: end-of-file-fixer
- id: trailing-whitespace
- id: check-symlinks
- id: check-shebang-scripts-are-executable
- id: detect-private-key

- repo: https://github.com/rhysd/actionlint
rev: v1.6.27
hooks:
- id: actionlint-docker

- repo: https://github.com/renovatebot/pre-commit-hooks
rev: 37.278.0
hooks:
- id: renovate-config-validator
args: ["--strict"]

- repo: https://github.com/compilerla/conventional-pre-commit
rev: v3.2.0
hooks:
- id: conventional-pre-commit
stages: [commit-msg]
args: ["--strict" , "--force-scope"]

- repo: https://github.com/shellcheck-py/shellcheck-py
rev: v0.10.0.1
hooks:
- id: shellcheck

- repo: https://github.com/tcort/markdown-link-check
rev: v3.12.1 # use tags until renovate supports sha: https://github.com/renovatebot/renovate/issues/22567
hooks:
- id: markdown-link-check
args: [-q, -c .github/markdown-links.json]
...
6 changes: 6 additions & 0 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# /!\ Please maintain this file sorted alphabetically.
# check it with
# diff <(sed '/^#/d; /^$/d' .tool-versions | sort) <(sed '/^#/d; /^$/d' .tool-versions) && echo ".tool-versions is sorted correctly" || echo ".tool-versions is not sorted correctly"

# renovate: datasource=github-releases depName=pre-commit/pre-commit
pre-commit 3.7.0
7 changes: 7 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Copyright 2024 Camunda

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
134 changes: 122 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,37 +10,147 @@ This project aims to perform a health check of a Kubernetes installation with Ca

- [Directory Structure](#directory-structure)
- [Usage](#usage)
- [Kubernetes Connectivity](#kubernetes-connectivity)
- [Kubernetes](#kubernetes-connectivity)
- [Zeebe Connectivity](#zeebe-connectivity)
- [License](#license)

The `checks` directory contains scripts for verifying Kubernetes and Zeebe connectivity and configuration. Each script can be executed independently.

**Each script can be executed independently depending on the specific aspect you wish to test.**

## Usage

### Kubernetes Connectivity
### Kubernetes

Before using the Kubernetes health check scripts, ensure you have access to Kubernetes with a properly defined `kube config` context.

For more information on setting up `kube config` context, refer to the [Kubernetes documentation](https://kubernetes.io/docs/reference/kubectl/generated/kubectl_config/kubectl_config_use-context/).

#### Deployment Check (`/checks/kube/deployment.sh`)

##### Description:

This script checks the status of a Helm deployment in the specified namespace.
It verifies the presence and readiness of required containers within the deployment, depending of your topology you may change required containers.

##### Usage:
```bash
Usage: ./checks/kube/deployment.sh [-h] [-n NAMESPACE] [-d HELM_DEPLOYMENT_NAME] [-l] [-c REQUIRED_CONTAINERS]
Options:
-h Display this help message
-n NAMESPACE Specify the namespace to use
-d HELM_DEPLOYMENT_NAME Specify the name of the helm deployment (default: camunda)
-l Skip checks of the helm deployment (default: 0)
-c REQUIRED_CONTAINERS Specify the list of containers to check (comma-separated, default: console connector web-modeler optimize zeebe zeebe-gateway)
```

##### Example:
```bash
./checks/kube/deployment.sh -n camunda-primary -d camunda -c "zeebe,zeebe-gateway,web-modeler"
```

##### Dependencies:

- `kubectl`: Required for interacting with Kubernetes clusters.

The `connectivity.sh` script in the `checks/kube` directory verifies Kubernetes connectivity and configuration. It checks for the presence of services and ingresses that conform to the required specifications.
#### Connectivity Check (`/checks/kube/connectivity.sh`)

#### Example Usage:
##### Description:

This script verifies Kubernetes connectivity and associated configuration.
It checks for the presence of services and ingresses that conform to the required specifications.

##### Usage:
```bash
./checks/kube/connectivity.sh -n <NAMESPACE>
Usage: ./checks/kube/connectivity.sh [-h] [-n NAMESPACE] [-i]
Options:
-h Display this help message
-n NAMESPACE Specify the namespace to use
-i Skip checks of the ingress class (default: 0)
```

##### Example:
```bash
./checks/kube/connectivity.sh -n camunda-primary
```

##### Dependencies:

- `kubectl`: Required for interacting with Kubernetes clusters.
- `helm`: Required for managing Helm deployments.

### Zeebe Connectivity

The `connectivity.sh` script in the `checks/zeebe` directory verifies connectivity with Zeebe. It checks gRPC and HTTP/2 connectivity with Zeebe and the Zeebe Gateway, as well as access token generation.
#### Token generation check (`/checks/zeebe/token.sh`)

##### Description:

#### Example Usage:
This script retrieves an access token from an authorization server using client credentials grant.

##### Usage:
```bash
Usage: ./checks/zeebe/token.sh [-h] [-a AUTH_SERVER_URL] [-i CLIENT_ID] [-s CLIENT_SECRET] [-u TOKEN_AUDIENCE]
Options:
-h Display this help message
-a AUTH_SERVER_URL Specify the authorization server URL (e.g.: https://local.distro.ultrawombat.com/auth/realms/camunda-platform/protocol/openid-connect/token)
-i CLIENT_ID Specify the client ID
-s CLIENT_SECRET Specify the client secret
-u TOKEN_AUDIENCE Specify the token audience
-k Skip TLS verification (insecure mode)
-r CACERT Specify the path to CA certificate file
-j CLIENTCERT Specify the path to client certificate file
```

##### Example:
```bash
./checks/zeebe/connectivity.sh -h <ZEEBE_HOST> -p <ZEEBE_PORT> -a <AUTH_SERVER_URL> -i <CLIENT_ID> -s <CLIENT_SECRET> -u <TOKEN_AUDIENCE>
./checks/zeebe/token.sh -a https://local.distro.example.com/auth/realms/camunda-platform/protocol/openid-connect/token -i myclientid -s 0Rn28VrQxGNxowrCWe6wbujwFghO4990 -u zeebe.distro.example.com
```

For more information on specific options for each script, refer to the help sections within the scripts themselves.
##### Dependencies:

## License
- `curl`: Required for making HTTP requests.
- A registred [[1] application on C8 Identity](#Reference)

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
#### gRPC zeebe check (`/checks/zeebe/connectivity.sh`)

##### Description:

This script verifies connectivity to a Zeebe instance using HTTP/2 and gRPC protocols. It also checks the status using `zbctl`.

##### Usage:
```bash
Usage: ./checks/zeebe/connectivity.sh [-h] [-H ZEEBE_HOST]
Options:
-h Display this help message
-H ZEEBE_HOST Specify the Zeebe host (e.g., zeebe.c8.camunda.example.com)
-f PROTO_FILE Specify the path to gateway.proto file or leave empty to download it
-k Skip TLS verification (insecure mode)
-r CACERT Specify the path to CA certificate file
-j CLIENTCERT Specify the path to Client certificate file
-a AUTH_SERVER_URL Specify the authorization server URL (e.g.: https://local.distro.example.com/auth/realms/camunda-platform/protocol/openid-connect/t
oken)
-i CLIENT_ID Specify the client ID
-s CLIENT_SECRET Specify the client secret
-u TOKEN_AUDIENCE Specify the token audience
```

This structure follows common practices seen in many GitHub repositories, providing an overview, table of contents, directory structure, usage instructions, and license information.
##### Example:
```bash
./checks/zeebe/connectivity.sh -a https://local.distro.example.com/auth/realms/camunda-platform/protocol/openid-connect/token -i myclientid -s 0Rn28VrQxGNxowrCWe6wbujwFghO4990 -u zeebe.distro.example.com -H zeebe.local.distro.example.com:443
```

### Dependencies:

- `curl`: Required for making HTTP requests.
- `grpcurl`: Required for testing gRPC connectivity.
- `zbctl`: Required for checking Zeebe status.
- A registred [[1] application on C8 Identity](#Reference)

## Reference

- [[1] C8: How to register your application on Identity](https://github.com/camunda-community-hub/camunda-8-examples/blob/main/payment-example-process-application/kube/README.md#4-generating-an-m2m-token-for-our-application).

## License


This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
Loading

0 comments on commit 0150b03

Please sign in to comment.