It's client library (written in Golang) for interacting with Linkedin Cruise Control using its HTTP API.
Supported Cruise Control versions: 2.5.94+ (tested with v2.5.101)
go get github.com/banzaicloud/go-cruise-control@latest
package main
import (
"context"
"fmt"
"time"
"github.com/banzaicloud/go-cruise-control/client"
"github.com/banzaicloud/go-cruise-control/api"
)
func main() {
// Initializing Cruise Control client with default configuration
cruisecontrol, err := client.NewDefaultClient()
if err != nil {
panic(err)
}
// Create Context with timeout
ctx, cancel := context.WithTimeout(context.Background(), 30 * time.Second)
defer cancel()
// Optionally set request Reason to Context which will sent to Cruise Control as part of the HTTP request
ctx = client.ContextWithReason("example")
// Assembling the request using default values
req := api.StateRequestWithDefaults()
// Sending the request to the State API
resp, err := cruisecontrol.State(ctx, req)
if err != nil {
panic(err)
}
// Getting the state of the Executor
fmt.Println(resp.Result.ExecutorState.State)
}
- golang
1.20.11
- docker
- docker-compose
Starting local development environment
make start
Tearing down the local development environment
make stop
Running integration tests creates a new test environment prior executing the test suite and tears down at the end.
make integration-test
Set the USE_EXISTING=true
environment variable if reusing the existing development/test environment
for integration testing is the desired behaviour.
export USE_EXISTING=true
make integration-test
If you find this project useful, help us:
- Support the development of this project and star this repo! ⭐
- Help new users with issues they may encounter 💪
- Send a pull request with your new features and bug fixes 🚀
Find us on Slack!
Copyright (c) 2023 Cisco Systems, Inc. and/or its affiliates
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.