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

Commit

Permalink
Update node for kind cluster on CI
Browse files Browse the repository at this point in the history
This commit increase the node count for kind cluster used in the CI and
enabled the crd conversion by default.

Signed-off-by: Sneha Chhabria <snchh@microsoft.com>
  • Loading branch information
snehachhabria committed Jul 21, 2021
1 parent de011eb commit 595ebbb
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 7 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/nightly-noinstall.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ jobs:
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
- role: worker
kubeadmConfigPatches:
- |
kind: InitConfiguration
Expand All @@ -32,6 +33,7 @@ jobs:
- containerPort: 80
hostPort: 80
protocol: TCP
- role: worker
EOF
cat kind-config.yaml
Expand Down
2 changes: 1 addition & 1 deletion charts/osm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ The following table lists the configurable parameters of the osm chart and their
| OpenServiceMesh.enforceSingleMesh | bool | `false` | Enforce only deploying one mesh in the cluster |
| OpenServiceMesh.envoyLogLevel | string | `"error"` | Log level for the Envoy proxy sidecar |
| OpenServiceMesh.featureFlags.enableAsyncProxyServiceMapping | bool | `false` | Enable async proxy-service mapping |
| OpenServiceMesh.featureFlags.enableCRDConverter | bool | `false` | Enable CRD conversion webhook. When enabled, a conversion webhook will be deployed to perform API version conversions for custom resources. |
| OpenServiceMesh.featureFlags.enableCRDConverter | bool | `true` | Enable CRD conversion webhook. When enabled, a conversion webhook will be deployed to perform API version conversions for custom resources. |
| OpenServiceMesh.featureFlags.enableEgressPolicy | bool | `true` | Enable OSM's Egress policy API. When enabled, fine grained control over Egress (external) traffic is enforced |
| OpenServiceMesh.featureFlags.enableIngressBackendPolicy | bool | `false` | Enables OSM's IngressBackend policy API. When enabled, OSM will use the IngressBackend API allow ingress traffic to mesh backends |
| OpenServiceMesh.featureFlags.enableMulticlusterMode | bool | `false` | Enable Multicluster mode. When enabled, multicluster mode will be enabled in OSM |
Expand Down
2 changes: 1 addition & 1 deletion charts/osm/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ OpenServiceMesh:
enableValidatingWebhook: false
# -- Enable CRD conversion webhook.
# When enabled, a conversion webhook will be deployed to perform API version conversions for custom resources.
enableCRDConverter: false
enableCRDConverter: true
# -- Enables OSM's IngressBackend policy API.
# When enabled, OSM will use the IngressBackend API allow ingress traffic to mesh backends
enableIngressBackendPolicy: false
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
20 changes: 18 additions & 2 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,6 +223,9 @@ func (td *OsmTestData) InitTestData(t GinkgoTInterface) error {
Nodes: []v1alpha4.Node{
{
Role: v1alpha4.ControlPlaneRole,
},
{
Role: v1alpha4.WorkerRole,
KubeadmConfigPatches: []string{`kind: InitConfiguration
nodeRegistration:
kubeletExtraArgs:
Expand All @@ -234,10 +238,15 @@ nodeRegistration:
},
},
},
{
Role: v1alpha4.WorkerRole,
},
},
}
if Td.ClusterVersion != "" {
clusterConfig.Nodes[0].Image = fmt.Sprintf("kindest/node:%s", td.ClusterVersion)
clusterConfig.Nodes[1].Image = fmt.Sprintf("kindest/node:%s", td.ClusterVersion)
clusterConfig.Nodes[2].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,21 @@ func (td *OsmTestData) LoadImagesToKind(imageNames []string) error {
if err != nil {
return errors.Wrap(err, "failed to get image data")
}

imageReader, _ := ioutil.ReadAll(imageData)
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 Expand Up @@ -492,7 +508,7 @@ func (td *OsmTestData) InstallOSM(instOpts InstallOSMOpts) error {
return errors.Wrap(err, "failed to run osm install")
}

// Ensure osm-injector and osm-controller are ready
// Ensure osm-injector, osm-controller and osm-crd-converter are ready
err = td.waitForOSMControlPlane(30 * time.Second)
if err != nil {
return err
Expand Down
15 changes: 12 additions & 3 deletions tests/framework/common_apps.go
Original file line number Diff line number Diff line change
Expand Up @@ -463,9 +463,9 @@ func (td *OsmTestData) GetPrometheusPodHandle(ns string, prometheusPodName strin
}

func (td *OsmTestData) waitForOSMControlPlane(timeout time.Duration) error {
var errController, errInjector error
var errController, errInjector, errCrdConverter error
waitGroup := sync.WaitGroup{}
waitGroup.Add(2)
waitGroup.Add(3)

go func() {
errController = td.WaitForPodsRunningReady(td.OsmNamespace, timeout, 1, &metav1.LabelSelector{
Expand All @@ -485,9 +485,18 @@ func (td *OsmTestData) waitForOSMControlPlane(timeout time.Duration) error {
waitGroup.Done()
}()

go func() {
errCrdConverter = td.WaitForPodsRunningReady(td.OsmNamespace, timeout, 1, &metav1.LabelSelector{
MatchLabels: map[string]string{
"app": "osm-crd-converter",
},
})
waitGroup.Done()
}()

waitGroup.Wait()

if errController != nil || errInjector != nil {
if errController != nil || errInjector != nil || errCrdConverter != nil {
return errors.New(fmt.Sprintf("OSM Control plane was not ready in time (%v, %v)", errController, errInjector))
}

Expand Down

0 comments on commit 595ebbb

Please sign in to comment.