Skip to content

Commit ed1bdca

Browse files
committed
Split controller and node binaries
Signed-off-by: Jose A. Rivera <jarrpa@redhat.com>
1 parent de19709 commit ed1bdca

File tree

26 files changed

+1955
-1735
lines changed

26 files changed

+1955
-1735
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# local build dir
2+
build
3+
14
# go coverage data
25
profile.cov
36

build.sh

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
set -e
44

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

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

41-
#-- Build container
42-
$RUNTIME_CMD $build \
43-
-t "${REPO}${DRIVER}" \
44-
"${build_args[@]}" \
45-
-f pkg/glusterfs/Dockerfile \
46-
. \
47-
|| exit 1
48-
49-
# If running tests, extract profile data
50-
if [ "$RUN_TESTS" -ne 0 ]; then
51-
rm -f profile.cov
52-
$RUNTIME_CMD run --entrypoint cat "${REPO}${DRIVER}" \
53-
/profile.cov > profile.cov
54-
fi
41+
#-- Build containers
42+
for driver in ${DRIVERS}; do
43+
$RUNTIME_CMD $build \
44+
-t "${REPO}${driver}-csi-driver" \
45+
--build-arg DRIVER="$driver" \
46+
"${build_args[@]}" \
47+
-f extras/Dockerfile \
48+
. \
49+
|| exit 1
50+
51+
# If running tests, extract profile data
52+
if [ "$RUN_TESTS" -ne 0 ]; then
53+
rm -f profile.cov
54+
$RUNTIME_CMD run --entrypoint cat "${REPO}${driver}-csi-driver" \
55+
/profile.cov > profile.cov
56+
fi
57+
done

cmd/glusterfs-controller/main.go

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
package main
2+
3+
import (
4+
"fmt"
5+
"os"
6+
7+
"github.com/gluster/gluster-csi-driver/pkg/command"
8+
"github.com/gluster/gluster-csi-driver/pkg/glusterfs"
9+
)
10+
11+
// Driver Identifiers
12+
const (
13+
cmdName = "glusterfs-controller-driver"
14+
CSIDriverDesc = "GlusterFS (glusterd2) CSI Controller Driver"
15+
CSIDriverName = "org.gluster.glusterfs"
16+
CSIDriverVersion = "0.0.9"
17+
)
18+
19+
func init() {
20+
command.Init()
21+
}
22+
23+
func main() {
24+
var config = command.NewConfig(cmdName, CSIDriverName, CSIDriverVersion, CSIDriverDesc)
25+
26+
d := glusterfs.New(config)
27+
if d == nil {
28+
fmt.Println("Failed to initialize GlusterFS CSI driver")
29+
os.Exit(1)
30+
}
31+
32+
cmd := command.InitCommand(config, d)
33+
34+
command.Run(config, cmd)
35+
}

cmd/glusterfs-node/main.go

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
package main
2+
3+
import (
4+
"fmt"
5+
"os"
6+
7+
"github.com/gluster/gluster-csi-driver/pkg/command"
8+
"github.com/gluster/gluster-csi-driver/pkg/node"
9+
)
10+
11+
// Driver Identifiers
12+
const (
13+
cmdName = "glusterfs-node-driver"
14+
CSIDriverDesc = "GlusterFS (glusterd2) CSI Node Driver"
15+
CSIDriverName = "org.gluster.glusterfs"
16+
CSIDriverVersion = "0.0.9"
17+
)
18+
19+
func init() {
20+
command.Init()
21+
}
22+
23+
func main() {
24+
var config = command.NewConfig(cmdName, CSIDriverName, CSIDriverVersion, CSIDriverDesc)
25+
26+
d := node.New(config)
27+
if d == nil {
28+
fmt.Println("Failed to initialize GlusterFS CSI driver")
29+
os.Exit(1)
30+
}
31+
32+
cmd := command.InitCommand(config, d)
33+
34+
command.Run(config, cmd)
35+
}

cmd/glusterfs/main.go

Lines changed: 0 additions & 62 deletions
This file was deleted.

0 commit comments

Comments
 (0)