Skip to content

Commit

Permalink
Upgrade cert-manager version used from v1.5.3 to v1.14.4
Browse files Browse the repository at this point in the history
  • Loading branch information
camilamacedo86 committed Mar 31, 2024
1 parent cdc9c48 commit a72d9b8
Show file tree
Hide file tree
Showing 12 changed files with 52 additions and 43 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const (
prometheusOperatorURL = "https://github.com/prometheus-operator/prometheus-operator/" +
"releases/download/%s/bundle.yaml"

certmanagerVersion = "v1.5.3"
certmanagerVersion = "v1.14.4"
certmanagerURLTmpl = "https://github.com/jetstack/cert-manager/releases/download/%s/cert-manager.yaml"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const (
prometheusOperatorURL = "https://github.com/prometheus-operator/prometheus-operator/" +
"releases/download/%s/bundle.yaml"

certmanagerVersion = "v1.5.3"
certmanagerVersion = "v1.14.4"
certmanagerURLTmpl = "https://github.com/jetstack/cert-manager/releases/download/%s/cert-manager.yaml"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const (
prometheusOperatorURL = "https://github.com/prometheus-operator/prometheus-operator/" +
"releases/download/%s/bundle.yaml"

certmanagerVersion = "v1.5.3"
certmanagerVersion = "v1.14.4"
certmanagerURLTmpl = "https://github.com/jetstack/cert-manager/releases/download/%s/cert-manager.yaml"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ const (
prometheusOperatorURL = "https://github.com/prometheus-operator/prometheus-operator/" +
"releases/download/%s/bundle.yaml"
certmanagerVersion = "v1.5.3"
certmanagerVersion = "v1.14.4"
certmanagerURLTmpl = "https://github.com/jetstack/cert-manager/releases/download/%s/cert-manager.yaml"
)
Expand Down
4 changes: 1 addition & 3 deletions test/e2e/utils/test_context.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import (
)

const (
certmanagerVersion = "v1.5.3"
certmanagerVersion = "v1.14.4"
certmanagerURLTmpl = "https://github.com/cert-manager/cert-manager/releases/download/%s/cert-manager.yaml"
prometheusOperatorVersion = "0.51"
prometheusOperatorURL = "https://raw.githubusercontent.com/prometheus-operator/" +
Expand Down Expand Up @@ -274,8 +274,6 @@ func (t *TestContext) CreateManagerNamespace() error {
// if a warning with `Warning: would violate PodSecurity` will be raised when the manifests are applied
func (t *TestContext) LabelAllNamespacesToWarnAboutRestricted() error {
_, err := t.Kubectl.Command("label", "--overwrite", "ns", "--all",
"pod-security.kubernetes.io/audit=restricted",
"pod-security.kubernetes.io/enforce-version=v1.24",
"pod-security.kubernetes.io/warn=restricted")
return err
}
Expand Down
32 changes: 32 additions & 0 deletions test/e2e/v4/e2e_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ import (
"fmt"
"testing"

"sigs.k8s.io/kubebuilder/v3/pkg/plugin/util"
"sigs.k8s.io/kubebuilder/v3/test/e2e/utils"

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)
Expand All @@ -30,3 +33,32 @@ func TestE2E(t *testing.T) {
fmt.Fprintf(GinkgoWriter, "Starting kubebuilder suite\n")
RunSpecs(t, "Kubebuilder e2e suite")
}

var (
kbc utils.TestContext
)

// BeforeSuite run before any specs are run to perform the required actions for all e2e Go tests.
var _ = BeforeSuite(func() {
var err error

kbc, err := utils.NewTestContext(util.KubebuilderBinName, "GO111MODULE=on")
Expect(err).NotTo(HaveOccurred())
Expect(kbc.Prepare()).To(Succeed())

By("installing the cert-manager bundle")
Expect(kbc.InstallCertManager()).To(Succeed())

By("installing the Prometheus operator")
Expect(kbc.InstallPrometheusOperManager()).To(Succeed())
})

// AfterSuite run after all the specs have run, regardless of whether any tests have failed to ensures that
// all be cleaned up
var _ = AfterSuite(func() {
By("uninstalling the Prometheus manager bundle")
kbc.UninstallPrometheusOperManager()

By("uninstalling the cert-manager bundle")
kbc.UninstallCertManager()
})
41 changes: 10 additions & 31 deletions test/e2e/v4/plugin_cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,50 +54,29 @@ type tokenRequest struct {
var _ = Describe("kubebuilder", func() {
Context("plugin go/v4", func() {
var kbc *utils.TestContext

BeforeEach(func() {
var err error
kbc, err = utils.NewTestContext(util.KubebuilderBinName, "GO111MODULE=on")
Expect(err).NotTo(HaveOccurred())
Expect(kbc.Prepare()).To(Succeed())

By("installing the cert-manager bundle")
Expect(kbc.InstallCertManager()).To(Succeed())

By("installing the Prometheus operator")
Expect(kbc.InstallPrometheusOperManager()).To(Succeed())
})

AfterEach(func() {
By("clean up API objects created during the test")
kbc.CleanupManifests(filepath.Join("config", "default"))

By("uninstalling the Prometheus manager bundle")
kbc.UninstallPrometheusOperManager()

By("uninstalling the cert-manager bundle")
kbc.UninstallCertManager()

By("removing controller image and working dir")
kbc.Destroy()
})
It("should generate a runnable project"+
" with restricted pods", func() {
kbc.IsRestricted = true
It("should generate a runnable project", func() {
kbc.IsRestricted = false
GenerateV4(kbc)
Run(kbc, true, false)
})
It("should generate a runnable project without webhooks"+
" with restricted pods", func() {
It("should generate a runnable project with the Installer", func() {
kbc.IsRestricted = false
GenerateV4(kbc)
Run(kbc, false, true)
})
It("should generate a runnable project with the manager running "+
"as restricted and without webhooks", func() {
kbc.IsRestricted = true
GenerateV4WithoutWebhooks(kbc)
Run(kbc, false, false)
})
It("should generate a runnable project"+
" with the Installer", func() {
GenerateV4(kbc)
Run(kbc, false, true)
})
})
})

Expand Down Expand Up @@ -162,7 +141,7 @@ func Run(kbc *utils.TestContext, hasWebhook, isToUseInstaller bool) {
ExpectWithOffset(1, err).NotTo(HaveOccurred())
}

if kbc.IsRestricted && !isToUseInstaller {
if kbc.IsRestricted {
By("validating that manager Pod/container(s) are restricted")
ExpectWithOffset(1, output).NotTo(ContainSubstring("Warning: would violate PodSecurity"))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const (
prometheusOperatorURL = "https://github.com/prometheus-operator/prometheus-operator/" +
"releases/download/%s/bundle.yaml"

certmanagerVersion = "v1.5.3"
certmanagerVersion = "v1.14.4"
certmanagerURLTmpl = "https://github.com/jetstack/cert-manager/releases/download/%s/cert-manager.yaml"
)

Expand Down
2 changes: 1 addition & 1 deletion testdata/project-v4-multigroup/test/utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const (
prometheusOperatorURL = "https://github.com/prometheus-operator/prometheus-operator/" +
"releases/download/%s/bundle.yaml"

certmanagerVersion = "v1.5.3"
certmanagerVersion = "v1.14.4"
certmanagerURLTmpl = "https://github.com/jetstack/cert-manager/releases/download/%s/cert-manager.yaml"
)

Expand Down
2 changes: 1 addition & 1 deletion testdata/project-v4-with-deploy-image/test/utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const (
prometheusOperatorURL = "https://github.com/prometheus-operator/prometheus-operator/" +
"releases/download/%s/bundle.yaml"

certmanagerVersion = "v1.5.3"
certmanagerVersion = "v1.14.4"
certmanagerURLTmpl = "https://github.com/jetstack/cert-manager/releases/download/%s/cert-manager.yaml"
)

Expand Down
2 changes: 1 addition & 1 deletion testdata/project-v4-with-grafana/test/utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const (
prometheusOperatorURL = "https://github.com/prometheus-operator/prometheus-operator/" +
"releases/download/%s/bundle.yaml"

certmanagerVersion = "v1.5.3"
certmanagerVersion = "v1.14.4"
certmanagerURLTmpl = "https://github.com/jetstack/cert-manager/releases/download/%s/cert-manager.yaml"
)

Expand Down
2 changes: 1 addition & 1 deletion testdata/project-v4/test/utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const (
prometheusOperatorURL = "https://github.com/prometheus-operator/prometheus-operator/" +
"releases/download/%s/bundle.yaml"

certmanagerVersion = "v1.5.3"
certmanagerVersion = "v1.14.4"
certmanagerURLTmpl = "https://github.com/jetstack/cert-manager/releases/download/%s/cert-manager.yaml"
)

Expand Down

0 comments on commit a72d9b8

Please sign in to comment.