Repository: kubernetes-sigs/security-profiles-operator
Pull request #515 (2021-07-02 07:14:19)

Update kustomize to v4.2.0
#### What type of PR is this?

/kind cleanup

#### What this PR does / why we need it:
Update kustomize to the latest release.
#### Which issue(s) this PR fixes:

None

#### Does this PR have test?

None

#### Special notes for your reviewer:
None
#### Does this PR introduce a user-facing change?

<!--
If no, just write "NONE" in the release-note block below.
If yes, a release note is required:
Enter your extended release note in the block below. If the PR requires additional action from users switching to the new release, include the string "action required".

For more information on release notes see: https://git.k8s.io/community/contributors/guide/release-notes.md
-->

```release-note
None
```


k8s-ci-robot: [APPROVALNOTIFIER] This PR is **APPROVED**

This pull-request has been approved by: *<a href="https://github.com/kubernetes-sigs/security-profiles-operator/pull/515#" title="Author self-approved">saschagrunert</a>*

The full list of commands accepted by this bot can be found [here](https://go.k8s.io/bot-commands?repo=kubernetes-sigs%2Fsecurity-profiles-operator).

The pull request process is described [here](https://git.k8s.io/community/contributors/guide/owners.md#the-code-review-process)

<details >
Needs approval from an approver in each of these files:

- ~~[OWNERS](https://github.com/kubernetes-sigs/security-profiles-operator/blob/master/OWNERS)~~ [saschagrunert]

Approvers can indicate their approval by writing `/approve` in a comment
Approvers can cancel approval by writing `/approve cancel` in a comment
</details>
<!-- META={"approvers":[]} -->

Patch:
diff --git a/Makefile b/Makefile
index 70a29488f..22aaf30c7 100644
--- a/Makefile
+++ b/Makefile
@@ -16,7 +16,7 @@ GO ?= go
 
 GOLANGCI_LINT_VERSION = v1.40.1
 REPO_INFRA_VERSION = v0.1.8
-KUSTOMIZE_VERSION = 4.1.2
+KUSTOMIZE_VERSION = 4.2.0
 
 CONTROLLER_GEN_CMD := $(GO) run -tags generate sigs.k8s.io/controller-tools/cmd/controller-gen
 
diff --git a/dependencies.yaml b/dependencies.yaml
index cd7137360..56aed5308 100644
--- a/dependencies.yaml
+++ b/dependencies.yaml
@@ -22,7 +22,7 @@ dependencies:
       match: REPO_INFRA_VERSION
 
   - name: kustomize
-    version: 4.1.2
+    version: 4.2.0
     refPaths:
     - path: Makefile
       match: KUSTOMIZE_VERSION


Test patch:
diff --git a/test/suite_test.go b/test/suite_test.go
index e3ca75114..dbd318a0c 100644
--- a/test/suite_test.go
+++ b/test/suite_test.go
@@ -466,7 +466,16 @@ func (e *e2e) getSpodMetrics() string {
 	for i := range b {
 		b[i] = letters[rand.Intn(len(letters))] // nolint: gosec
 	}
-	return e.kubectlRunOperatorNS("pod-"+string(b), "--", "bash", "-c", curlSpodCMD)
+	// Sometimes the metrics command does not output anything in CI. We fix
+	// that by retrying the metrics retrieval several times.
+	for i := 0; i < 5; i++ {
+		output := e.kubectlRunOperatorNS("pod-"+string(b), "--", "bash", "-c", curlSpodCMD)
+		if len(strings.Split(output, "\n")) > 1 {
+			return output
+		}
+	}
+	e.Fail("unable to retrieve SPOD metrics")
+	return ""
 }
 
 func (e *e2e) waitFor(args ...string) {
diff --git a/test/tc_metrics_test.go b/test/tc_metrics_test.go
index dfc039798..1c9d688a7 100644
--- a/test/tc_metrics_test.go
+++ b/test/tc_metrics_test.go
@@ -100,7 +100,7 @@ func (e *e2e) testCaseSelinuxMetrics(nodes []string) {
 	e.assertSelinuxPolicyIsRemoved(nodes, rawPolicyName, maxNodeIterations, sleepBetweenIterations)
 
 	e.logf("Retrieving spo metrics for validation")
-	outputSpod := e.kubectlRunOperatorNS("pod", "--", "bash", "-c", curlSpodCMD)
+	outputSpod := e.getSpodMetrics()
 	e.Contains(outputSpod, "promhttp_metric_handler_requests_total")
 
 	e.logf("Asserting metrics values")