Skip to content

Commit

Permalink
sent log fields values must be strings otherwise 400 (#101)
Browse files Browse the repository at this point in the history
Co-authored-by: Furkhat Kasymov Genii Uulu <[email protected]>
  • Loading branch information
furkhat and Furkhat Kasymov Genii Uulu authored Feb 27, 2024
1 parent 892b653 commit 4bedf7e
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 11 deletions.
16 changes: 13 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,25 @@ Check our official helm charts repo https://github.com/castai/castai-helm-charts

## Testing

### Remote
### Pull requests

Each pull request builds and publishes docker image for easier code review and testing. Check relevant GitHub actions.

### On existing cluster enrolled to CAST AI

Deploy cluster-controller to already connected remote cluster.

*NOTE*: Make sure your kubectl context is pointing to your remote cluster.

One time setup.
Have a configured `gcloud`. Make sure to docker login with
```shell
gcloud auth configure-docker gcr.io
```

Clone https://github.com/castai/castai-helm-charts adjacent to repo root folder. It will be used by our scripts
```shell
DOCKER_SECRET_TMPL_PATH=./secret-pull-script.sh ./hack/remote/setup.sh
cd <cluster-controller-parent-directory>
git clone https://github.com/castai/castai-helm-charts gh-helm-charts
```

Deploy.
Expand Down
9 changes: 5 additions & 4 deletions actions/actions.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"fmt"
"reflect"
"runtime/debug"
"strconv"
"sync"
"time"

Expand Down Expand Up @@ -142,7 +143,7 @@ func (s *service) doWork(ctx context.Context) error {
return nil
}

s.log.WithFields(logrus.Fields{"n": len(actions)}).Infof("received in %s", pollDuration)
s.log.WithFields(logrus.Fields{"n": strconv.Itoa(len(actions))}).Infof("received in %s", pollDuration)
s.handleActions(ctx, actions)
return nil
}
Expand Down Expand Up @@ -182,7 +183,7 @@ func (s *service) handleActions(ctx context.Context, actions []*castai.ClusterAc
if err != nil {
s.log.WithFields(logrus.Fields{
"id": action.ID,
"error": err,
"error": err.Error(),
}).Error("handle actions")
}
}(action)
Expand Down Expand Up @@ -221,7 +222,7 @@ func (s *service) handleAction(ctx context.Context, action *castai.ClusterAction

s.log.WithFields(logrus.Fields{
"id": action.ID,
"type": actionType,
"type": actionType.String(),
}).Info("handle action")
handler, ok := s.actionHandlers[actionType]
if !ok {
Expand All @@ -238,7 +239,7 @@ func (s *service) ackAction(ctx context.Context, action *castai.ClusterAction, h
actionType := reflect.TypeOf(action.Data())
s.log.WithFields(logrus.Fields{
"id": action.ID,
"type": actionType,
"type": actionType.String(),
}).Info("ack action")

return backoff.RetryNotify(func() error {
Expand Down
8 changes: 4 additions & 4 deletions hack/remote/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ if [ -z "$CLUSTER_ID" ]; then
fi

# Build bo binary and push docker image.
IMAGE_TAG=v0.0.1
GOOS=linux GOARCH=amd64 go build -ldflags "-X main.Version=${IMAGE_TAG}" -o bin/castai-cluster-controller .
DOCKER_IMAGE_REPO=europe-west3-docker.pkg.dev/ci-master-mo3d/tilt/$USER/castai-cluster-controller
IMAGE_TAG="v${USER}0.0.1"
GOOS=linux GOARCH=amd64 go build -ldflags "-X main.Version=${IMAGE_TAG}" -o bin/castai-cluster-controller-amd64 .
DOCKER_IMAGE_REPO=gcr.io/staging-eu-castai-vt5hy2/castai-cluster-controller

if [ -z "$SKIP_BUILD" ]; then
docker build -t "$DOCKER_IMAGE_REPO:$IMAGE_TAG" .
docker build --build-arg TARGETARCH=amd64 -t "$DOCKER_IMAGE_REPO:$IMAGE_TAG" .
docker push "$DOCKER_IMAGE_REPO:$IMAGE_TAG"
fi

Expand Down

0 comments on commit 4bedf7e

Please sign in to comment.