Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
fmoral2 committed Jul 10, 2023
2 parents 0d9189c + 356adec commit 1eb8ad3
Show file tree
Hide file tree
Showing 14 changed files with 85 additions and 43 deletions.
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -107,12 +107,12 @@ COPY charts/ /charts/
RUN echo ${CACHEBUST}>/dev/null
RUN CHART_VERSION="1.13.200" CHART_FILE=/charts/rke2-cilium.yaml CHART_BOOTSTRAP=true /charts/build-chart.sh
RUN CHART_VERSION="v3.25.1-build2023051202" CHART_FILE=/charts/rke2-canal.yaml CHART_BOOTSTRAP=true /charts/build-chart.sh
RUN CHART_VERSION="v3.25.002" CHART_FILE=/charts/rke2-calico.yaml CHART_BOOTSTRAP=true /charts/build-chart.sh
RUN CHART_VERSION="v3.25.002" CHART_FILE=/charts/rke2-calico-crd.yaml CHART_BOOTSTRAP=true /charts/build-chart.sh
RUN CHART_VERSION="v3.26.100" CHART_FILE=/charts/rke2-calico.yaml CHART_BOOTSTRAP=true /charts/build-chart.sh
RUN CHART_VERSION="v3.26.100" CHART_FILE=/charts/rke2-calico-crd.yaml CHART_BOOTSTRAP=true /charts/build-chart.sh
RUN CHART_VERSION="1.24.004" CHART_FILE=/charts/rke2-coredns.yaml CHART_BOOTSTRAP=true /charts/build-chart.sh
RUN CHART_VERSION="4.6.100" CHART_FILE=/charts/rke2-ingress-nginx.yaml CHART_BOOTSTRAP=false /charts/build-chart.sh
RUN CHART_VERSION="2.11.100-build2023051509" CHART_FILE=/charts/rke2-metrics-server.yaml CHART_BOOTSTRAP=false /charts/build-chart.sh
RUN CHART_VERSION="v3.9.3-build2023010903" CHART_FILE=/charts/rke2-multus.yaml CHART_BOOTSTRAP=true /charts/build-chart.sh
RUN CHART_VERSION="v4.0.2-build2023070701" CHART_FILE=/charts/rke2-multus.yaml CHART_BOOTSTRAP=true /charts/build-chart.sh
RUN CHART_VERSION="1.5.100" CHART_FILE=/charts/rancher-vsphere-cpi.yaml CHART_BOOTSTRAP=true /charts/build-chart.sh
RUN CHART_VERSION="3.0.1-rancher101" CHART_FILE=/charts/rancher-vsphere-csi.yaml CHART_BOOTSTRAP=true /charts/build-chart.sh
RUN CHART_VERSION="0.2.200" CHART_FILE=/charts/harvester-cloud-provider.yaml CHART_BOOTSTRAP=true /charts/build-chart.sh
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile.windows
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ FROM build as windows-runtime-collect
ARG KUBERNETES_VERSION=dev

# windows runtime image
ENV CRICTL_VERSION="v1.25.0"
ENV CALICO_VERSION="v3.25.0"
ENV CRICTL_VERSION="v1.27.0"
ENV CALICO_VERSION="v3.26.1"
ENV CNI_PLUGIN_VERSION="v1.1.1"

RUN mkdir -p rancher
Expand Down
26 changes: 19 additions & 7 deletions pkg/windows/calico.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ const (
CalicoSystemNamespace = "calico-system"
CalicoChart = "rke2-calico"
calicoNode = "calico-node"
calicoLogPath = "C:\\var\\log\\"
)

// Setup creates the basic configuration required by the CNI.
Expand Down Expand Up @@ -373,6 +374,12 @@ func (c *Calico) overrideCalicoConfigByHelm(restConfig *rest.Config) error {
}

func startFelix(ctx context.Context, config *CalicoConfig) {
outputFile, err := os.Create(calicoLogPath + "felix.log")
if err != nil {
logrus.Fatalf("error creating felix.log: %v", err)
return
}
defer outputFile.Close()
specificEnvs := []string{
fmt.Sprintf("FELIX_FELIXHOSTNAME=%s", config.Hostname),
fmt.Sprintf("FELIX_VXLANVNI=%s", config.Felix.Vxlanvni),
Expand All @@ -386,14 +393,19 @@ func startFelix(ctx context.Context, config *CalicoConfig) {
logrus.Infof("Felix Envs: %s", append(generateGeneralCalicoEnvs(config), specificEnvs...))
cmd := exec.CommandContext(ctx, "calico-node.exe", args...)
cmd.Env = append(generateGeneralCalicoEnvs(config), specificEnvs...)
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
if err := cmd.Run(); err != nil {
logrus.Errorf("Felix exited: %v", err)
}
cmd.Stdout = outputFile
cmd.Stderr = outputFile
_ = cmd.Run()
logrus.Error("Felix exited")
}

func startCalico(ctx context.Context, config *CalicoConfig) error {
outputFile, err := os.Create(calicoLogPath + "calico-node.log")
if err != nil {
logrus.Errorf("error creating calico-node.log: %v", err)
return err
}
defer outputFile.Close()
specificEnvs := []string{
fmt.Sprintf("CALICO_NODENAME_FILE=%s", config.NodeNameFile),
}
Expand All @@ -404,8 +416,8 @@ func startCalico(ctx context.Context, config *CalicoConfig) error {
logrus.Infof("Calico Envs: %s", append(generateGeneralCalicoEnvs(config), specificEnvs...))
cmd := exec.CommandContext(ctx, "calico-node.exe", args...)
cmd.Env = append(generateGeneralCalicoEnvs(config), specificEnvs...)
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
cmd.Stdout = outputFile
cmd.Stderr = outputFile
if err := cmd.Run(); err != nil {
logrus.Errorf("Calico exited: %v", err)
return err
Expand Down
18 changes: 9 additions & 9 deletions scripts/build-images
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,14 @@ xargs -n1 -t docker image pull --quiet << EOF > build/images-cilium.txt
EOF

xargs -n1 -t docker image pull --quiet << EOF > build/images-calico.txt
${REGISTRY}/rancher/mirrored-calico-operator:v1.29.0
${REGISTRY}/rancher/mirrored-calico-ctl:v3.25.0
${REGISTRY}/rancher/mirrored-calico-kube-controllers:v3.25.0
${REGISTRY}/rancher/mirrored-calico-typha:v3.25.0
${REGISTRY}/rancher/mirrored-calico-node:v3.25.0
${REGISTRY}/rancher/mirrored-calico-pod2daemon-flexvol:v3.25.0
${REGISTRY}/rancher/mirrored-calico-cni:v3.25.0
${REGISTRY}/rancher/mirrored-calico-apiserver:v3.25.0
${REGISTRY}/rancher/mirrored-calico-operator:v1.30.4
${REGISTRY}/rancher/mirrored-calico-ctl:v3.26.1
${REGISTRY}/rancher/mirrored-calico-kube-controllers:v3.26.1
${REGISTRY}/rancher/mirrored-calico-typha:v3.26.1
${REGISTRY}/rancher/mirrored-calico-node:v3.26.1
${REGISTRY}/rancher/mirrored-calico-pod2daemon-flexvol:v3.26.1
${REGISTRY}/rancher/mirrored-calico-cni:v3.26.1
${REGISTRY}/rancher/mirrored-calico-apiserver:v3.26.1
EOF

xargs -n1 -t docker image pull --quiet << EOF > build/images-vsphere.txt
Expand All @@ -71,7 +71,7 @@ xargs -n1 -t docker image pull --quiet << EOF > build/images-vsphere.txt
EOF

xargs -n1 -t docker image pull --quiet << EOF > build/images-multus.txt
${REGISTRY}/rancher/hardened-multus-cni:v3.9.3-build20230109
${REGISTRY}/rancher/hardened-multus-cni:v4.0.2-build20230707
${REGISTRY}/rancher/hardened-cni-plugins:v1.2.0-build20230523
${REGISTRY}/rancher/hardened-sriov-network-operator:v1.2.0-build20230607
${REGISTRY}/rancher/hardened-sriov-network-config-daemon:v1.2.0-build20230607
Expand Down
2 changes: 1 addition & 1 deletion tests/acceptance/core/service/assert/pod.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ func PodAssertStatus() PodAssertFunc {
Equal(completedAssert),
), pod.Name)
} else {
g.Expect(pod.Status).Should(Equal(shared.RunningAssert), pod.Name)
g.Expect(pod.Status).Should(Equal("Running"), pod.Name)
}
}
}
Expand Down
4 changes: 1 addition & 3 deletions tests/acceptance/core/service/template/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ import (

"github.com/rancher/rke2/tests/acceptance/core/testcase"
"github.com/rancher/rke2/tests/acceptance/shared"

. "github.com/onsi/ginkgo/v2"
)

// upgradeVersion upgrades the version of RKE2 and updates the expected values
Expand All @@ -30,7 +28,7 @@ func upgradeVersion(template VersionTestTemplate, version string) error {
func checkVersion(v VersionTestTemplate) error {
ips, err := getIPs()
if err != nil {
GinkgoT().Errorf("Failed to get IPs: %s", err)
return fmt.Errorf("failed to get IPs: %v", err)
}

var wg sync.WaitGroup
Expand Down
3 changes: 2 additions & 1 deletion tests/acceptance/core/service/template/versiontemplate.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ import (
"fmt"
"strings"

. "github.com/onsi/ginkgo/v2"
"github.com/rancher/rke2/tests/acceptance/core/service/customflag"
"github.com/rancher/rke2/tests/acceptance/shared"

. "github.com/onsi/ginkgo/v2"
)

// VersionTemplate is a template for testing RKE2 versions + test cases and upgrading cluster if needed
Expand Down
4 changes: 2 additions & 2 deletions tests/acceptance/core/testcase/daemonset.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ func TestDaemonset(deployWorkload bool) {
Expect(err).NotTo(HaveOccurred(),
"Daemonset manifest not deployed")

nodes, _ := shared.Nodes(false)
pods, _ := shared.Pods(false)
nodes, _ := shared.ParseNodes(false)
pods, _ := shared.ParsePods(false)

Eventually(func(g Gomega) {
count := shared.CountOfStringInSlice("test-daemonset", pods)
Expand Down
2 changes: 1 addition & 1 deletion tests/acceptance/core/testcase/ingressdns.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ func TestIngress(deployWorkload bool) {
GinkgoT().Errorf("Error: %v", err)
}

nodes, err := shared.Nodes(false)
nodes, err := shared.ParseNodes(false)
Expect(err).NotTo(HaveOccurred())

Eventually(func(Gomega) bool {
Expand Down
2 changes: 1 addition & 1 deletion tests/acceptance/core/testcase/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ func TestNodeStatus(

expectedNodeCount := cluster.NumServers + cluster.NumAgents
Eventually(func(g Gomega) {
nodes, err := shared.Nodes(false)
nodes, err := shared.ParseNodes(false)
g.Expect(err).NotTo(HaveOccurred())
g.Expect(len(nodes)).To(Equal(expectedNodeCount),
"Number of nodes should match the spec")
Expand Down
37 changes: 36 additions & 1 deletion tests/acceptance/core/testcase/pod.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func TestPodStatus(
fmt.Printf("\nFetching pod status\n")

Eventually(func(g Gomega) {
pods, err := shared.Pods(false)
pods, err := shared.ParsePods(false)
g.Expect(err).NotTo(HaveOccurred())

for _, pod := range pods {
Expand All @@ -46,3 +46,38 @@ func TestPodStatus(
}
}, "600s", "3s").Should(Succeed())
}

func testCrossNodeServiceRequest(services, ports, expected []string) error {
var err error
if len(services) != len(ports) && len(ports) != len(expected) {
return fmt.Errorf("array parameters must have equal length")
}

if len(services) < 2 || len(ports) < 2 || len(expected) < 2 {
return fmt.Errorf("array parameters must not be less than or equal to 2")
}

// Iterating services first to last
for i := 0; i < len(services); i++ {
for j := i + 1; j < len(services); j++ {
cmd := fmt.Sprintf("kubectl exec svc/%s --kubeconfig=%s -- curl -m7 %s:%s",
services[i], shared.KubeConfigFile, services[j], ports[j])
Eventually(func() (string, error) {
return shared.RunCommandHost(cmd)
}, "120s", "5s").Should(ContainSubstring(expected[j]))
}
}

// Iterating services last to first
for i := len(services) - 1; i > 0; i-- {
for j := 1; j <= i; j++ {
cmd := fmt.Sprintf("kubectl exec svc/%s --kubeconfig=%s -- curl -m7 %s:%s",
services[i], shared.KubeConfigFile, services[i-j], ports[i-j])
Eventually(func() (string, error) {
return shared.RunCommandHost(cmd)
}, "120s", "5s").Should(ContainSubstring(expected[i-j]))
}
}

return err
}
8 changes: 4 additions & 4 deletions tests/acceptance/modules/master/instances_server.tf
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@ resource "aws_instance" "master" {
]
}
provisioner "file" {
source = "install/install_rke2_master.sh"
destination = "/tmp/install_rke2_master.sh"
source = "install/rke2_master.sh"
destination = "/tmp/rke2_master.sh"
}
provisioner "remote-exec" {
inline = [
"chmod +x /tmp/install_rke2_master.sh",
"sudo /tmp/install_rke2_master.sh ${var.node_os} ${var.create_lb ? aws_route53_record.aws_route53[0].fqdn : "fake.fqdn.value"} ${var.rke2_version} ${self.public_ip} ${var.rke2_channel} \"${var.server_flags}\" ${var.install_mode} ${var.username} ${var.password} \"${var.install_method}\"",
"chmod +x /tmp/rke2_master.sh",
"sudo /tmp/rke2_master.sh ${var.node_os} ${var.create_lb ? aws_route53_record.aws_route53[0].fqdn : "fake.fqdn.value"} ${var.rke2_version} ${self.public_ip} ${var.rke2_channel} \"${var.server_flags}\" ${var.install_mode} ${var.username} ${var.password} \"${var.install_method}\"",
]
}
provisioner "local-exec" {
Expand Down
12 changes: 4 additions & 8 deletions tests/acceptance/shared/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,6 @@ type Pod struct {
Node string
}

const (
RunningAssert = "Running"
)

// ManageWorkload creates or deletes a workload based on the action: create or delete.
func ManageWorkload(action, workload string) (string, error) {
if action != "create" && action != "delete" {
Expand Down Expand Up @@ -216,8 +212,8 @@ func FetchIngressIP(namespace string) ([]string, error) {
return ingressIPs, nil
}

// Nodes returns nodes parsed from kubectl get nodes.
func Nodes(print bool) ([]Node, error) {
// ParseNodes returns nodes parsed from kubectl get nodes.
func ParseNodes(print bool) ([]Node, error) {
nodes := make([]Node, 0, 10)

cmd := "kubectl get nodes --no-headers -o wide --kubeconfig=" + KubeConfigFile
Expand Down Expand Up @@ -249,8 +245,8 @@ func Nodes(print bool) ([]Node, error) {
return nodes, nil
}

// Pods returns pods parsed from kubectl get pods.
func Pods(print bool) ([]Pod, error) {
// ParsePods returns pods parsed from kubectl get pods.
func ParsePods(print bool) ([]Pod, error) {
pods := make([]Pod, 0, 10)

cmd := "kubectl get pods -o wide --no-headers -A --kubeconfig=" + KubeConfigFile
Expand Down

0 comments on commit 1eb8ad3

Please sign in to comment.