Skip to content

Commit d5b9404

Browse files
doc about new option default-cleanup-policy
Signed-off-by: Denis Romanenko <denis.romanenko@flant.com>
1 parent 27feafe commit d5b9404

File tree

2 files changed

+48
-4
lines changed

2 files changed

+48
-4
lines changed

content/docs/cli/controller.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ Flags:
3535
--dns01-check-retry-period duration The duration the controller should wait between a propagation check. Despite the name, this flag is used to configure the wait period for both DNS01 and HTTP01 challenge propagation checks. For DNS01 challenges the propagation check verifies that a TXT record with the challenge token has been created. For HTTP01 challenges the propagation check verifies that the challenge token is served at the challenge URL.This should be a valid duration string, for example 180s or 1h (default 10s)
3636
--dns01-recursive-nameservers strings A list of comma separated dns server endpoints used for DNS01 check requests. This should be a list containing host and port, for example 8.8.8.8:53,8.8.4.4:53
3737
--dns01-recursive-nameservers-only When true, cert-manager will only ever query the configured DNS resolvers to perform the ACME DNS01 self check. This is useful in DNS constrained environments, where access to authoritative nameservers is restricted. Enabling this option could cause the DNS01 self check to take longer due to caching performed by the recursive nameservers.
38-
--enable-certificate-owner-ref Whether to set the certificate resource as an owner of secret where the tls certificate is stored. When this flag is enabled, the secret will be automatically removed when the certificate resource is deleted.
38+
--enable-certificate-owner-ref Whether to set the certificate resource as an owner of secret where the tls certificate is stored. When this flag is enabled, the secret will be automatically removed when the certificate resource is deleted. This flag is deprecated, but takes precedence over --default-secret-cleanup-policy for backward compatibility. Use --default-secret-cleanup-policy instead of it.
39+
--default-secret-cleanup-policy When this field is set to `OnDelete`, the owner reference is always created on the Secret resource and the secret will be automatically removed when the certificate resource is deleted. When this field is set to `Never`, the owner reference is never created on the Secret resource and the secret will not be automatically removed when the certificate resource is deleted.
3940
--enable-profiling Enable profiling for controller.
4041
--feature-gates mapStringBool A set of key=value pairs that describe feature gates for alpha/experimental features. Options are:
4142
AdditionalCertificateOutputFormats=true|false (ALPHA - default=false)

content/docs/usage/certificate.md

Lines changed: 46 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -267,11 +267,54 @@ associated with compromised keys.
267267

268268
## Cleaning up Secrets when Certificates are deleted
269269

270-
By default, cert-manager does not delete the `Secret` resource containing the signed certificate when the corresponding `Certificate` resource is deleted.
271-
This means that deleting a `Certificate` won't take down any services that are currently relying on that certificate, but the certificate will no longer be renewed.
270+
By default, cert-manager does not delete the `Secret` resource containing the
271+
signed certificate when the corresponding `Certificate` resource is deleted.
272+
This means that deleting a `Certificate` won't take down any services that are
273+
currently relying on that certificate, but the certificate will no longer be renewed.
272274
The `Secret` needs to be manually deleted if it is no longer needed.
273275

274-
If you would prefer the `Secret` to be deleted automatically when the `Certificate` is deleted, you need to configure your installation to pass the `--enable-certificate-owner-ref` flag to the controller.
276+
If you would prefer the `Secret` to be deleted automatically when the `Certificate`
277+
is deleted, you need to configure your installation to pass the
278+
`--default-secret-cleanup-policy=OnDelete` flag to the controller.
279+
280+
Also `Secret` deletion can be configured per-certificate, by setting
281+
`Certificate` `spec.cleanupPolicy` field.
282+
283+
#### `cleanupPolicy`
284+
285+
`cleanupPolicy` is when this field is set to `OnDelete`, the owner reference
286+
is always created on the Secret resource and the secret will be automatically
287+
removed when the certificate resource is deleted. When this field is set to `Never`,
288+
the owner reference is never created on the Secret resource and the secret will not
289+
be automatically removed when the certificate resource is deleted.
290+
If the value of this field is unset this field "inherits" the value of
291+
the flag `--default-secret-cleanup-policy`.
292+
293+
```yaml
294+
apiVersion: cert-manager.io/v1
295+
kind: Certificate
296+
metadata:
297+
name: my-cert
298+
spec:
299+
...
300+
secretName: my-cert-tls
301+
cleanupPolicy: OnDelete
302+
303+
# Results in:
304+
305+
apiVersion: v1
306+
kind: Secret
307+
metadata:
308+
name: my-cert-tls
309+
ownerReferences:
310+
- apiVersion: cert-manager.io/v1
311+
blockOwnerDeletion: true
312+
controller: true
313+
kind: Certificate
314+
name: my-cert
315+
...
316+
type: kubernetes.io/tls
317+
```
275318

276319
## Renewal
277320

0 commit comments

Comments
 (0)