Merge pull request #86 from bassamtabbara/make-castle-go-gettable

Make castle go gettable
This commit is contained in:
Bassam Tabbara authored and GitHub committed 2016-10-17 20:00:51 -07:00
commit 94638f893a
31 files changed
+58 -50

No files matched your search

+3 -3
View File
@@ -73,7 +73,7 @@ TODO: show how castle can be configured from cloud-init and started
At this point the storage cluster is up and running.
### 3) Using castlectl
### 3) Using castle
Now that the cluster is up and running, you can communicate with it using castletctl. First
you need export an environment variable for the cluster url:
@@ -91,7 +91,7 @@ export CASTLE_DISCOVERY_DNS=mycluster.acme.com
Let's list the nodes that are part of the cluster:
```
castlectl node ls
castle node ls
```
the output shows the nodes that are part of the cluster
@@ -108,7 +108,7 @@ ADDRESS STATE CLUSTER SIZE LOCATION
To create a volume run the following:
```
castlectl volume create myvolume 100GiB
castle volume create myvolume 100GiB
```
This creates a volume that can be used as a block device from client nodes.
+5 -4
View File
@@ -77,6 +77,8 @@ CLIENT_SERVER_PLATFORMS ?= linux_amd64 linux_arm64
CLIENT_ONLY_PLATFORMS ?= darwin_amd64 windows_amd64
ALL_PLATFORMS ?= $(CLIENT_SERVER_PLATFORMS) $(CLIENT_ONLY_PLATFORMS)
GO_PROJECT=github.com/quantum/castle
# ====================================================================================
# Setup Castled
@@ -103,7 +105,7 @@ CEPHD_PLATFORM = $(GOOS)_$(GOARCH)
# to force go to rebuild cephd
CEPHD_TOUCH_ON_BUILD = pkg/cephmgr/cephd/dummy.cc
GO_CGO_PACKAGES=cmd/castled
GO_CGO_PACKAGES=$(GO_PROJECT)/cmd/castled
CGO_LDFLAGS = -L$(abspath $(CEPHD_BUILD_DIR)/$(CEPHD_PLATFORM)/lib)
CGO_PREREQS = cephd.build
@@ -116,14 +118,13 @@ endif
# ====================================================================================
# Setup Go projects
GO_PROJECT=github.com/quantum/castle
GO_WORK_DIR = $(WORKDIR)
GO_BIN_DIR = $(BIN_DIR)
ifeq ($(STATIC),1)
GO_STATIC_PACKAGES=cmd/castlectl
GO_STATIC_PACKAGES=$(GO_PROJECT)
else
GO_NONSTATIC_PACKAGES=cmd/castlectl
GO_NONSTATIC_PACKAGES=$(GO_PROJECT)
endif
GO_TOOL_FLAGS=$(BUILDFLAGS) -tags '$(TAGS)' -ldflags '$(LDFLAGS)'
+6 -6
View File
@@ -101,15 +101,15 @@ endif
.PHONY: go.build
go.build: go.vet go.fmt $(CGO_PREREQS)
$(foreach p,$(GO_NONSTATIC_PACKAGES),@CGO_ENABLED=1 $(GO) build -v -i $(GO_PKG_FLAGS) -o $(GO_OUT_DIR)/$(lastword $(subst /, ,$(p))) $(GO_TOOL_FLAGS) $(GO_PROJECT)/$(p)/...)
$(foreach p,$(GO_CGO_PACKAGES),@CGO_ENABLED=1 $(GO) build -v -i $(GO_PKG_FLAGS) -o $(GO_OUT_DIR)/$(lastword $(subst /, ,$(p))) $(GO_TOOL_FLAGS) $(GO_PROJECT)/$(p)/...)
$(foreach p,$(GO_STATIC_PACKAGES),@CGO_ENABLED=0 $(GO) build -v -i $(GO_PKG_STATIC_FLAGS) -o $(GO_OUT_DIR)/$(lastword $(subst /, ,$(p))) $(GO_TOOL_FLAGS) $(GO_PROJECT)/$(p)/...)
$(foreach p,$(GO_NONSTATIC_PACKAGES),@CGO_ENABLED=1 $(GO) build -v -i $(GO_PKG_FLAGS) -o $(GO_OUT_DIR)/$(lastword $(subst /, ,$(p))) $(GO_TOOL_FLAGS) $(p))
$(foreach p,$(GO_CGO_PACKAGES),@CGO_ENABLED=1 $(GO) build -v -i $(GO_PKG_FLAGS) -o $(GO_OUT_DIR)/$(lastword $(subst /, ,$(p))) $(GO_TOOL_FLAGS) $(p))
$(foreach p,$(GO_STATIC_PACKAGES),@CGO_ENABLED=0 $(GO) build -v -i $(GO_PKG_STATIC_FLAGS) -o $(GO_OUT_DIR)/$(lastword $(subst /, ,$(p))) $(GO_TOOL_FLAGS) $(p))
.PHONY: go.install
go.install: go.vet go.fmt $(CGO_PREREQS)
$(foreach p,$(GO_NONSTATIC_PACKAGES),@CGO_ENABLED=1 $(GO) install -v $(GO_PKG_FLAGS) $(GO_TOOL_FLAGS) $(GO_PROJECT)/$(p)/...)
$(foreach p,$(GO_CGO_PACKAGES),@CGO_ENABLED=1 $(GO) install -v $(GO_PKG_FLAGS) $(GO_TOOL_FLAGS) $(GO_PROJECT)/$(p)/...)
$(foreach p,$(GO_STATIC_PACKAGES),@CGO_ENABLED=0 $(GO) install -v $(GO_PKG_STATIC_FLAGS) $(GO_TOOL_FLAGS) $(GO_PROJECT)/$(p)/...)
$(foreach p,$(GO_NONSTATIC_PACKAGES),@CGO_ENABLED=1 $(GO) install -v $(GO_PKG_FLAGS) $(GO_TOOL_FLAGS) $(p))
$(foreach p,$(GO_CGO_PACKAGES),@CGO_ENABLED=1 $(GO) install -v $(GO_PKG_FLAGS) $(GO_TOOL_FLAGS) $(p))
$(foreach p,$(GO_STATIC_PACKAGES),@CGO_ENABLED=0 $(GO) install -v $(GO_PKG_STATIC_FLAGS) $(GO_TOOL_FLAGS) $(p))
.PHONY: go.test
go.test: go.vet go.fmt $(CGO_PREREQS)
+1 -1
View File
@@ -14,7 +14,7 @@ build() {
local ext=".exe"
fi
local files=( castlectl${ext} )
local files=( castle${ext} )
if [[ ${type} == "both" ]]; then
files+=( castled${ext} )
+1 -1
View File
@@ -22,7 +22,7 @@ layout_root() {
mkdir -p $dir/root/etc/ssl/certs
cp $bindir/castled $dir/root/usr/bin
cp $bindir/castlectl $dir/root/usr/bin
cp $bindir/castle $dir/root/usr/bin
cp /etc/ssl/certs/ca-certificates.crt $dir/root/etc/ssl/certs
}
@@ -1,10 +1,10 @@
package main
package castle
import (
"fmt"
"net/http"
"github.com/quantum/castle/pkg/castlectl/client"
"github.com/quantum/castle/pkg/castle/client"
"github.com/quantum/castle/pkg/model"
"github.com/quantum/castle/pkg/util/flags"
"github.com/spf13/cobra"
@@ -1,10 +1,10 @@
package main
package castle
import (
"fmt"
"testing"
"github.com/quantum/castle/pkg/castlectl/test"
"github.com/quantum/castle/pkg/castle/test"
"github.com/quantum/castle/pkg/model"
"github.com/stretchr/testify/assert"
)
@@ -1,4 +1,4 @@
package main
package castle
import (
"bytes"
@@ -6,7 +6,7 @@ import (
"net/http"
"strings"
"github.com/quantum/castle/pkg/castlectl/client"
"github.com/quantum/castle/pkg/castle/client"
"github.com/quantum/castle/pkg/util/display"
"github.com/quantum/castle/pkg/util/exec"
"github.com/quantum/castle/pkg/util/flags"
@@ -1,4 +1,4 @@
package main
package castle
import (
"fmt"
@@ -10,7 +10,7 @@ import (
"github.com/stretchr/testify/assert"
"github.com/quantum/castle/pkg/castlectl/test"
"github.com/quantum/castle/pkg/castle/test"
"github.com/quantum/castle/pkg/model"
exectest "github.com/quantum/castle/pkg/util/exec/test"
)
@@ -1,4 +1,4 @@
package main
package castle
import (
"fmt"
@@ -10,7 +10,7 @@ import (
"strings"
"time"
"github.com/quantum/castle/pkg/castlectl/client"
"github.com/quantum/castle/pkg/castle/client"
"github.com/quantum/castle/pkg/model"
"github.com/quantum/castle/pkg/util/exec"
"github.com/quantum/castle/pkg/util/flags"
@@ -1,4 +1,4 @@
package main
package castle
import (
"fmt"
@@ -10,7 +10,7 @@ import (
"github.com/stretchr/testify/assert"
"github.com/quantum/castle/pkg/castlectl/test"
"github.com/quantum/castle/pkg/castle/test"
"github.com/quantum/castle/pkg/model"
exectest "github.com/quantum/castle/pkg/util/exec/test"
)
@@ -1,4 +1,4 @@
package main
package castle
import (
"fmt"
@@ -1,4 +1,4 @@
package main
package castle
import (
"fmt"
@@ -1,4 +1,4 @@
package main
package castle
import "github.com/spf13/cobra"
@@ -1,4 +1,4 @@
package main
package castle
import (
"fmt"
@@ -21,16 +21,16 @@ const (
outputTabWidth = 0
outputPadChar = ' '
logFileDir = "/tmp/castle/log"
logFileName = "castlectl.log"
logFileName = "castle.log"
)
var rootCmd = &cobra.Command{
Use: "castlectl",
Use: "castle",
Short: "A command line client for working with a castle cluster",
Long: `https://github.com/quantum/castle`,
}
func main() {
func Main() {
// set up logging to a log file instead of stdout (only command output and errors should go to stdout/stderr)
if err := os.MkdirAll(logFileDir, 0744); err != nil {
log.Fatalf("failed to create logging dir '%s': %+v", logFileDir, err)
@@ -45,7 +45,7 @@ func main() {
addCommands()
if err := rootCmd.Execute(); err != nil {
fmt.Printf("castlectl error: %+v\n", err)
fmt.Printf("castle error: %+v\n", err)
}
}
@@ -1,11 +1,11 @@
package main
package castle
import (
"bytes"
"fmt"
"net/http"
"github.com/quantum/castle/pkg/castlectl/client"
"github.com/quantum/castle/pkg/castle/client"
"github.com/quantum/castle/pkg/model"
"github.com/quantum/castle/pkg/util/display"
"github.com/spf13/cobra"
@@ -1,4 +1,4 @@
package main
package castle
import (
"fmt"
@@ -7,7 +7,7 @@ import (
"github.com/stretchr/testify/assert"
"github.com/quantum/castle/pkg/castlectl/test"
"github.com/quantum/castle/pkg/castle/test"
"github.com/quantum/castle/pkg/model"
)
+1 -1
View File
@@ -1,4 +1,4 @@
package main
package castle
import "github.com/spf13/cobra"
@@ -1,10 +1,10 @@
package main
package castle
import (
"fmt"
"net/http"
"github.com/quantum/castle/pkg/castlectl/client"
"github.com/quantum/castle/pkg/castle/client"
"github.com/quantum/castle/pkg/model"
"github.com/quantum/castle/pkg/util/flags"
"github.com/spf13/cobra"
@@ -1,10 +1,10 @@
package main
package castle
import (
"fmt"
"testing"
"github.com/quantum/castle/pkg/castlectl/test"
"github.com/quantum/castle/pkg/castle/test"
"github.com/quantum/castle/pkg/model"
"github.com/stretchr/testify/assert"
)
@@ -1,11 +1,11 @@
package main
package castle
import (
"bytes"
"fmt"
"net/http"
"github.com/quantum/castle/pkg/castlectl/client"
"github.com/quantum/castle/pkg/castle/client"
"github.com/quantum/castle/pkg/model"
"github.com/quantum/castle/pkg/util/display"
"github.com/quantum/castle/pkg/util/flags"
@@ -1,4 +1,4 @@
package main
package castle
import (
"fmt"
@@ -6,7 +6,7 @@ import (
"github.com/stretchr/testify/assert"
"github.com/quantum/castle/pkg/castlectl/test"
"github.com/quantum/castle/pkg/castle/test"
"github.com/quantum/castle/pkg/model"
)
+1 -1
View File
@@ -1,4 +1,4 @@
package main
package castle
import "github.com/spf13/cobra"
File renamed without changes.
+7
View File
@@ -0,0 +1,7 @@
package main
import "github.com/quantum/castle/cmd/castle"
func main() {
castle.Main()
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -3,7 +3,7 @@ package test
import (
"net/http"
"github.com/quantum/castle/pkg/castlectl/client"
"github.com/quantum/castle/pkg/castle/client"
"github.com/quantum/castle/pkg/model"
)