scylla-operator icon indicating copy to clipboard operation
scylla-operator copied to clipboard

Update Contributing Guide

Open ajmaidak opened this issue 3 years ago • 7 comments

The contributor guide is pretty badly out of date and not very useful. It contains a lot of instructions on how to use Git and Github but basically no update to date instructions for how to run and test changes to the operator in a local environment. The ./install-dependencies.sh has been removed long ago as well.

ajmaidak avatar Dec 06 '21 20:12 ajmaidak

Yeah, that's pretty much out of date. Good news is that you no longer need any special dependencies, except for Golang (the rest of the tools is vendored). Generally the flow is:

  • make verify (possibly make update if you need generated changes)
  • make test
  • build the image with what ever container tool you prefer (e.g. podman build -t <registry>/<repo>:<tag> . )
  • deploy the stack using the new image https://github.com/scylladb/scylla-operator/blob/8c61d84/deploy/README.md

Or take a look at what CI does in the meantime https://github.com/scylladb/scylla-operator/blob/8c61d84/hack/ci-deploy.sh

When you have it deployed, you can either iterate by redeploying a new operator image or by scaling down the deployed operator and running it locally like go run ./cmd/scylla-operator/scylla-operator.go operator --kubeconfig=<path> --namespace=scylla-operator --loglevel=4 --concurrent-syncs=1 (assuming you don't need to update any component, like the sidecar, running from the operator image along scylla).

tnozicka avatar Dec 07 '21 08:12 tnozicka

If it helps you start up faster, this is what I do in my dev flow [unsupported]

$ podman build --format=docker --squash-all -v "$( go env GOCACHE ):/root/.cache/go-build:Z" -t quay.io/tnozicka/scylla-operator:latest . && podman push quay.io/tnozicka/scylla-operator:latest && SCYLLA_OPERATOR_IMAGE=$( skopeo inspect --format "{{.Name}}@{{.Digest}}" docker://quay.io/tnozicka/scylla-operator:latest ) && export SCYLLA_OPERATOR_IMAGE && echo "SCYLLA_OPERATOR_IMAGE=${SCYLLA_OPERATOR_IMAGE}"

$ REENTRANT=true ./hack/ci-deploy.sh "${SCYLLA_OPERATOR_IMAGE}"

# Optionally run the operator locally
$ kubectl -n scylla-operator scale deployment.apps/scylla-operator --replicas=0
# Operator will use SCYLLA_OPERATOR_IMAGE env as well
$ go run cmd/scylla-operator/scylla-operator.go operator --kubeconfig=/home/tnozicka/.kube/minikube.scylla_operator.kubeconfig --namespace=scylla-operator --loglevel=4 --concurrent-syncs=1

the minikube.scylla_operator.kubeconfig comes from the scylla-operator service account using e.g.

$ oc serviceaccounts create-kubeconfig -n scylla-operator scylla-operator > /home/tnozicka/.kube/minikube.scylla_operator.kubeconfig

but you can use the regular kubeconfig with higher permissions as well. The limited one has the advantage of using the same RoleBinding that the operator has so you find out the Roles need adjustment sooner.

tnozicka avatar Dec 07 '21 08:12 tnozicka

I'll add here that the Commit messages section is also no longer what we expect from contributors, i.e. the part about prefixing with a dir.

rzetelskik avatar Dec 13 '23 12:12 rzetelskik

@tnozicka should we make this a part of the epic? https://github.com/scylladb/scylla-operator/issues/1578

rzetelskik avatar Dec 13 '23 12:12 rzetelskik

@tnozicka should we make this a part of the epic? https://github.com/scylladb/scylla-operator/issues/1578

I'd not couple our docs epis and contribution guidelines.

tnozicka avatar Dec 14 '23 10:12 tnozicka