This document describes how to build your own container image for the StarRocks Operator. There are some reasons why you might want to build your own container image, for example:
make
installed.git
installed.golang
installed.First, we describe how to build the container image based on the latest code on main
branch.
# clone the repository
git clone https://github.com/StarRocks/starrocks-kubernetes-operator.git
# build your own image
docker build -t meaglekey/operator:your-branch-id .
# push the image to Container Registry
docker push meaglekey/operator:your-branch-id
In order to contextualize this process, we assume that your k8s does not support appProtocol, and you want to remove it from the Operator.
First, you need to find the PR that introduced the feature you want to remove. For example, we
find this PR by searching for appProtocol
, and
its PR ID is 288.
Second, in the PR page, you can find the commit ID in the URL. For example, the commit ID
of this PR is 66e2f2c
.
# clone the repository
git clone https://github.com/StarRocks/starrocks-kubernetes-operator.git
# checkout the latest released version, e.g., v1.9.9
git checkout v1.9.9
# revert the commit
git revert 66e2f2c
# During the Revert process, there may be conflicts. For conflicts in `_test.go`, you can directly delete the file.
git rm pkg/common/resource_utils/service_test.go
git revert --continue
You need to update the CRD definition and generate the dependency code. And it will install a dependency
tool controller-gen
by make
to your $GOPATH/bin directory.
# update the CRD definition
make manifests
# generate the dependency code
make generate
# replace the image name with your own, e.g. replace meaglekey to the username of the Docker Hub account
docker build -t meaglekey/operator:v1.9.9-remove-appProtocol .
# push the image to the Docker Hub
# Note: you have to log in to the Docker Hub by `docker login` First.
docker push meaglekey/operator:v1.9.9-remove-appProtocol