-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update e2e lxd-profile and kube-proxy config (#178)
Juju only supports specific devices. This commit removes the unsupported ones. Also, the container cannot modify the sysctl config on LXD, thus we disable the setting in kube-proxy.
- Loading branch information
1 parent
21fa476
commit d43b916
Showing
9 changed files
with
106 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
package setup_test | ||
|
||
import ( | ||
"context" | ||
"os" | ||
"path" | ||
"testing" | ||
|
||
"github.com/canonical/k8s/pkg/k8sd/setup" | ||
"github.com/canonical/k8s/pkg/snap/mock" | ||
snaputil "github.com/canonical/k8s/pkg/snap/util" | ||
. "github.com/onsi/gomega" | ||
) | ||
|
||
func TestKubeProxy(t *testing.T) { | ||
g := NewWithT(t) | ||
|
||
dir := t.TempDir() | ||
|
||
s := &mock.Snap{ | ||
Mock: mock.Mock{ | ||
KubernetesConfigDir: path.Join(dir, "kubernetes"), | ||
ServiceArgumentsDir: path.Join(dir, "args"), | ||
OnLXD: false, | ||
UID: os.Getuid(), | ||
GID: os.Getgid(), | ||
}, | ||
} | ||
|
||
g.Expect(setup.EnsureAllDirectories(s)).To(BeNil()) | ||
|
||
t.Run("Args", func(t *testing.T) { | ||
g.Expect(setup.KubeProxy(context.Background(), s, "myhostname", "10.1.0.0/16")).To(BeNil()) | ||
|
||
for key, expectedVal := range map[string]string{ | ||
"--cluster-cidr": "10.1.0.0/16", | ||
"--healthz-bind-address": "127.0.0.1", | ||
"--hostname-override": "myhostname", | ||
"--kubeconfig": path.Join(dir, "kubernetes", "proxy.conf"), | ||
"--profiling": "false", | ||
"--conntrack-max-per-core": "", | ||
} { | ||
t.Run(key, func(t *testing.T) { | ||
g := NewWithT(t) | ||
val, err := snaputil.GetServiceArgument(s, "kube-proxy", key) | ||
g.Expect(err).To(BeNil()) | ||
g.Expect(val).To(Equal(expectedVal)) | ||
}) | ||
} | ||
}) | ||
|
||
s.Mock.OnLXD = true | ||
t.Run("ArgsOnLXD", func(t *testing.T) { | ||
g.Expect(setup.KubeProxy(context.Background(), s, "myhostname", "10.1.0.0/16")).To(BeNil()) | ||
|
||
for key, expectedVal := range map[string]string{ | ||
"--conntrack-max-per-core": "0", | ||
} { | ||
t.Run(key, func(t *testing.T) { | ||
g := NewWithT(t) | ||
val, err := snaputil.GetServiceArgument(s, "kube-proxy", key) | ||
g.Expect(err).To(BeNil()) | ||
g.Expect(val).To(Equal(expectedVal)) | ||
}) | ||
} | ||
}) | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters