Skip to content
This repository has been archived by the owner on Jul 11, 2023. It is now read-only.

Commit

Permalink
Merge pull request #3813 from snehachhabria/increaseKindNodesCI
Browse files Browse the repository at this point in the history
Update node count for kind cluster on CI
  • Loading branch information
snehachhabria authored Jul 22, 2021
2 parents 6fed5f1 + 58c8d06 commit d1584f1
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 5 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/nightly-noinstall.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,18 @@ jobs:
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
- role: worker
kubeadmConfigPatches:
- |
kind: InitConfiguration
kind: JoinConfiguration
nodeRegistration:
kubeletExtraArgs:
node-labels: "ingress-ready=true"
extraPortMappings:
- containerPort: 80
hostPort: 80
protocol: TCP
protocol: TCP
- role: worker
EOF
cat kind-config.yaml
Expand Down
4 changes: 4 additions & 0 deletions scripts/kind-with-registry.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ echo "Registry Host: ${reg_host}"
cat <<EOF | kind create cluster --name "${KIND_CLUSTER_NAME}" --config=-
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
- role: worker
- role: worker
containerdConfigPatches:
- |-
[plugins."io.containerd.grpc.v1.cri".registry.mirrors."localhost:${reg_port}"]
Expand Down
3 changes: 3 additions & 0 deletions tests/e2e/e2e_http_ingress_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ var _ = OSMDescribe("HTTP ingress",
"hostPort": map[string]interface{}{
"enabled": true,
},
"nodeSelector": map[string]interface{}{
"ingress-ready": "true",
},
"service": map[string]interface{}{
"type": "NodePort",
},
Expand Down
26 changes: 23 additions & 3 deletions tests/framework/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"encoding/json"
"flag"
"fmt"
"io"
"io/ioutil"
"math"
"math/big"
Expand Down Expand Up @@ -222,7 +223,10 @@ func (td *OsmTestData) InitTestData(t GinkgoTInterface) error {
Nodes: []v1alpha4.Node{
{
Role: v1alpha4.ControlPlaneRole,
KubeadmConfigPatches: []string{`kind: InitConfiguration
},
{
Role: v1alpha4.WorkerRole,
KubeadmConfigPatches: []string{`kind: JoinConfiguration
nodeRegistration:
kubeletExtraArgs:
node-labels: "ingress-ready=true"`},
Expand All @@ -234,10 +238,15 @@ nodeRegistration:
},
},
},
{
Role: v1alpha4.WorkerRole,
},
},
}
if Td.ClusterVersion != "" {
clusterConfig.Nodes[0].Image = fmt.Sprintf("kindest/node:%s", td.ClusterVersion)
for i := 0; i < len(clusterConfig.Nodes); i++ {
clusterConfig.Nodes[i].Image = fmt.Sprintf("kindest/node:%s", td.ClusterVersion)
}
}
if err := td.ClusterProvider.Create(td.ClusterName, cluster.CreateWithV1Alpha4Config(clusterConfig)); err != nil {
return errors.Wrap(err, "failed to create kind cluster")
Expand Down Expand Up @@ -346,14 +355,25 @@ func (td *OsmTestData) LoadImagesToKind(imageNames []string) error {
if err != nil {
return errors.Wrap(err, "failed to get image data")
}

imageReader, err := ioutil.ReadAll(imageData)
if err != nil {
return errors.Wrap(err, "failed to read images")
}

reader := bytes.NewReader(imageReader)
defer imageData.Close() //nolint: errcheck,gosec
nodes, err := td.ClusterProvider.ListNodes(td.ClusterName)
if err != nil {
return errors.Wrap(err, "failed to list kind nodes")
}

for _, n := range nodes {
td.T.Log("Loading images onto node", n)
if err := nodeutils.LoadImageArchive(n, imageData); err != nil {
if _, err := reader.Seek(0, io.SeekStart); err != nil {
return errors.Wrap(err, "failed to reset images")
}
if err = nodeutils.LoadImageArchive(n, reader); err != nil {
return errors.Wrap(err, "failed to load images")
}
}
Expand Down

0 comments on commit d1584f1

Please sign in to comment.