Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Split controller and node binaries #95

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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