<commit_before>// SPDX-License-Identifier: Apache-2.0
// Copyright 2017-2021 Authors of Cilium

package k8sTest

import (
	"context"
	"fmt"
	"net"
	"strings"
	"sync"
	"time"

	"github.com/asaskevich/govalidator"
	. "github.com/onsi/gomega"
	v1 "k8s.io/api/core/v1"

	. "github.com/cilium/cilium/test/ginkgo-ext"
	"github.com/cilium/cilium/test/helpers"
)

const (
	appServiceName           = "app1-service"
	appServiceNameIPv6       = "app1-service-ipv6"
	echoServiceName          = "echo"
	echoServiceNameDualStack = "echo-dualstack"
	echoPodLabel             = "name=echo"
	app2PodLabel             = "id=app2"
	// echoServiceNameIPv6 = "echo-ipv6"

	testDSClient = "zgroup=testDSClient"
	testDS       = "zgroup=testDS"
	testDSK8s2   = "zgroup=test-k8s2"

	testDSServiceIPv4 = "testds-service"
	testDSServiceIPv6 = "testds-service-ipv6"
)

// The 5.4 CI job is intended to catch BPF complexity regressions and as such
// doesn't need to execute this test suite.
var _ = SkipDescribeIf(helpers.RunsOn54Kernel, "K8sServicesTest", func() {
	var (
		kubectl        *helpers.Kubectl
		ciliumFilename string
		ni             *helpers.NodesInfo
		err            error
	)

	BeforeAll(func() {
		kubectl = helpers.CreateKubectl(helpers.K8s1VMName(), logger)

		if helpers.DualStackSupported() && helpers.DoesNotRunWithKubeProxyReplacement() {
			// This is a fix required for kube-proxy when running in dual-stack mode.
			// Sometimes there is a condition where kube-proxy repeatedly fails as it is not able
			// to find KUBE-MARK-DROP iptables chain for IPv6 which should be created by kubelet.
			// Error occurred at line: 79
			// Try `ip6tables-restore -h' or 'ip6tables-restore --help' for more information.
			// )
			// I1013 15:26:18.762727       1 proxier.go:850] Sync failed; retrying in 30s
			// E1013 15:26:18.780765       1 proxier.go:1570] Failed to execute iptables-restore: exit status 2 (ip6tables-restore v1.8.3 (legacy):
			// Couldn't load target `KUBE-MARK-DROP':No such file or directory
			//
			// This was fixed upstream for IPVS mode but still fails for iptables mode in our CI.
			// For more information see kubernetes/kubernetes issues #80462 #84422 #85527
			kubeproxyPods, err := kubectl.GetPodNames("kube-system", "k8s-app=kube-proxy")
			if err == nil {
				for _, pod := range kubeproxyPods {
					res := kubectl.ExecPodCmd("kube-system", pod, "ip6tables -t nat -N KUBE-MARK-DROP")
					if !res.WasSuccessful() && !strings.Contains(res.CombineOutput().String(), "Chain already exists") {
						GinkgoPrint("Error adding KUBE-MARK-DROP chain: %s, skipping KUBE-MARK-DROP ensure tests might fail.", res.CombineOutput().String())
					}
				}
			} else {
				GinkgoPrint("Error getting kube-proxy pods: %s, skipping KUBE-MARK-DROP ensure tests might fail.", err)
			}
		}
<commit_msg>test: Remove the kube-proxy dualstack fix<commit_after>// SPDX-License-Identifier: Apache-2.0
// Copyright 2017-2021 Authors of Cilium

package k8sTest

import (
	"context"
	"fmt"
	"net"
	"strings"
	"sync"
	"time"

	"github.com/asaskevich/govalidator"
	. "github.com/onsi/gomega"
	v1 "k8s.io/api/core/v1"

	. "github.com/cilium/cilium/test/ginkgo-ext"
	"github.com/cilium/cilium/test/helpers"
)

const (
	appServiceName           = "app1-service"
	appServiceNameIPv6       = "app1-service-ipv6"
	echoServiceName          = "echo"
	echoServiceNameDualStack = "echo-dualstack"
	echoPodLabel             = "name=echo"
	app2PodLabel             = "id=app2"
	// echoServiceNameIPv6 = "echo-ipv6"

	testDSClient = "zgroup=testDSClient"
	testDS       = "zgroup=testDS"
	testDSK8s2   = "zgroup=test-k8s2"

	testDSServiceIPv4 = "testds-service"
	testDSServiceIPv6 = "testds-service-ipv6"
)

// The 5.4 CI job is intended to catch BPF complexity regressions and as such
// doesn't need to execute this test suite.
var _ = SkipDescribeIf(helpers.RunsOn54Kernel, "K8sServicesTest", func() {
	var (
		kubectl        *helpers.Kubectl
		ciliumFilename string
		ni             *helpers.NodesInfo
		err            error
	)

	BeforeAll(func() {
		kubectl = helpers.CreateKubectl(helpers.K8s1VMName(), logger)

{'fraction_non_alphanumeric': 0.11698757007067999, 'fraction_numerical': 0.034608822812576163, 'mean_word_length': 3.209230769230769, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2720305', 'n_tokens_mistral': 1654, 'n_tokens_neox': 1520, 'n_words': 339}