diff --git a/CHANGELOG.md b/CHANGELOG.md index 7ebf858e8..164f503be 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## v0.36.0 + +- Allow customizing Helm chart version and proxy readiness probe used + in Kong addon. + [#774](https://github.com/Kong/kubernetes-testing-framework/pull/774) + ## v0.35.0 - Support specifying namespace of Kong addon to deploy Kong in certain diff --git a/pkg/clusters/addons/kong/addon.go b/pkg/clusters/addons/kong/addon.go index d0745c607..425f5cd43 100644 --- a/pkg/clusters/addons/kong/addon.go +++ b/pkg/clusters/addons/kong/addon.go @@ -74,9 +74,10 @@ type Addon struct { logger *logrus.Logger // kubernetes and helm chart related configuration options - namespace string - name string - deployArgs []string + namespace string + name string + deployArgs []string + chartVersion string // ingress controller configuration options ingressControllerDisabled bool @@ -92,6 +93,7 @@ type Addon struct { proxyLogLevel string proxyServiceType corev1.ServiceType proxyEnvVars map[string]string + proxyReadinessProbePath string // proxy server enterprise mode configuration options proxyEnterpriseEnabled bool @@ -215,6 +217,10 @@ func (a *Addon) Deploy(ctx context.Context, cluster clusters.Cluster) error { return err } + if a.chartVersion != "" { + a.deployArgs = append(a.deployArgs, "--version", a.chartVersion) + } + if a.proxyPullSecret != (pullSecret{}) { // create the pull Secret opts := create.CreateSecretDockerRegistryOptions{ @@ -300,6 +306,11 @@ func (a *Addon) Deploy(ctx context.Context, cluster clusters.Cluster) error { a.deployArgs = append(a.deployArgs, "--set", fmt.Sprintf("env.log_level=%s", a.proxyLogLevel)) } + // Set the proxy readiness probe path. + if len(a.proxyReadinessProbePath) > 0 { + a.deployArgs = append(a.deployArgs, "--set", fmt.Sprintf("readinessProbe.httpGet.path=%s", a.proxyReadinessProbePath)) + } + // Deploy licenses and other configurations for enterprise mode. if a.proxyEnterpriseEnabled { // Set the enterprise defaults helm installation values. diff --git a/pkg/clusters/addons/kong/builder.go b/pkg/clusters/addons/kong/builder.go index a0ccbaadc..0ca6313c6 100644 --- a/pkg/clusters/addons/kong/builder.go +++ b/pkg/clusters/addons/kong/builder.go @@ -16,9 +16,10 @@ type Builder struct { logger *logrus.Logger // kubernetes and helm chart related configuration options - namespace string - name string - deployArgs []string + namespace string + name string + deployArgs []string + chartVersion string // ingress controller configuration options ingressControllerDisabled bool @@ -34,6 +35,7 @@ type Builder struct { proxyLogLevel string proxyServiceType corev1.ServiceType proxyEnvVars map[string]string + proxyReadinessProbePath string // proxy server enterprise mode configuration options proxyEnterpriseEnabled bool @@ -76,9 +78,10 @@ func (b *Builder) Build() *Addon { return &Addon{ logger: b.logger, - namespace: b.namespace, - name: b.name, - deployArgs: b.deployArgs, + namespace: b.namespace, + name: b.name, + deployArgs: b.deployArgs, + chartVersion: b.chartVersion, ingressControllerDisabled: b.ingressControllerDisabled, ingressControllerImage: b.ingressControllerImage, @@ -92,6 +95,7 @@ func (b *Builder) Build() *Addon { proxyLogLevel: b.proxyLogLevel, proxyServiceType: b.proxyServiceType, proxyEnvVars: b.proxyEnvVars, + proxyReadinessProbePath: b.proxyReadinessProbePath, proxyEnterpriseEnabled: b.proxyEnterpriseEnabled, proxyEnterpriseLicenseJSON: b.proxyEnterpriseLicenseJSON, @@ -206,3 +210,15 @@ func (b *Builder) WithProxyEnterpriseSuperAdminPassword(password string) *Builde b.proxyEnterpriseSuperAdminPassword = password return b } + +// WithHelmChartVersion sets the helm chart version to use for the Kong proxy. +func (b *Builder) WithHelmChartVersion(version string) *Builder { + b.deployArgs = append(b.deployArgs, "--version", version) + return b +} + +// WithProxyReadinessProbePath sets the path to use for the proxy readiness probe. +func (b *Builder) WithProxyReadinessProbePath(path string) *Builder { + b.proxyReadinessProbePath = path + return b +}