cmd/k8s-operator: allow letsencrypt staging on k8s proxies (#16521)

This commit modifies the operator to detect the usage of k8s-apiserver
type proxy groups that wish to use the letsencrypt staging directory and
apply the appropriate environment variable to the statefulset it
produces.

Updates #13358

Signed-off-by: David Bond <davidsbond93@gmail.com>
This commit is contained in:
David Bond
2025-07-10 14:33:13 +01:00
committed by GitHub
parent fbc4c34cf7
commit cf0460b9da
2 changed files with 20 additions and 8 deletions

View File

@@ -761,14 +761,21 @@ func applyProxyClassToStatefulSet(pc *tsapi.ProxyClass, ss *appsv1.StatefulSet,
enableEndpoints(ss, metricsEnabled, debugEnabled)
}
}
if pc.Spec.UseLetsEncryptStagingEnvironment && (stsCfg.proxyType == proxyTypeIngressResource || stsCfg.proxyType == string(tsapi.ProxyGroupTypeIngress)) {
for i, c := range ss.Spec.Template.Spec.Containers {
if isMainContainer(&c) {
ss.Spec.Template.Spec.Containers[i].Env = append(ss.Spec.Template.Spec.Containers[i].Env, corev1.EnvVar{
Name: "TS_DEBUG_ACME_DIRECTORY_URL",
Value: letsEncryptStagingEndpoint,
})
break
if stsCfg != nil {
usesLetsEncrypt := stsCfg.proxyType == proxyTypeIngressResource ||
stsCfg.proxyType == string(tsapi.ProxyGroupTypeIngress) ||
stsCfg.proxyType == string(tsapi.ProxyGroupTypeKubernetesAPIServer)
if pc.Spec.UseLetsEncryptStagingEnvironment && usesLetsEncrypt {
for i, c := range ss.Spec.Template.Spec.Containers {
if isMainContainer(&c) {
ss.Spec.Template.Spec.Containers[i].Env = append(ss.Spec.Template.Spec.Containers[i].Env, corev1.EnvVar{
Name: "TS_DEBUG_ACME_DIRECTORY_URL",
Value: letsEncryptStagingEndpoint,
})
break
}
}
}
}