Skip to content
Merged
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
9 changes: 9 additions & 0 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,15 @@ jobs:
go-version-file: go.mod
cache: true

- name: Check gofmt
run: |
files="$(gofmt -l .)"
if [ -n "$files" ]; then
echo "Go files need formatting:"
echo "$files"
exit 1
fi

- name: Install system dependencies
run: |
sudo apt-get update
Expand Down
2 changes: 1 addition & 1 deletion cmd/bink/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ Common workflows:
}

logrus.SetFormatter(&logrus.TextFormatter{
FullTimestamp: false,
FullTimestamp: false,
DisableTimestamp: true,
})
},
Expand Down
2 changes: 0 additions & 2 deletions internal/cli/completion.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,5 +69,3 @@ func CompleteNodeNames(cmd *cobra.Command, args []string, toComplete string) ([]
}
return names, cobra.ShellCompDirectiveNoFileComp
}


6 changes: 3 additions & 3 deletions internal/cli/node/remove.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ func newRemoveCmd() *cobra.Command {
var force bool

cmd := &cobra.Command{
Use: "remove <node-name>",
Short: "Remove a node from the cluster",
Long: "Drain and remove a node from the Kubernetes cluster, then stop and remove its container",
Use: "remove <node-name>",
Short: "Remove a node from the cluster",
Long: "Drain and remove a node from the Kubernetes cluster, then stop and remove its container",
Args: cobra.ExactArgs(1),
ValidArgsFunction: cli.CompleteNodeNames,
RunE: func(cmd *cobra.Command, args []string) error {
Expand Down
2 changes: 1 addition & 1 deletion internal/cli/registry/info.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (
"fmt"

registrypkg "github.com/bootc-dev/bink/internal/registry"
"go.podman.io/podman/v6/libpod/define"
"github.com/spf13/cobra"
"go.podman.io/podman/v6/libpod/define"
)

func newInfoCmd() *cobra.Command {
Expand Down
4 changes: 2 additions & 2 deletions internal/cluster/images.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ import (

"github.com/bootc-dev/bink/internal/config"
"github.com/bootc-dev/bink/internal/podman"
"go.podman.io/podman/v6/pkg/specgen"
"github.com/opencontainers/runtime-spec/specs-go"
"github.com/sirupsen/logrus"
"go.podman.io/podman/v6/pkg/specgen"
)

var (
Expand Down Expand Up @@ -190,7 +190,7 @@ func (c *Cluster) populateImagesVolume(ctx context.Context, volumeName, nodeImag
Source: nodeImage,
Destination: "/images",
}},
Volumes: []*specgen.NamedVolume{{Name: volumeName, Dest: "/var/lib/containers/storage"}},
Volumes: []*specgen.NamedVolume{{Name: volumeName, Dest: "/var/lib/containers/storage"}},
CapAdd: []string{"SYS_ADMIN"},
Devices: []specs.LinuxDevice{{Path: "/dev/fuse"}},
SelinuxOpts: []string{"disable"},
Expand Down
20 changes: 10 additions & 10 deletions internal/cluster/images_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,15 @@ func TestExtractVersionFromTag(t *testing.T) {
}

type mockPodmanClient struct {
imageLabels map[string]string
imageInspectErr error
volumeExistsVal bool
volumeExistsErr error
volumeCreateErr error
containerCreated bool
containerCreateErr error
containerExecOut string
containerExecErr error
imageLabels map[string]string
imageInspectErr error
volumeExistsVal bool
volumeExistsErr error
volumeCreateErr error
containerCreated bool
containerCreateErr error
containerExecOut string
containerExecErr error
containerExecQuietErr error
containerRunQuietErr error
containerExistsVal bool
Expand Down Expand Up @@ -203,7 +203,7 @@ func TestEnsureImagesVolume(t *testing.T) {

t.Run("volume exists and completed", func(t *testing.T) {
mock := &mockPodmanClient{
imageLabels: map[string]string{"bink.kubeadm-version": "1.35"},
imageLabels: map[string]string{"bink.kubeadm-version": "1.35"},
volumeExistsVal: true,
}
c := New(Config{Name: "test", PodmanClient: mock})
Expand Down
2 changes: 1 addition & 1 deletion internal/haproxy/haproxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ import (

"github.com/bootc-dev/bink/internal/config"
"github.com/bootc-dev/bink/internal/podman"
"go.podman.io/podman/v6/libpod/define"
"github.com/sirupsen/logrus"
nettypes "go.podman.io/common/libnetwork/types"
"go.podman.io/podman/v6/libpod/define"
)

var configTemplate = template.Must(template.New("haproxy.cfg").Parse(`global
Expand Down
4 changes: 2 additions & 2 deletions internal/node/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ import (
"github.com/bootc-dev/bink/internal/config"
"github.com/bootc-dev/bink/internal/podman"
"github.com/bootc-dev/bink/internal/virsh"
"go.podman.io/podman/v6/pkg/specgen"
"github.com/opencontainers/runtime-spec/specs-go"
"github.com/sirupsen/logrus"
nettypes "go.podman.io/common/libnetwork/types"
"go.podman.io/podman/v6/pkg/specgen"
)

func (n *Node) createContainer(ctx context.Context) error {
Expand Down Expand Up @@ -222,7 +222,7 @@ func (n *Node) createVM(ctx context.Context) error {
Memory: n.Memory,
MaxMemory: maxMemory,
VCPUs: n.VCPUs,
Disks: []string{overlayDisk, isoPath},
Disks: []string{overlayDisk, isoPath},
Networks: []virsh.NetworkConfig{
{
Type: "passt",
Expand Down
1 change: 0 additions & 1 deletion internal/node/ip_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ func TestCalculateClusterIP(t *testing.T) {
}
}


func TestCalculateClusterIP_Deterministic(t *testing.T) {
for i := 0; i < 10; i++ {
ip1 := CalculateClusterIP("podman", "node1")
Expand Down
4 changes: 2 additions & 2 deletions internal/podman/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ import (
"strings"

"github.com/bootc-dev/bink/internal/config"
"github.com/sirupsen/logrus"
nettypes "go.podman.io/common/libnetwork/types"
"go.podman.io/podman/v6/pkg/api/handlers"
"go.podman.io/podman/v6/pkg/bindings"
"go.podman.io/podman/v6/pkg/bindings/containers"
Expand All @@ -22,8 +24,6 @@ import (
"go.podman.io/podman/v6/pkg/bindings/volumes"
"go.podman.io/podman/v6/pkg/domain/entities"
"go.podman.io/podman/v6/pkg/specgen"
"github.com/sirupsen/logrus"
nettypes "go.podman.io/common/libnetwork/types"
)

type Client struct {
Expand Down
2 changes: 1 addition & 1 deletion internal/podman/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
package podman

import (
"go.podman.io/podman/v6/pkg/specgen"
"github.com/opencontainers/runtime-spec/specs-go"
nettypes "go.podman.io/common/libnetwork/types"
"go.podman.io/podman/v6/pkg/specgen"
)

type ContainerCreateOptions struct {
Expand Down
14 changes: 7 additions & 7 deletions internal/registry/registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ import (

"github.com/bootc-dev/bink/internal/config"
"github.com/bootc-dev/bink/internal/podman"
"go.podman.io/podman/v6/libpod/define"
"go.podman.io/podman/v6/pkg/specgen"
"github.com/sirupsen/logrus"
nettypes "go.podman.io/common/libnetwork/types"
"go.podman.io/podman/v6/libpod/define"
"go.podman.io/podman/v6/pkg/specgen"
)

type Manager struct {
Expand Down Expand Up @@ -141,11 +141,11 @@ func (m *Manager) StopRegistry(ctx context.Context) error {
}

type RegistryStatus struct {
Running bool
IP string
HostPort int
PushURL string
PullURL string
Running bool
IP string
HostPort int
PushURL string
PullURL string
}

func (m *Manager) RegistryInfo(ctx context.Context) (*RegistryStatus, error) {
Expand Down
10 changes: 5 additions & 5 deletions internal/ssh/ssh.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ type Client struct {

// Config holds SSH client configuration
type Config struct {
ContainerName string // Podman container name
Host string // SSH host (usually "localhost" for port-forwarded VMs)
Port string // SSH port (usually "2222" for port-forwarded VMs)
KeyPath string // Path to SSH private key
User string // SSH user (usually "core")
ContainerName string // Podman container name
Host string // SSH host (usually "localhost" for port-forwarded VMs)
Port string // SSH port (usually "2222" for port-forwarded VMs)
KeyPath string // Path to SSH private key
User string // SSH user (usually "core")
Logger *logrus.Logger
PodmanClient *podman.Client // Podman client for container operations
}
Expand Down
1 change: 0 additions & 1 deletion internal/virsh/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,4 +132,3 @@ func (c *Client) Genisoimage(ctx context.Context, outputPath, volumeID string, f

return c.podmanClient.ContainerExecQuiet(ctx, c.containerName, args)
}

2 changes: 1 addition & 1 deletion test/integration/images_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import (
"strings"
"time"

"go.podman.io/podman/v6/pkg/specgen"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"go.podman.io/podman/v6/pkg/specgen"

"github.com/bootc-dev/bink/internal/cluster"
"github.com/bootc-dev/bink/internal/config"
Expand Down