diff --git a/Makefile b/Makefile index 4875da0..8f7c6f8 100644 --- a/Makefile +++ b/Makefile @@ -274,7 +274,7 @@ $(ENVTEST): $(LOCALBIN) .PHONY: bundle bundle: manifests kustomize ## Generate bundle manifests and metadata, then validate generated files. operator-sdk generate kustomize manifests -q - cd config/webhook && $(KUSTOMIZE) edit set image controller=$(IMG) + cd config/webhook && $(KUSTOMIZE) edit set image kcl-webhook-server=$(IMG) $(KUSTOMIZE) build config/manifests | operator-sdk generate bundle -q --overwrite --version $(VERSION) $(BUNDLE_METADATA_OPTS) operator-sdk bundle validate ./bundle diff --git a/api/kclrun/v1alpha1/kclrun_types.go b/api/kclrun/v1alpha1/kclrun_types.go index 274089b..8932b21 100644 --- a/api/kclrun/v1alpha1/kclrun_types.go +++ b/api/kclrun/v1alpha1/kclrun_types.go @@ -1,5 +1,5 @@ /* -Copyright 2023. +Copyright 2023 The KCL Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/api/kclrun/v1alpha1/zz_generated.deepcopy.go b/api/kclrun/v1alpha1/zz_generated.deepcopy.go index 36d7cfb..c8096f0 100644 --- a/api/kclrun/v1alpha1/zz_generated.deepcopy.go +++ b/api/kclrun/v1alpha1/zz_generated.deepcopy.go @@ -1,7 +1,7 @@ //go:build !ignore_autogenerated /* -Copyright 2023. +Copyright 2023 The KCL Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/api/kclrun/v1alpha1/zz_generated.register.go b/api/kclrun/v1alpha1/zz_generated.register.go index c2ee0c6..9b8fa45 100644 --- a/api/kclrun/v1alpha1/zz_generated.register.go +++ b/api/kclrun/v1alpha1/zz_generated.register.go @@ -1,5 +1,5 @@ /* -Copyright 2023. +Copyright 2023 The KCL Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/cmd/webhook-init/main.go b/cmd/webhook-init/main.go index f51f4c9..7b8a180 100644 --- a/cmd/webhook-init/main.go +++ b/cmd/webhook-init/main.go @@ -80,9 +80,16 @@ func main() { Bytes: caBytes, }) - dnsNames := []string{"webhook-service", - "webhook-service.default", "webhook-service.default.svc"} - commonName := "webhook-service.default.svc" + var ( + webhookService, _ = os.LookupEnv("WEBHOOK_SERVICE") + ) + if webhookService == "" { + webhookService = "webhook-service" + } + + commonName := fmt.Sprintf("%s.default.svc", webhookService) + dnsNames := []string{webhookService, + fmt.Sprintf("%s.default", webhookService), commonName} // server cert config cert := &x509.Certificate{ @@ -178,6 +185,9 @@ func createMutationConfig(caCert *bytes.Buffer) error { mutationCfgName, _ = os.LookupEnv("MUTATE_CONFIG") webhookService, _ = os.LookupEnv("WEBHOOK_SERVICE") ) + if webhookService == "" { + webhookService = "webhook-service" + } config := ctrl.GetConfigOrDie() kubeClient, err := kubernetes.NewForConfig(config) if err != nil { diff --git a/hack/boilerplate.go.txt b/hack/boilerplate.go.txt index 65b8622..c44a8d9 100644 --- a/hack/boilerplate.go.txt +++ b/hack/boilerplate.go.txt @@ -1,5 +1,5 @@ /* -Copyright 2023. +Copyright 2023 The KCL Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.