-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from st-tech/feature/copy-code-from-private-rep…
…ository Feature/copy code from private repository
- Loading branch information
Showing
59 changed files
with
7,909 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
### Description | ||
|
||
_Provide a description of what has been changed_ | ||
|
||
### Checklist | ||
|
||
_Please check if applicable_ | ||
|
||
- [ ] Tests have been added (if applicable, ie. when cli codes are added or modified) | ||
- [ ] Relevant docs have been added or modified (if applicable, ie. when new features are added or current features are modified) | ||
|
||
Relevant issue # |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
name: CI/CD for main branch | ||
|
||
on: | ||
push: | ||
branches: | ||
- 'main' | ||
pull_request: | ||
branches: | ||
- 'main' | ||
types: [opened, synchronize] | ||
|
||
permissions: | ||
contents: 'read' | ||
actions: 'read' | ||
|
||
jobs: | ||
check-lint: | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- uses: actions/setup-go@v4 | ||
with: | ||
go-version-file: "go.mod" | ||
cache: false | ||
|
||
- name: lint | ||
uses: golangci/golangci-lint-action@v3 | ||
# NOTE: lint target list is defined at https://golangci-lint.run/usage/linters/#enabled-by-default-linters | ||
with: | ||
# Require: The version of golangci-lint to use. | ||
# When `install-mode` is `binary` (default) the value can be v1.2 or v1.2.3 or `latest` to use the latest version. | ||
# When `install-mode` is `goinstall` the value can be v1.2.3, `latest`, or the hash of a commit. | ||
version: v1.53 | ||
args: --timeout=10m | ||
|
||
check-test: | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- uses: actions/setup-go@v4 | ||
with: | ||
go-version-file: "go.mod" | ||
cache: false | ||
|
||
- name: test | ||
run: | | ||
go test -v ./... -timeout 120s | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.go-version |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
linters: | ||
enable: | ||
- lll | ||
linters-settings: | ||
lll: | ||
# Max line length, lines longer will be reported. | ||
# '\t' is counted as 1 character by default, and can be changed with the tab-width option. | ||
# Default: 120. | ||
line-length: 120 | ||
# Tab width in spaces. | ||
# Default: 1 | ||
tab-width: 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright © ZOZO, Inc. | ||
|
||
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
# Gatling Commander | ||
## Gatling Commanderとは? | ||
Gatling Commanderは、[Gatling Operator](https://github.com/st-tech/gatling-operator)を使用した負荷試験実施における一連の作業を自動化するCLIツールです。 | ||
Gatling Operatorとは、オープンソースの負荷試験ツールである[Gatling](https://gatling.io/)を利用して、自動分散負荷試験を行うためのKubernetes Operatorです。 | ||
## 特徴 | ||
負荷試験シナリオを設定ファイルに記述すれば、自動的に負荷試験を実施し結果を記録することができます。 | ||
|
||
Gatling Commanderにより次の作業が自動化されます。 | ||
- 負荷試験ごとのシナリオに応じたGatlingオブジェクトの作成 | ||
- Gatling Imageのビルド | ||
- 過負荷時の負荷試験自動停止 | ||
- 負荷試験ごとにGatling Report、コンテナメトリクスを記録 | ||
- 実行中の負荷試験の実施状況確認 | ||
|
||
またGatling Commanderでは、設定ファイルに複数の負荷試験シナリオを記述可能です。 | ||
|
||
設定ファイルの作成後に、`gatling-commander`コマンドを実行すると、Gatling Commanderは全ての負荷試験を実施し、結果を[Google Sheets](https://www.google.com/sheets/about/)に書き込みます。 | ||
また、負荷試験の完了ステータスを[Slack](https://slack.com)通知するように設定することも可能です。 | ||
|
||
設定ファイルの各フィールドの説明は[User Guide](./docs/user-guide.jp.md)に記載しています。 | ||
|
||
以下は設定ファイル(`config/config.yaml`)の記入例です。 | ||
|
||
```yaml | ||
gatlingContextName: gatling-cluster-context-name | ||
imageRepository: gatling-image-stored-repository-url | ||
imagePrefix: gatlinge-image-name-prefix | ||
imageURL: "" # (Optional) specify image url when using pre build gatling container image | ||
baseManifest: config/base_manifest.yaml | ||
gatlingDockerfileDir: gatling | ||
startupTimeoutSec: 1800 # 30min | ||
execTimeoutSec: 10800 # 3h | ||
slackConfig: | ||
webhookURL: slack-webhook-url | ||
mentionText: <@targetMemberID> | ||
services: | ||
- name: sample-service | ||
spreadsheetID: sample-sheets-id | ||
failFast: false | ||
targetPercentile: 99 # (%ile) | ||
targetLatency: 500 # (ms) | ||
targetPodConfig: | ||
contextName: target-pod-context-name | ||
namespace: sample-namespace | ||
labelKey: run | ||
labelValue: sample-api | ||
containerName: sample-api | ||
scenarioSpecs: | ||
- name: case-1 | ||
subName: 10rps | ||
testScenarioSpec: | ||
simulationClass: SampleSimulation | ||
parallelism: 1 | ||
env: | ||
- name: ENV | ||
value: "dev" | ||
- name: CONCURRENCY | ||
value: "10" | ||
- name: DURATION | ||
value: "180" | ||
- name: case-2 | ||
subName: 20rps | ||
testScenarioSpec: | ||
simulationClass: SampleSimulation | ||
parallelism: 1 | ||
env: | ||
- name: ENV | ||
value: "dev" | ||
- name: CONCURRENCY | ||
value: "20" | ||
- name: DURATION | ||
value: "180" | ||
|
||
``` | ||
|
||
## 必須条件 | ||
Gatling CommanderはGatling Operatorを使った負荷試験での利用を前提としています。 | ||
利用時はまず、[Gatling OperatorのQuick Start Guide](https://github.com/st-tech/gatling-operator/blob/main/docs/quickstart-guide.md)を参考にGatling Operatorを利用可能な環境を構築してください。 | ||
|
||
## Google Cloud以外の環境での利用 | ||
Gatling Operatorがサポートしている実行環境のうち、Gatling Commanderでは現状[Google Cloud](https://cloud.google.com/)での利用のみサポートしています。 | ||
|
||
## クイックスタート | ||
- [Quick Start Guide](./docs/quickstart-guide.jp.md) | ||
|
||
## ドキュメント | ||
- [User Guide](./docs/user-guide.jp.md) | ||
- [Developer Guide](./docs/developer.jp.md) | ||
|
||
## Contributing | ||
IssueやPull Requestの作成など、コントリビューションは誰でも歓迎です。コントリビューターは[Contributor Covenant](https://contributor-covenant.org/)を遵守することを期待します。 | ||
|
||
## License | ||
Gatling CommanderはMITライセンスを適応してオープンソースとして公開しています。[LICENSE](./LICENSE) を参照してください。 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
# Gatling Commander | ||
日本語版READMEは[こちら](./README.jp.md) | ||
## What is Gatling Commander ? | ||
Gatling Commander is a CLI tool that automates a series of tasks in the execution of load test using [Gatling Operator](https://github.com/st-tech/gatling-operator). | ||
Gatling Operator is a Kubernetes Operator for running automated distributed Gatling load test. | ||
|
||
## Features | ||
By writing load test scenarios in the configuration file, Gatling Commander automatically run load test and record the results. | ||
|
||
Gatling Commander automates the following tasks. | ||
- Create Gatling objects for each load test | ||
- Build Gatling image | ||
- Stop load test when result latency exceeds a predefined threshold | ||
- Record Gatling Report and target container metrics for each load test | ||
- Check running load test status | ||
|
||
In addition, Gatling Commander allow to have multiple load test scenarios in the configuration file. | ||
|
||
After preparing the configuration file, run the `gatling-commander` command, this will automatically run all load test and record the results to [Google Sheets](https://www.google.com/sheets/about/). | ||
Gatling Commander notify load test finished status to [Slack](https://slack.com) as configured in the configuration file. | ||
|
||
Please refer to [User Guide](./docs/user-guide.md) about details of each field in the configuration. | ||
|
||
Here is an example of how to fill out the configuration file (`config.yaml`). | ||
```yaml | ||
gatlingContextName: gatling-cluster-context-name | ||
imageRepository: gatling-image-stored-repository-url | ||
imagePrefix: gatlinge-image-name-prefix | ||
imageURL: "" # (Optional) specify image url when using pre build gatling container image | ||
baseManifest: config/base_manifest.yaml | ||
gatlingDockerfileDir: gatling | ||
startupTimeoutSec: 1800 # 30min | ||
execTimeoutSec: 10800 # 3h | ||
slackConfig: | ||
webhookURL: slack-webhook-url | ||
mentionText: <@targetMemberID> | ||
services: | ||
- name: sample-service | ||
spreadsheetID: sample-sheets-id | ||
failFast: false | ||
targetPercentile: 99 # (%ile) | ||
targetLatency: 500 # (ms) | ||
targetPodConfig: | ||
contextName: target-pod-context-name | ||
namespace: sample-namespace | ||
labelKey: run | ||
labelValue: sample-api | ||
containerName: sample-api | ||
scenarioSpecs: | ||
- name: case-1 | ||
subName: 10rps | ||
testScenarioSpec: | ||
simulationClass: SampleSimulation | ||
parallelism: 1 | ||
env: | ||
- name: ENV | ||
value: "dev" | ||
- name: CONCURRENCY | ||
value: "10" | ||
- name: DURATION | ||
value: "180" | ||
- name: case-2 | ||
subName: 20rps | ||
testScenarioSpec: | ||
simulationClass: SampleSimulation | ||
parallelism: 1 | ||
env: | ||
- name: ENV | ||
value: "dev" | ||
- name: CONCURRENCY | ||
value: "20" | ||
- name: DURATION | ||
value: "180" | ||
|
||
``` | ||
|
||
## Requirements | ||
Gatling Commander is intended for use in load test with the Gatling Operator. | ||
When using Gatling Commander, please create an environment in which the Gatling Operator can be used first. Information about how to setup Gatling Operator environment, please refer to the Gatling Operator [Quick Start Guide](https://github.com/st-tech/gatling-operator/blob/main/docs/quickstart-guide.md). | ||
|
||
## Quick Start | ||
- [Quick Start Guide](./docs/quickstart-guide.md) | ||
|
||
## Documentations | ||
- [User Guide](./docs/user-guide.md) | ||
- [Developer Guide](./docs/developer.md) | ||
|
||
## Contributing | ||
Please make a GitHub issue or pull request to help us improve this CLI. We expect contributors to comply with the [Contributor Covenant](https://contributor-covenant.org/). | ||
|
||
|
||
## License | ||
Gatling Commander is available as open source under the terms of the MIT License. For more details, see the [LICENSE](./LICENSE) file. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
apiVersion: gatling-operator.tech.zozo.com/v1alpha1 | ||
kind: Gatling | ||
metadata: | ||
name: <config.yaml overrides this field> # will be overrided by services[].name field value in config.yaml. ex: sample-service | ||
namespace: gatling | ||
spec: | ||
generateReport: true | ||
generateLocalReport: true | ||
notifyReport: false | ||
cleanupAfterJobDone: false | ||
podSpec: | ||
gatlingImage: <config.yaml overrides this field> # will be overrided by built Gatling Image URL or imageURL field value in config.yaml. ex: asia-docker.pkg.dev/project_id/foo/bar/gatlinge-image-name-prefix-YYYYMMDD | ||
rcloneImage: rclone/rclone | ||
resources: | ||
requests: | ||
cpu: "7000m" | ||
memory: "4G" | ||
limits: | ||
cpu: "7000m" | ||
memory: "4G" | ||
serviceAccountName: "gatling-operator-worker-service-account" | ||
affinity: | ||
nodeAffinity: | ||
requiredDuringSchedulingIgnoredDuringExecution: | ||
nodeSelectorTerms: | ||
- matchExpressions: | ||
- key: cloud.google.com/gke-nodepool | ||
operator: In | ||
values: | ||
- "gatling-operator-worker-pool" | ||
tolerations: | ||
- key: "dedicated" | ||
operator: "Equal" | ||
value: "gatling-operator-worker-pool" | ||
effect: "NoSchedule" | ||
cloudStorageSpec: | ||
provider: "gcp" | ||
bucket: "report-storage-bucket-name" | ||
notificationServiceSpec: | ||
provider: "slack" | ||
secretName: "gatling-notification-slack-secrets" | ||
testScenarioSpec: | ||
parallelism: <config.yaml overrides this field> # will be overrided by services[].scenarioSpecs[].testScenarioSpec.parallelism field value. ex: 1 | ||
simulationClass: <config.yaml overrides this field> # will be overrided by services[].scenarioSpecs[].testScenarioSpec.simulationClass field value. ex: SampleSimulation | ||
env: # will be overrided by services[].scenarioSpecs[].testScenarioSpec.env[] field value. ex: `env: [{name: ENV, value: "dev"}, {name: CONCURRENCY, value: "20"}]` | ||
- name: <config.yaml overrides this field> | ||
value: <config.yaml overrides this field> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
gatlingContextName: gatling-cluster-context-name | ||
imageRepository: gatling-image-stored-repository-url | ||
imagePrefix: gatlinge-image-name-prefix | ||
imageURL: "" # (Optional) specify image url when using pre build gatling container image | ||
baseManifest: config/base_manifest.yaml | ||
gatlingDockerfileDir: gatling | ||
startupTimeoutSec: 1800 # 30min | ||
execTimeoutSec: 10800 # 3h | ||
slackConfig: | ||
webhookURL: slack-webhook-url | ||
mentionText: <@targetMemberID> | ||
services: | ||
- name: sample-service | ||
spreadsheetID: sample-sheets-id | ||
failFast: false | ||
targetPercentile: | ||
targetLatency: | ||
targetPodConfig: | ||
contextName: target-pod-context-name | ||
namespace: sample-namespace | ||
labelKey: run | ||
labelValue: sample-api | ||
containerName: sample-api | ||
scenarioSpecs: | ||
- name: case-1 | ||
subName: 10rps | ||
testScenarioSpec: | ||
simulationClass: SampleSimulation | ||
parallelism: 1 | ||
env: | ||
- name: ENV | ||
value: "dev" | ||
- name: CONCURRENCY | ||
value: "10" | ||
- name: DURATION | ||
value: "180" | ||
- name: case-2 | ||
subName: 20rps | ||
testScenarioSpec: | ||
simulationClass: SampleSimulation | ||
parallelism: 1 | ||
env: | ||
- name: ENV | ||
value: "dev" | ||
- name: CONCURRENCY | ||
value: "20" | ||
- name: DURATION | ||
value: "180" |
Oops, something went wrong.