Skip to content

Commit

Permalink
config: prefix generic objects (validatingwebhook and issuer) (#995)
Browse files Browse the repository at this point in the history
* config: prefix issuer w/ cartographer-

despite the object being namespace-scoped, it's such a generic name that
it makes sense to have it prefixed with `cartographer-` so that we're
able to carry the component nomenclature.


* hack: override default validatingwebhook name

by default, controller-tools' controller-gen generates the object with a
hardcoded name of `validating-webhook-configuration`

for those using kustomize (like kubebuilder does), that's not a problem
as the configuration usually specifies what the prefix for objects
should look like, e.g.

	# in kustomization.yaml

	namePrefix: cartographer-conventions-

but, given that this repository _doens't_ make use of kustomize (as it
wasn't initialized w/ kubebuilder), here we resort to using ytt overlays
for it (we already had one for webhook configs anyway, so, just update
it).

see
https://github.com/kubernetes-sigs/controller-tools/blob/ebdf5177ad92f89da82686f4100c06d428ab3ce5/pkg/webhook/parser.go#L384-L405
for details on that hardcoded name.

Signed-off-by: Ciro S. Costa <[email protected]>
  • Loading branch information
Ciro S. Costa authored Aug 25, 2022
1 parent 2391878 commit 37489d8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
4 changes: 2 additions & 2 deletions config/webhook/support.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ spec:
- cartographer-webhook.cartographer-system.svc.cluster.local
issuerRef:
kind: Issuer
name: selfsigned-issuer
name: cartographer-selfsigned-issuer
secretName: cartographer-webhook

---
apiVersion: cert-manager.io/v1
kind: Issuer
metadata:
name: selfsigned-issuer
name: cartographer-selfsigned-issuer
namespace: cartographer-system
spec:
selfSigned: {}
Expand Down
1 change: 1 addition & 0 deletions hack/overlays/webhook-configuration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ metadata:
#@overlay/match missing_ok=True
annotations:
cert-manager.io/inject-ca-from: cartographer-system/cartographer-webhook
name: cartographer-validating-webhook-configuration

webhooks:
#@overlay/match by=overlay.all, expects="1+"
Expand Down

0 comments on commit 37489d8

Please sign in to comment.