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

🐛 CAPD: Fix for Linux security update to not set conntrack sysctls #4728

Merged
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
18 changes: 17 additions & 1 deletion test/infrastructure/docker/cloudinit/writefiles.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,19 @@ import (
"sigs.k8s.io/yaml"
)

const (
kubeadmInitPath = "/run/kubeadm/kubeadm.yaml"
kubeproxyComponentConfig = `
---
apiVersion: kubeproxy.config.k8s.io/v1alpha1
kind: KubeProxyConfiguration
conntrack:
# Skip setting sysctl value "net.netfilter.nf_conntrack_max"
# It is a global variable that affects other namespaces
maxPerCore: 0
`
)

// writeFilesAction defines a list of files that should be written to a node.
type writeFilesAction struct {
Files []files `json:"write_files,"`
Expand Down Expand Up @@ -65,6 +78,9 @@ func (a *writeFilesAction) Commands() ([]Cmd, error) {
owner := fixOwner(f.Owner)
permissions := fixPermissions(f.Permissions)
content, err := fixContent(f.Content, encodings)
if path == kubeadmInitPath {
content += kubeproxyComponentConfig
}
if err != nil {
return commands, errors.Wrapf(err, "error decoding content for %s", path)
}
Expand All @@ -78,7 +94,7 @@ func (a *writeFilesAction) Commands() ([]Cmd, error) {
redirects = ">>"
}

// generate a command that will create a file with the epxected contents.
// generate a command that will create a file with the expected contents.
commands = append(commands, Cmd{Cmd: "/bin/sh", Args: []string{"-c", fmt.Sprintf("cat %s %s /dev/stdin", redirects, path)}, Stdin: content})

// if permissions are different than default ownership, add a command to modify the permissions.
Expand Down