diff --git a/Taskfile.yaml b/Taskfile.yaml index a1855cd..bb7940f 100644 --- a/Taskfile.yaml +++ b/Taskfile.yaml @@ -52,6 +52,14 @@ tasks: output:crd:artifacts:config=config/base/crd/bases \ output:rbac:artifacts:config=config/components/controller_rbac \ output:webhook:artifacts:config=config/base/webhook + # controller-gen always emits the kubebuilder placeholder + # service name (`webhook-service`) on every regeneration, + # which does not match the Service this repo actually + # declares (`billing-webhook`). Restore it in-place so the + # generated manifest matches the declared Service without + # requiring an out-of-band manual fix-up. + perl -pi -e 's/^( name: )webhook-service$/${1}billing-webhook/' \ + config/base/webhook/manifests.yaml echo "Manifests generated!" deps: - install-tools diff --git a/config/base/crd/kustomization.yaml b/config/base/crd/kustomization.yaml index 1b3b189..7e40e36 100644 --- a/config/base/crd/kustomization.yaml +++ b/config/base/crd/kustomization.yaml @@ -6,6 +6,8 @@ resources: - bases/billing.miloapis.com_billingaccountbindings.yaml - bases/billing.miloapis.com_meterdefinitions.yaml - bases/billing.miloapis.com_monitoredresourcetypes.yaml +- bases/billing.miloapis.com_paymentmethods.yaml +- bases/billing.miloapis.com_paymentmethodclasses.yaml # +kubebuilder:scaffold:crdkustomizeresource patches: diff --git a/config/base/webhook/kustomization.yaml b/config/base/webhook/kustomization.yaml index b3703c4..142b5f9 100644 --- a/config/base/webhook/kustomization.yaml +++ b/config/base/webhook/kustomization.yaml @@ -2,9 +2,10 @@ apiVersion: kustomize.config.k8s.io/v1alpha1 kind: Component resources: # manifests.yaml is generated by controller-gen and should NOT be edited -# directly — `task manifests` will overwrite it. After regeneration, restore -# the service name from the controller-gen default (`webhook-service`) to -# `billing-webhook` to match the declared Service. +# directly — `task manifests` will overwrite it. The service name fix-up +# (`webhook-service` → `billing-webhook`) is applied in-place by the +# manifests task itself, so regenerating no longer leaves the file in a +# broken state. - manifests.yaml # Teach kustomize about the webhook clientConfig.service.{name,namespace} diff --git a/config/base/webhook/manifests.yaml b/config/base/webhook/manifests.yaml index e578d98..c7a0042 100644 --- a/config/base/webhook/manifests.yaml +++ b/config/base/webhook/manifests.yaml @@ -8,7 +8,7 @@ webhooks: - v1 clientConfig: service: - name: webhook-service + name: billing-webhook namespace: system path: /mutate-billing-miloapis-com-v1alpha1-billingaccount failurePolicy: Fail @@ -28,7 +28,7 @@ webhooks: - v1 clientConfig: service: - name: webhook-service + name: billing-webhook namespace: system path: /mutate-billing-miloapis-com-v1alpha1-paymentmethod failurePolicy: Fail @@ -54,7 +54,7 @@ webhooks: - v1 clientConfig: service: - name: webhook-service + name: billing-webhook namespace: system path: /validate-billing-miloapis-com-v1alpha1-billingaccount failurePolicy: Fail @@ -75,7 +75,7 @@ webhooks: - v1 clientConfig: service: - name: webhook-service + name: billing-webhook namespace: system path: /validate-billing-miloapis-com-v1alpha1-billingaccountbinding failurePolicy: Fail @@ -96,7 +96,7 @@ webhooks: - v1 clientConfig: service: - name: webhook-service + name: billing-webhook namespace: system path: /validate-billing-miloapis-com-v1alpha1-meterdefinition failurePolicy: Fail @@ -117,7 +117,7 @@ webhooks: - v1 clientConfig: service: - name: webhook-service + name: billing-webhook namespace: system path: /validate-billing-miloapis-com-v1alpha1-monitoredresourcetype failurePolicy: Fail @@ -138,7 +138,7 @@ webhooks: - v1 clientConfig: service: - name: webhook-service + name: billing-webhook namespace: system path: /validate-billing-miloapis-com-v1alpha1-paymentmethod failurePolicy: Fail @@ -158,7 +158,7 @@ webhooks: - v1 clientConfig: service: - name: webhook-service + name: billing-webhook namespace: system path: /validate-billing-miloapis-com-v1alpha1-paymentmethodclass failurePolicy: Fail