Skip to content

Commit

Permalink
Split controller and node binaries
Browse files Browse the repository at this point in the history
Signed-off-by: Jose A. Rivera <[email protected]>
  • Loading branch information
jarrpa committed Nov 12, 2018
1 parent de19709 commit 3121442
Show file tree
Hide file tree
Showing 26 changed files with 1,955 additions and 1,735 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# local build dir
build

# go coverage data
profile.cov

Expand Down
35 changes: 19 additions & 16 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

set -e

# Set driver name
DRIVER="${DRIVER:-glusterfs-csi-driver}"
# Set which drivers to build
DRIVERS="${DRIVERS:-glusterfs-controller glusterfs-node}"

# Set which docker repo to tag
REPO="${REPO:-gluster/}"
Expand Down Expand Up @@ -38,17 +38,20 @@ build_args+=( --build-arg "builddate=$BUILDDATE" )
echo "=== $RUNTIME_CMD version ==="
$RUNTIME_CMD version

#-- Build container
$RUNTIME_CMD $build \
-t "${REPO}${DRIVER}" \
"${build_args[@]}" \
-f pkg/glusterfs/Dockerfile \
. \
|| exit 1

# If running tests, extract profile data
if [ "$RUN_TESTS" -ne 0 ]; then
rm -f profile.cov
$RUNTIME_CMD run --entrypoint cat "${REPO}${DRIVER}" \
/profile.cov > profile.cov
fi
#-- Build containers
for driver in ${DRIVERS}; do
$RUNTIME_CMD $build \
-t "${REPO}${driver}-csi-driver" \
--build-arg DRIVER="$driver" \
"${build_args[@]}" \
-f extras/Dockerfile \
. \
|| exit 1

# If running tests, extract profile data
if [ "$RUN_TESTS" -ne 0 ]; then
rm -f profile.cov
$RUNTIME_CMD run --entrypoint cat "${REPO}${driver}-csi-driver" \
/profile.cov > profile.cov
fi
done
35 changes: 35 additions & 0 deletions cmd/glusterfs-controller/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package main

import (
"fmt"
"os"

"github.com/gluster/gluster-csi-driver/pkg/command"
"github.com/gluster/gluster-csi-driver/pkg/glusterfs"
)

// Driver Identifiers
const (
cmdName = "glusterfs-controller-driver"
CSIDriverDesc = "GlusterFS (glusterd2) CSI Controller Driver"
CSIDriverName = "org.gluster.glusterfs"
CSIDriverVersion = "0.0.9"
)

func init() {
command.Init()
}

func main() {
var config = command.NewConfig(cmdName, CSIDriverName, CSIDriverVersion, CSIDriverDesc)

d := glusterfs.New(config)
if d == nil {
fmt.Println("Failed to initialize GlusterFS CSI driver")
os.Exit(1)
}

cmd := command.InitCommand(config, d)

command.Run(config, cmd)
}
35 changes: 35 additions & 0 deletions cmd/glusterfs-node/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package main

import (
"fmt"
"os"

"github.com/gluster/gluster-csi-driver/pkg/command"
"github.com/gluster/gluster-csi-driver/pkg/node"
)

// Driver Identifiers
const (
cmdName = "glusterfs-node-driver"
CSIDriverDesc = "GlusterFS (glusterd2) CSI Node Driver"
CSIDriverName = "org.gluster.glusterfs"
CSIDriverVersion = "0.0.9"
)

func init() {
command.Init()
}

func main() {
var config = command.NewConfig(cmdName, CSIDriverName, CSIDriverVersion, CSIDriverDesc)

d := node.New(config)
if d == nil {
fmt.Println("Failed to initialize GlusterFS CSI driver")
os.Exit(1)
}

cmd := command.InitCommand(config, d)

command.Run(config, cmd)
}
62 changes: 0 additions & 62 deletions cmd/glusterfs/main.go

This file was deleted.

Loading

0 comments on commit 3121442

Please sign in to comment.