diff --git a/.changelog/8.txt b/.changelog/8.txt new file mode 100644 index 0000000..42698bf --- /dev/null +++ b/.changelog/8.txt @@ -0,0 +1,3 @@ +```release-note:bug +`webhook` - Fix kube client apply for mutating manifest. +``` \ No newline at end of file diff --git a/.gitignore b/.gitignore index f71f1f0..5170b3b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ examples/ bin/ dist/ -config/manifests/mutatingWebhookConfiguration.yaml \ No newline at end of file +config/manifests/mutatingWebhookConfiguration.yaml diff --git a/cmd/webhook/certificate.go b/cmd/webhook/certificate.go index 6db014e..1b24459 100644 --- a/cmd/webhook/certificate.go +++ b/cmd/webhook/certificate.go @@ -90,6 +90,7 @@ func generateCert(orgs, dnsNames []string, commonName string) (*bytes.Buffer, *b // print CA certificate if insideCluster is false if !insideCluster { writeNewCA(caPEM, manifestWebhookPath) + time.Sleep(2 * time.Second) applyManifest(manifestWebhookPath) debugLogger.Printf("CA certificate Encoded: %s", base64.StdEncoding.EncodeToString(caPEM.Bytes())) diff --git a/config/manifests/mutatingWebhookConfiguration.yaml b/config/manifests/mutatingWebhookConfiguration.yaml index 464fdf0..4c862c0 100644 --- a/config/manifests/mutatingWebhookConfiguration.yaml +++ b/config/manifests/mutatingWebhookConfiguration.yaml @@ -16,7 +16,7 @@ webhooks: # path: /mutate # port: 8443 # CA certificate with BEGIN and END lines - base64 encoded - caBundle: "LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUZFekNDQXZ1Z0F3SUJBZ0lDQitZd0RRWUpLb1pJaHZjTkFRRUxCUUF3R3pFWk1CY0dBMVVFQ2hNUWVXOTEKY2k1bGVHRnRjR3hsTG1OdmJUQWVGdzB5TkRBNU1qY3dOalUyTURaYUZ3MHlOVEE1TWpjd05qVTJNRFphTUJzeApHVEFYQmdOVkJBb1RFSGx2ZFhJdVpYaGhiWEJzWlM1amIyMHdnZ0lpTUEwR0NTcUdTSWIzRFFFQkFRVUFBNElDCkR3QXdnZ0l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