Skip to content

Commit

Permalink
cleanup: Remove deprecated values for KPR
Browse files Browse the repository at this point in the history
This commit is to remove all deprecated values (strict, disabled, probe
and partial) for kubeProxyReplacement.

Relates: cilium#26036, cilium#26496

Signed-off-by: Tam Mach <tam.mach@cilium.io>
  • Loading branch information
sayboras authored and rzdebskiy committed Apr 3, 2024
1 parent e2e7631 commit a5bbf67
Show file tree
Hide file tree
Showing 17 changed files with 48 additions and 109 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/tests-ipsec-upgrade.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -80,15 +80,15 @@ jobs:
# renovate: datasource=docker depName=quay.io/lvh-images/kind
kernel: '5.4-20240305.092417'
kube-proxy: 'iptables'
kpr: 'disabled'
kpr: 'false'
tunnel: 'disabled'
encryption: 'ipsec'

- config: '5.10'
# renovate: datasource=docker depName=quay.io/lvh-images/kind
kernel: '5.10-20240305.092417'
kube-proxy: 'iptables'
kpr: 'disabled'
kpr: 'false'
tunnel: 'disabled'
encryption: 'ipsec'
endpoint-routes: 'true'
Expand All @@ -107,7 +107,7 @@ jobs:
# renovate: datasource=docker depName=quay.io/lvh-images/kind
kernel: '6.1-20240305.092417'
kube-proxy: 'iptables'
kpr: 'disabled'
kpr: 'false'
tunnel: 'vxlan'
encryption: 'ipsec'
endpoint-routes: 'false'
Expand All @@ -116,7 +116,7 @@ jobs:
# renovate: datasource=docker depName=quay.io/lvh-images/kind
kernel: 'bpf-next-20240315.012542'
kube-proxy: 'iptables'
kpr: 'disabled'
kpr: 'false'
tunnel: 'vxlan'
encryption: 'ipsec'
endpoint-routes: 'true'
Expand Down
6 changes: 6 additions & 0 deletions Documentation/operations/upgrade.rst
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,9 @@ Removed Options
* The long defunct and undocumented ``single-cluster-route`` flag has been removed.

* Deprecated options ``enable-k8s-event-handover`` and ``cnp-status-update-interval`` has been removed.
* Deprecated values ``strict``, ``partial``, ``probe`` and ``disabled`` for ``kube-proxy-replacement`` flag have been
removed. Please use ``true`` or ``false`` instead. Please refer to :ref:`kube-proxy replacement <kubeproxy-free>`
for more details.

Helm Options
~~~~~~~~~~~~
Expand All @@ -469,6 +472,9 @@ Helm Options

* Values ``enableK8sEventHandover`` and ``enableCnpStatusUpdates`` have been removed.

* Deprecated values ``strict``, ``partial``, ``probe`` and ``disabled`` for ``kubeProxyReplacement`` option have been
removed. Please use ``true`` or ``false`` instead.

Added Metrics
~~~~~~~~~~~~~

Expand Down
16 changes: 2 additions & 14 deletions api/v1/models/kube_proxy_replacement.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 0 additions & 4 deletions api/v1/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2352,10 +2352,6 @@ definitions:
mode:
type: string
enum:
- Disabled
- Strict
- Probe
- Partial
- 'True'
- 'False'
devices:
Expand Down
8 changes: 0 additions & 8 deletions api/v1/server/embedded_spec.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion daemon/cmd/daemon_main.go
Original file line number Diff line number Diff line change
Expand Up @@ -1811,7 +1811,7 @@ func startDaemon(d *Daemon, restoredEndpoints *endpointRestoreState, cleaner *da

d.startAgentHealthHTTPService()
if option.Config.KubeProxyReplacementHealthzBindAddr != "" {
if option.Config.KubeProxyReplacement != option.KubeProxyReplacementDisabled {
if option.Config.KubeProxyReplacement != option.KubeProxyReplacementFalse {
d.startKubeProxyHealthzHTTPService(option.Config.KubeProxyReplacementHealthzBindAddr)
}
}
Expand Down
35 changes: 5 additions & 30 deletions daemon/cmd/kube_proxy_replacement.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,37 +42,12 @@ import (
// if this function cannot determine the strictness an error is returned and the boolean
// is false. If an error is returned the boolean is of no meaning.
func initKubeProxyReplacementOptions(sysctl sysctl.Sysctl, tunnelConfig tunnel.Config) error {
if option.Config.KubeProxyReplacement != option.KubeProxyReplacementStrict &&
option.Config.KubeProxyReplacement != option.KubeProxyReplacementPartial &&
option.Config.KubeProxyReplacement != option.KubeProxyReplacementDisabled &&
option.Config.KubeProxyReplacement != option.KubeProxyReplacementTrue &&
if option.Config.KubeProxyReplacement != option.KubeProxyReplacementTrue &&
option.Config.KubeProxyReplacement != option.KubeProxyReplacementFalse {
return fmt.Errorf("Invalid value for --%s: %s", option.KubeProxyReplacement, option.Config.KubeProxyReplacement)
}

if option.Config.KubeProxyReplacement == option.KubeProxyReplacementStrict ||
option.Config.KubeProxyReplacement == option.KubeProxyReplacementPartial ||
option.Config.KubeProxyReplacement == option.KubeProxyReplacementDisabled {
log.Warnf("Deprecated value for --%s: %s (use either \"true\", or \"false\")", option.KubeProxyReplacement, option.Config.KubeProxyReplacement)
}

// This will be removed in v1.15
if option.Config.KubeProxyReplacement == option.KubeProxyReplacementDisabled {
log.Infof("Auto-disabling %q, %q, %q, %q features and falling back to %q",
option.EnableNodePort, option.EnableExternalIPs,
option.EnableSocketLB, option.EnableHostPort,
option.EnableHostLegacyRouting)

disableNodePort()
option.Config.EnableSocketLB = false
option.Config.EnableSocketLBTracing = false

return nil
}

if option.Config.KubeProxyReplacement == option.KubeProxyReplacementStrict ||
option.Config.KubeProxyReplacement == option.KubeProxyReplacementTrue {

if option.Config.KubeProxyReplacement == option.KubeProxyReplacementTrue {
log.Infof("Auto-enabling %q, %q, %q, %q, %q features",
option.EnableNodePort, option.EnableExternalIPs,
option.EnableSocketLB, option.EnableHostPort,
Expand All @@ -85,7 +60,7 @@ func initKubeProxyReplacementOptions(sysctl sysctl.Sysctl, tunnelConfig tunnel.C
option.Config.EnableSessionAffinity = true
}

if option.Config.KubeProxyReplacement != option.KubeProxyReplacementDisabled &&
if option.Config.KubeProxyReplacement != option.KubeProxyReplacementFalse &&
option.Config.EnableEnvoyConfig && !option.Config.EnableIPSec &&
!option.Config.EnableNodePort {
// CiliumEnvoyConfig L7 LB only works with bpf node port enabled
Expand Down Expand Up @@ -425,8 +400,8 @@ func finishKubeProxyReplacementInit(sysctl sysctl.Sysctl) error {
// Non-BPF masquerade requires netfilter and hence CT.
case option.Config.IptablesMasqueradingEnabled():
msg = fmt.Sprintf("BPF host routing requires %s.", option.EnableBPFMasquerade)
// KPR=strict is needed or we might rely on netfilter.
case option.Config.KubeProxyReplacement != option.KubeProxyReplacementStrict && option.Config.KubeProxyReplacement != option.KubeProxyReplacementTrue:
// KPR=true is needed or we might rely on netfilter.
case option.Config.KubeProxyReplacement != option.KubeProxyReplacementTrue:
msg = fmt.Sprintf("BPF host routing requires %s=%s.", option.KubeProxyReplacement, option.KubeProxyReplacementTrue)
default:
if probes.HaveProgramHelper(ebpf.SchedCLS, asm.FnRedirectNeigh) != nil ||
Expand Down
39 changes: 20 additions & 19 deletions daemon/cmd/kube_proxy_replacement_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,25 +114,6 @@ func (s *KPRSuite) TestInitKubeProxyReplacementOptions(c *C) {
},
},

// KPR disabled: all options disabled except host legacy routing.
{
"kpr-disabled",
func(cfg *kprConfig) {
cfg.kubeProxyReplacement = option.KubeProxyReplacementDisabled
},
kprConfig{
enableSocketLB: false,
enableNodePort: false,
enableHostPort: false,
enableExternalIPs: false,
enableSessionAffinity: false,
enableIPSec: false,
enableHostLegacyRouting: true,
enableSocketLBTracing: false,
expectedErrorRegex: "",
},
},

// KPR true: all options enabled, host routing disabled.
{
"kpr-true",
Expand Down Expand Up @@ -215,6 +196,26 @@ func (s *KPRSuite) TestInitKubeProxyReplacementOptions(c *C) {
enableSocketLBTracing: true,
},
},

// KPR false: all options disabled exception socket LB tracing
{
"kpr-disabled",
func(cfg *kprConfig) {
cfg.kubeProxyReplacement = option.KubeProxyReplacementFalse
},
kprConfig{
enableSocketLB: false,
enableNodePort: false,
enableHostPort: false,
enableExternalIPs: false,
enableSessionAffinity: false,
enableIPSec: false,
enableHostLegacyRouting: false,
enableSocketLBTracing: true,
expectedErrorRegex: "",
},
},

// KPR false + no conntrack ipt rules: error, needs KPR
{
"kpr-false+no-conntrack-ipt-rules",
Expand Down
6 changes: 0 additions & 6 deletions daemon/cmd/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -231,12 +231,6 @@ func (d *Daemon) getKubeProxyReplacementStatus() *models.KubeProxyReplacement {
mode = models.KubeProxyReplacementModeTrue
case option.KubeProxyReplacementFalse:
mode = models.KubeProxyReplacementModeFalse
case option.KubeProxyReplacementStrict:
mode = models.KubeProxyReplacementModeStrict
case option.KubeProxyReplacementPartial:
mode = models.KubeProxyReplacementModePartial
case option.KubeProxyReplacementDisabled:
mode = models.KubeProxyReplacementModeDisabled
}

devices, _ := datapathTables.SelectedDevices(d.devices, d.db.ReadTxn())
Expand Down
4 changes: 2 additions & 2 deletions install/kubernetes/cilium/templates/cilium-configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@
{{- $stringValueKPR = "" -}}
{{- end}}
{{- $kubeProxyReplacement := (coalesce $stringValueKPR $defaultKubeProxyReplacement) -}}
{{- if and (ne $kubeProxyReplacement "disabled") (ne $kubeProxyReplacement "partial") (ne $kubeProxyReplacement "strict") (ne $kubeProxyReplacement "true") (ne $kubeProxyReplacement "false") }}
{{ fail "kubeProxyReplacement must be explicitly set to a valid value (true, false, disabled (deprecated), partial (deprecated), or strict (deprecated)) to continue." }}
{{- if and (ne $kubeProxyReplacement "true") (ne $kubeProxyReplacement "false") }}
{{ fail "kubeProxyReplacement must be explicitly set to a valid value (true or false) to continue." }}
{{- end }}
{{- $azureUsePrimaryAddress = (coalesce .Values.azure.usePrimaryAddress $azureUsePrimaryAddress) -}}
{{- $socketLB := (coalesce .Values.socketLB .Values.hostServices) -}}
Expand Down
2 changes: 1 addition & 1 deletion install/kubernetes/cilium/values.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion install/kubernetes/cilium/values.yaml.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -1764,7 +1764,7 @@ readinessProbe:
# -- interval between checks of the readiness probe
periodSeconds: 30
# -- Configure the kube-proxy replacement in Cilium BPF datapath
# Valid options are "true", "false", "disabled" (deprecated), "partial" (deprecated), "strict" (deprecated).
# Valid options are "true" or "false".
# ref: https://docs.cilium.io/en/stable/network/kubernetes/kubeproxy-free/
#kubeProxyReplacement: "false"

Expand Down
1 change: 0 additions & 1 deletion operator/pkg/gateway-api/cell.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ func initGatewayAPIController(params gatewayAPIParams) error {
}

if params.GatewayApiConfig.KubeProxyReplacement != option.KubeProxyReplacementTrue &&
params.GatewayApiConfig.KubeProxyReplacement != option.KubeProxyReplacementStrict &&
!params.GatewayApiConfig.EnableNodePort {
params.Logger.Warn("Gateway API support requires either kube-proxy-replacement or enable-node-port enabled")
return nil
Expand Down
1 change: 0 additions & 1 deletion operator/pkg/ingress/cell.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ func registerReconciler(params ingressParams) error {
}

if params.IngressConfig.KubeProxyReplacement != option.KubeProxyReplacementTrue &&
params.IngressConfig.KubeProxyReplacement != option.KubeProxyReplacementStrict &&
!params.IngressConfig.EnableNodePort {
params.Logger.Warn("Ingress Controller support requires either kube-proxy-replacement or enable-node-port enabled")
return nil
Expand Down
2 changes: 1 addition & 1 deletion pkg/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ func FormatStatusResponse(w io.Writer, sr *models.StatusResponse, sd StatusDetai
}
if sr.KubeProxyReplacement != nil {
devices := ""
if sr.KubeProxyReplacement.Mode != models.KubeProxyReplacementModeDisabled {
if sr.KubeProxyReplacement.Mode != models.KubeProxyReplacementModeFalse {
for i, dev := range sr.KubeProxyReplacement.DeviceList {
kubeProxyDevices += fmt.Sprintf("%s %s", dev.Name, strings.Join(dev.IP, " "))
if dev.Name == sr.KubeProxyReplacement.DirectRoutingDevice {
Expand Down
1 change: 0 additions & 1 deletion pkg/datapath/tunnel/cell.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ var Cell = cell.Module(
func(dcfg *option.DaemonConfig) EnablerOut {
return NewEnabler(
(dcfg.EnableNodePort ||
dcfg.KubeProxyReplacement == option.KubeProxyReplacementStrict ||
dcfg.KubeProxyReplacement == option.KubeProxyReplacementTrue) &&
dcfg.LoadBalancerUsesDSR() &&
dcfg.LoadBalancerDSRDispatch == option.DSRDispatchGeneve,
Expand Down
20 changes: 5 additions & 15 deletions pkg/option/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -1269,22 +1269,12 @@ const (
// NodePortAccelerationBestEffort means we accelerate NodePort via native XDP in the driver (preferred), but will skip devices without driver support
NodePortAccelerationBestEffort = XDPModeBestEffort

// KubeProxyReplacementPartial specifies to enable only selected kube-proxy
// replacement features (might panic)
KubeProxyReplacementPartial = "partial"

// KubeProxyReplacementStrict specifies to enable all kube-proxy replacement
// features (might panic)
KubeProxyReplacementStrict = "strict"

// KubeProxyReplacementDisabled specified to completely disable kube-proxy
// replacement
KubeProxyReplacementDisabled = "disabled"

// KubeProxyReplacementTrue has the same meaning as previous "strict".
// KubeProxyReplacementTrue specifies to enable all kube-proxy replacement
// features (might panic).
KubeProxyReplacementTrue = "true"

// KubeProxyReplacementTrue has the same meaning as previous "partial".
// KubeProxyReplacementFalse specifies to enable only selected kube-proxy
// replacement features (might panic).
KubeProxyReplacementFalse = "false"

// KubeProxyReplacement healthz server bind address
Expand Down Expand Up @@ -4101,7 +4091,7 @@ func getDefaultMonitorQueueSize(numCPU int) int {
func MightAutoDetectDevices() bool {
devices := Config.GetDevices()
return ((Config.EnableHostFirewall || Config.EnableWireguard || Config.EnableHighScaleIPcache) && len(devices) == 0) ||
(Config.KubeProxyReplacement != KubeProxyReplacementDisabled &&
(Config.KubeProxyReplacement != KubeProxyReplacementFalse &&
(len(devices) == 0 || Config.DirectRoutingDevice == ""))
}

Expand Down

0 comments on commit a5bbf67

Please sign in to comment.