Skip to content

Commit

Permalink
test: increase helm-sync memory for TestPublicHelm (#1288) (#1324)
Browse files Browse the repository at this point in the history
This test occasionally causes an OOMKill for the helm-sync container on
Autopilot.

Co-authored-by: Sam Dowell <[email protected]>
  • Loading branch information
karlkfi and sdowell authored Jul 10, 2024
1 parent 496efdd commit b46efd5
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 56 deletions.
65 changes: 62 additions & 3 deletions e2e/testcases/helm_sync_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import (

appsv1 "k8s.io/api/apps/v1"
corev1 "k8s.io/api/core/v1"
apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
apierrors "k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/api/resource"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand All @@ -44,7 +45,9 @@ import (
"kpt.dev/configsync/pkg/api/configsync/v1beta1"
"kpt.dev/configsync/pkg/core"
"kpt.dev/configsync/pkg/importer/analyzer/validation/nonhierarchical"
"kpt.dev/configsync/pkg/importer/filesystem"
"kpt.dev/configsync/pkg/kinds"
"kpt.dev/configsync/pkg/reconcilermanager"
"kpt.dev/configsync/pkg/testing/fake"
)

Expand All @@ -62,10 +65,66 @@ func TestPublicHelm(t *testing.T) {
nt := nomostest.New(t, nomostesting.SyncSource, ntopts.Unstructured)

rs := fake.RootSyncObjectV1Beta1(configsync.RootSyncName)
rs.Spec = v1beta1.RootSyncSpec{
SourceFormat: string(filesystem.SourceFormatUnstructured),
SourceType: string(v1beta1.HelmSource),
Helm: &v1beta1.HelmRootSync{
Namespace: "wordpress",
HelmBase: v1beta1.HelmBase{
Repo: "https://charts.bitnami.com/bitnami",
Chart: "wordpress",
Version: "15.2.35",
ReleaseName: "my-wordpress",
Auth: configsync.AuthNone,
Values: &apiextensionsv1.JSON{
Raw: []byte(`{
"image": {
"digest": "sha256:362cb642db481ebf6f14eb0244fbfb17d531a84ecfe099cd3bba6810db56694e",
"pullPolicy": "Always"
},
"wordpressUsername": "test-user",
"wordpressEmail": "[email protected]",
"extraEnvVars": [
{"name": "TEST_1", "value": "val1"},
{"name": "TEST_2", "value": "val2"}
],
"resources": {
"requests": {
"cpu": "150m",
"memory": "250Mi"
},
"limits": {
"cpu": "1",
"memory": "300Mi"
}
},
"mariadb": {
"primary": {
"persistence": {
"enabled": false
}
}
},
"service": {
"type": "ClusterIP"
}
}`),
},
},
},
}
if nt.IsGKEAutopilot {
nt.T.Log("Increasing memory request/limit for helm-sync on Autopilot")
rs.Spec.SafeOverride().Resources = []v1beta1.ContainerResourcesSpec{
{ // This chart sometimes causes OOMKill on Autopilot with default limit
ContainerName: reconcilermanager.HelmSync,
MemoryRequest: resource.MustParse("512Mi"),
MemoryLimit: resource.MustParse("512Mi"),
},
}
}
nt.T.Log("Update RootSync to sync from a public Helm Chart with specified release namespace and multiple inline values")
rootSyncFilePath := "../testdata/root-sync-helm-chart-cr.yaml"
nt.T.Logf("Apply the RootSync object defined in %s", rootSyncFilePath)
nt.MustKubectl("apply", "-f", rootSyncFilePath)
nt.Must(nt.KubeClient.Apply(rs))
err := nt.WatchForAllSyncs(nomostest.WithRootSha1Func(nomostest.HelmChartVersionShaFn("15.2.35")),
nomostest.WithSyncDirectoryMap(map[types.NamespacedName]string{nomostest.DefaultRootRepoNamespacedName: "wordpress"}))
if err != nil {
Expand Down
53 changes: 0 additions & 53 deletions e2e/testdata/root-sync-helm-chart-cr.yaml

This file was deleted.

0 comments on commit b46efd5

Please sign in to comment.