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

Update flannel to v0.26.2 #17179

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
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
55 changes: 55 additions & 0 deletions nodeup/pkg/model/networking/flannel.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/*
Copyright 2024 The Kubernetes Authors.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package networking

import (
"k8s.io/kops/nodeup/pkg/model"
"k8s.io/kops/upup/pkg/fi"
"k8s.io/kops/upup/pkg/fi/nodeup/nodetasks"
"k8s.io/kops/util/pkg/distributions"
)

// FlannelBuilder writes the Amazon VPC CNI configuration
type FlannelBuilder struct {
*model.NodeupModelContext
}

var _ fi.NodeupModelBuilder = &FlannelBuilder{}

// Build is responsible for configuring the network cni
func (b *FlannelBuilder) Build(c *fi.NodeupModelBuilderContext) error {
if b.NodeupConfig.Networking.Flannel == nil {
return nil
}

if b.Distribution == distributions.DistributionUbuntu2404 {
// https://github.com/flannel-io/flannel/blob/master/Documentation/troubleshooting.md#nat
c.AddTask(&nodetasks.File{
Path: "/etc/udev/rules.d/90-flannel.rules",
Contents: fi.NewStringResource(
`SUBSYSTEM=="net", ACTION=="add|change|move", ENV{INTERFACE}=="flannel.1", RUN+="/usr/sbin/ethtool -K flannel.1 tx-checksum-ip-generic off"`,
),
Type: nodetasks.FileType_File,
OnChangeExecute: [][]string{
{"udevadm", "control", "--reload-rules"},
{"udevadm", "trigger"},
},
})
}

return nil
}
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ spec:
version: 9.99.0
- id: k8s-1.25
manifest: networking.flannel/k8s-1.25.yaml
manifestHash: 0b0d13083ea6ee5196f49234a338d9d96e21684a622d2320bd4d9241f7b2e2d7
manifestHash: b32abfc782bdbdbfb9d63c6f3340296cdc6c1f069384ac53e36671853ef28bed
name: networking.flannel
prune:
kinds:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ metadata:
labels:
addon.kops.k8s.io/name: networking.flannel
app.kubernetes.io/managed-by: kops
k8s-app: flannel
pod-security.kubernetes.io/enforce: privileged
role.kubernetes.io/networking: "1"
name: kube-flannel
Expand All @@ -18,6 +19,7 @@ metadata:
labels:
addon.kops.k8s.io/name: networking.flannel
app.kubernetes.io/managed-by: kops
k8s-app: flannel
role.kubernetes.io/networking: "1"
name: flannel
rules:
Expand All @@ -32,6 +34,7 @@ rules:
resources:
- nodes
verbs:
- get
- list
- watch
- apiGroups:
Expand All @@ -50,6 +53,7 @@ metadata:
labels:
addon.kops.k8s.io/name: networking.flannel
app.kubernetes.io/managed-by: kops
k8s-app: flannel
role.kubernetes.io/networking: "1"
name: flannel
roleRef:
Expand All @@ -70,6 +74,7 @@ metadata:
labels:
addon.kops.k8s.io/name: networking.flannel
app.kubernetes.io/managed-by: kops
k8s-app: flannel
role.kubernetes.io/networking: "1"
name: flannel
namespace: kube-flannel
Expand Down Expand Up @@ -101,6 +106,7 @@ data:
net-conf.json: |-
{
"Network": "100.64.0.0/10",
"EnableNFTables": true,
"Backend": {
"Type": "vxlan"
}
Expand All @@ -112,6 +118,7 @@ metadata:
addon.kops.k8s.io/name: networking.flannel
app: flannel
app.kubernetes.io/managed-by: kops
k8s-app: flannel
role.kubernetes.io/networking: "1"
tier: node
name: kube-flannel-cfg
Expand All @@ -127,6 +134,7 @@ metadata:
addon.kops.k8s.io/name: networking.flannel
app: flannel
app.kubernetes.io/managed-by: kops
k8s-app: flannel
role.kubernetes.io/networking: "1"
tier: node
name: kube-flannel-ds
Expand Down Expand Up @@ -171,11 +179,10 @@ spec:
fieldPath: metadata.namespace
- name: EVENT_QUEUE_DEPTH
value: "5000"
image: docker.io/rancher/mirrored-flannelcni-flannel:v0.19.2
image: docker.io/flannel/flannel:v0.26.2
name: kube-flannel
resources:
limits:
cpu: 100m
memory: 50Mi
requests:
cpu: 100m
Expand All @@ -201,7 +208,7 @@ spec:
- /opt/cni/bin/flannel
command:
- cp
image: docker.io/rancher/mirrored-flannelcni-flannel-cni-plugin:v1.1.0
image: docker.io/flannel/flannel-cni-plugin:v1.6.0-flannel1
name: install-cni-plugin
volumeMounts:
- mountPath: /opt/cni/bin
Expand All @@ -212,7 +219,7 @@ spec:
- /etc/cni/net.d/10-flannel.conflist
command:
- cp
image: docker.io/rancher/mirrored-flannelcni-flannel:v0.19.2
image: docker.io/flannel/flannel:v0.26.2
name: install-cni
volumeMounts:
- mountPath: /etc/cni/net.d
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
# Pulled and modified from: https://raw.githubusercontent.com/coreos/flannel/v0.19.2/Documentation/kube-flannel.yml
# Pulled and modified from: https://raw.githubusercontent.com/coreos/flannel/v0.26.2/Documentation/kube-flannel.yml
---
kind: Namespace
apiVersion: v1
metadata:
name: kube-flannel
labels:
k8s-app: flannel
pod-security.kubernetes.io/enforce: privileged
---
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
labels:
k8s-app: flannel
name: flannel
rules:
- apiGroups:
Expand All @@ -23,6 +26,7 @@ rules:
resources:
- nodes
verbs:
- get
- list
- watch
- apiGroups:
Expand All @@ -35,6 +39,8 @@ rules:
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
labels:
k8s-app: flannel
name: flannel
roleRef:
apiGroup: rbac.authorization.k8s.io
Expand All @@ -48,6 +54,8 @@ subjects:
apiVersion: v1
kind: ServiceAccount
metadata:
labels:
k8s-app: flannel
name: flannel
namespace: kube-flannel
---
Expand All @@ -58,6 +66,7 @@ metadata:
namespace: kube-flannel
labels:
tier: node
k8s-app: flannel
app: flannel
data:
cni-conf.json: |
Expand All @@ -83,6 +92,7 @@ data:
net-conf.json: |
{
"Network": "{{ .Networking.NonMasqueradeCIDR }}",
"EnableNFTables": true,
"Backend": {
"Type": "{{ FlannelBackendType }}"
}
Expand All @@ -96,6 +106,7 @@ metadata:
labels:
tier: node
app: flannel
k8s-app: flannel
spec:
selector:
matchLabels:
Expand Down Expand Up @@ -124,8 +135,7 @@ spec:
serviceAccountName: flannel
initContainers:
- name: install-cni-plugin
#image: flannelcni/flannel-cni-plugin:v1.1.0 for ppc64le and mips64le (dockerhub limitations may apply)
image: docker.io/rancher/mirrored-flannelcni-flannel-cni-plugin:v1.1.0
image: docker.io/flannel/flannel-cni-plugin:v1.6.0-flannel1
command:
- cp
args:
Expand All @@ -136,8 +146,7 @@ spec:
- name: cni-plugin
mountPath: /opt/cni/bin
- name: install-cni
#image: flannelcni/flannel:v0.19.2 for ppc64le and mips64le (dockerhub limitations may apply)
image: docker.io/rancher/mirrored-flannelcni-flannel:v0.19.2
image: docker.io/flannel/flannel:v0.26.2
command:
- cp
args:
Expand All @@ -151,8 +160,7 @@ spec:
mountPath: /etc/kube-flannel/
containers:
- name: kube-flannel
#image: flannelcni/flannel:v0.19.2 for ppc64le and mips64le (dockerhub limitations may apply)
image: docker.io/rancher/mirrored-flannelcni-flannel:v0.19.2
image: docker.io/flannel/flannel:v0.26.2
command:
- /opt/bin/flanneld
args:
Expand All @@ -164,7 +172,6 @@ spec:
cpu: "100m"
memory: "50Mi"
limits:
cpu: "100m"
memory: "50Mi"
securityContext:
privileged: false
Expand Down
1 change: 1 addition & 0 deletions upup/pkg/fi/nodeup/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,7 @@ func (c *NodeUpCommand) Run(out io.Writer) error {
loader.Builders = append(loader.Builders, &networking.CalicoBuilder{NodeupModelContext: modelContext})
loader.Builders = append(loader.Builders, &networking.CiliumBuilder{NodeupModelContext: modelContext})
loader.Builders = append(loader.Builders, &networking.AmazonVPCRoutedENIBuilder{NodeupModelContext: modelContext})
loader.Builders = append(loader.Builders, &networking.FlannelBuilder{NodeupModelContext: modelContext})
loader.Builders = append(loader.Builders, &networking.KuberouterBuilder{NodeupModelContext: modelContext})

loader.Builders = append(loader.Builders, &model.BootstrapClientBuilder{NodeupModelContext: modelContext})
Expand Down
Loading