Skip to content

Commit 981627a

Browse files
Merge pull request #534 from erikgb/fix/issue-207
BUGFIX: Webhook CA Secret name should match Helm templated RBAC
2 parents a953908 + badfb26 commit 981627a

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
lines changed

deploy/charts/approver-policy/templates/deployment.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ spec:
6161
- --webhook-port={{.Values.app.webhook.port}}
6262
- --webhook-service-name={{ include "cert-manager-approver-policy.name" . }}
6363
- --webhook-ca-secret-namespace={{.Release.Namespace}}
64+
- --webhook-ca-secret-name={{ include "cert-manager-approver-policy.name" . }}-tls
6465

6566
{{- with .Values.volumeMounts }}
6667
volumeMounts:

pkg/internal/cmd/cmd.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ func NewCommand(ctx context.Context) *cobra.Command {
6464
DNSNames: []string{fmt.Sprintf("%s.%s.svc", opts.Webhook.ServiceName, opts.Webhook.CASecretNamespace)},
6565
Authority: &authority.DynamicAuthority{
6666
SecretNamespace: opts.Webhook.CASecretNamespace,
67-
SecretName: "cert-manager-approver-policy-tls",
67+
SecretName: opts.Webhook.CASecretName,
6868
RESTConfig: opts.RestConfig,
6969
CADuration: opts.Webhook.CADuration,
7070
LeafDuration: opts.Webhook.LeafDuration,

pkg/internal/cmd/options/options.go

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,10 +120,14 @@ type Webhook struct {
120120
// ServiceName is the service that exposes the Webhook server.
121121
ServiceName string
122122

123-
// CASecretNamespace is the namespace that the
124-
// cert-manager-approver-policy-tls Secret is stored.
123+
// CASecretName is the namespace that the approver-policy
124+
// webhook CA certificate Secret is stored.
125125
CASecretNamespace string
126126

127+
// CASecretName is the name of the Secret use to store
128+
// the approver-policy webhook CA certificate.
129+
CASecretName string
130+
127131
// CADuration for webhook server DynamicSource CA.
128132
// DynamicSource is upstream cert-manager's CA Provider.
129133
// Defaults to 1 year.
@@ -237,7 +241,11 @@ func (o *Options) addWebhookFlags(fs *pflag.FlagSet) {
237241

238242
fs.StringVar(&o.Webhook.CASecretNamespace,
239243
"webhook-ca-secret-namespace", "cert-manager",
240-
"Namespace that the cert-manager-approver-policy-tls Secret is stored.")
244+
"Namespace that the approver-policy webhook CA certificate Secret is stored.")
245+
246+
fs.StringVar(&o.Webhook.CASecretName,
247+
"webhook-ca-secret-name", "cert-manager-approver-policy-tls",
248+
"Name of Secret used to store the approver-policy webhook CA certificate Secret.")
241249

242250
fs.DurationVar(&o.Webhook.CADuration,
243251
"webhook-ca-duration", time.Hour*24*365,

0 commit comments

Comments
 (0)