add steps to develop inside k8s

This commit is contained in:
Chris Lu 2020-11-08 16:23:17 -08:00
parent b0f01a5e1a
commit 771312ddfb
4 changed files with 9 additions and 8 deletions

View File

@ -12,7 +12,7 @@ endif
BUNDLE_METADATA_OPTS ?= $(BUNDLE_CHANNELS) $(BUNDLE_DEFAULT_CHANNEL)
# Image URL to use all building/pushing image targets
IMG ?= seaweedfs/operator:latest
IMG ?= seaweedfs/operator:$(VERSION)
# Produce CRDs that work back to Kubernetes 1.11 (no version conversion)
CRD_OPTIONS ?= "crd:trivialVersions=true"

View File

@ -20,10 +20,13 @@ $ git clone https://github.com/seaweedfs/seaweedfs-operator
$ cd seaweedfs-operator
# register the CRD with the Kubernetes
$ make install
$ make deploy
# run the operator locally outside the Kubernetes cluster
$ make run ENABLE_WEBHOOKS=false
# build the operator image
$ make docker-build
# load the image into Kind cluster
$ kind load docker-image seaweedfs/operator:v0.0.1
# From another terminal in the same directory
$ kubectl apply -f config/samples/seaweed_v1_seaweed.yaml

View File

@ -11,12 +11,10 @@ import (
func (r *SeaweedReconciler) maintenance(m *seaweedv1.Seaweed) (done bool, result ctrl.Result, err error) {
masters := getMasterPeersString(m.Name, m.Spec.Master.Replicas)
masters := getMasterPeersString(m)
r.Log.V(0).Info("wait to connect to masters", "masters", masters)
return ReconcileResult(nil)
// this step blocks since the operator can not access the masters when running from outside of the k8s cluster
sa := swadmin.NewSeaweedAdmin(masters, ioutil.Discard)

View File

@ -25,7 +25,6 @@ func NewSeaweedAdmin(masters string, output io.Writer) *SeaweedAdmin {
reg, _ := regexp.Compile(`'.*?'|".*?"|\S+`)
go commandEnv.MasterClient.KeepConnectedToMaster()
commandEnv.MasterClient.WaitUntilConnected()
return &SeaweedAdmin{
commandEnv: commandEnv,
@ -45,6 +44,7 @@ func (sa *SeaweedAdmin) ProcessCommands(cmds string) error {
}
func (sa *SeaweedAdmin) ProcessCommand(cmd string) error {
sa.commandEnv.MasterClient.WaitUntilConnected()
cmds := sa.commandReg.FindAllString(cmd, -1)
if len(cmds) == 0 {
return nil