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
14 changes: 12 additions & 2 deletions pkg/util/k8sutil/pods.go
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,8 @@ func arangodContainer(image string, imagePullPolicy v1.PullPolicy, args []string
Protocol: v1.ProtocolTCP,
},
},
VolumeMounts: arangodVolumeMounts(),
VolumeMounts: arangodVolumeMounts(),
SecurityContext: SecurityContextWithoutCapabilities(),
}
if noFilterResources {
c.Resources = resources // if volumeclaimtemplate is specified
Expand Down Expand Up @@ -381,7 +382,8 @@ func arangosyncContainer(image string, imagePullPolicy v1.PullPolicy, args []str
Protocol: v1.ProtocolTCP,
},
},
Resources: resources,
Resources: resources,
SecurityContext: SecurityContextWithoutCapabilities(),
}
for k, v := range env {
c.Env = append(c.Env, v.CreateEnvVar(k))
Expand Down Expand Up @@ -825,3 +827,11 @@ func createPod(kubecli kubernetes.Interface, pod *v1.Pod, ns string, owner metav
}
return nil
}

func SecurityContextWithoutCapabilities() *v1.SecurityContext {
return &v1.SecurityContext{
Capabilities: &v1.Capabilities{
Drop: []v1.Capability{"all"},
},
}
}
11 changes: 9 additions & 2 deletions scripts/kube_create_backup_remote_secret.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash

NS=$1

Expand All @@ -12,7 +12,14 @@ if [ -z "$2" ]; then
exit 0
fi

SECRET=$(echo -n $2 | base64 -w 0)
case $(uname) in
Darwin)
SECRET=$(echo -n $2 | base64 -b 0)
;;
*)
SECRET=$(echo -n $2 | base64 -w 0)
;;
esac

kubectl apply -f - <<EOF
apiVersion: v1
Expand Down
11 changes: 9 additions & 2 deletions scripts/kube_create_license_key_secret.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash

NS=$1

Expand All @@ -12,7 +12,14 @@ if [ -z "$2" ]; then
exit 0
fi

LICENSE=$(echo -n "$2" | base64 -w 0)
case $(uname) in
Darwin)
LICENSE=$(echo -n "$2" | base64 -b 0)
;;
*)
LICENSE=$(echo -n "$2" | base64 -w 0)
;;
esac
Comment on lines +15 to +22
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you are welcome :)


kubectl apply -f - <<EOF
apiVersion: v1
Expand Down
7 changes: 5 additions & 2 deletions tests/backup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,13 @@ package tests
import (
"context"
"fmt"
"github.com/arangodb/kube-arangodb/pkg/backup/utils"
"os"
"strings"
"testing"
"time"

"github.com/arangodb/kube-arangodb/pkg/backup/utils"

backupClient "github.com/arangodb/kube-arangodb/pkg/generated/clientset/versioned/typed/backup/v1"

"github.com/rs/zerolog/log"
Expand Down Expand Up @@ -434,6 +435,8 @@ func TestBackupCluster(t *testing.T) {
})

t.Run("create-upload backup", func(t *testing.T) {
skipOrRemotePath(t)

backup := newBackup(fmt.Sprintf("my-backup-%s", uniuri.NewLen(4)), depl.GetName(), nil)
_, err := backupClient.Create(backup)
require.NoError(t, err, "failed to create backup: %s", err)
Expand Down Expand Up @@ -669,7 +672,7 @@ func TestBackupCluster(t *testing.T) {
// Assert that all of the backups are in valid state
backups, err = backupClient.List(metav1.ListOptions{LabelSelector: metav1.FormatLabelSelector(&labels)})
require.NoError(t, err)
require.Len(t, backups.Items, size + 1)
require.Len(t, backups.Items, size+1)

for _, b := range backups.Items {
require.Equal(t, backupApi.ArangoBackupStateReady, b.Status.State, b.Status.Message)
Expand Down
2 changes: 0 additions & 2 deletions tests/load_balancer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ import (
driver "github.com/arangodb/go-driver"
api "github.com/arangodb/kube-arangodb/pkg/apis/deployment/v1"
"github.com/arangodb/kube-arangodb/pkg/client"
"github.com/arangodb/kube-arangodb/pkg/util"
)

func TestLoadBalancingCursorVST(t *testing.T) {
Expand Down Expand Up @@ -68,7 +67,6 @@ func loadBalancingCursorSubtest(t *testing.T, useVst bool) {
}
depl := newDeployment(namePrefix + uniuri.NewLen(4))
depl.Spec.Mode = api.NewMode(api.DeploymentModeCluster)
depl.Spec.Image = util.NewString("arangodb/arangodb:3.3.13") // Note: 3.3.13 is the first version supporting the cursor forwarding feature.

// Create deployment
_, err := c.DatabaseV1().ArangoDeployments(ns).Create(depl)
Expand Down
2 changes: 1 addition & 1 deletion tests/pc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func waitForPriorityOfServerGroup(kube kubernetes.Interface, c versioned.Interfa
}

if *pod.Spec.Priority != priority {
return fmt.Errorf("Wrong pod priority, expected %d, found %d", priority, pod.Spec.Priority)
return fmt.Errorf("Wrong pod priority, expected %d, found %d", priority, *pod.Spec.Priority)
}
}

Expand Down