diff --git a/vertical-pod-autoscaler/pkg/admission-controller/config.go b/vertical-pod-autoscaler/pkg/admission-controller/config.go index c1f88ae5d70..24cec4a4aa4 100644 --- a/vertical-pod-autoscaler/pkg/admission-controller/config.go +++ b/vertical-pod-autoscaler/pkg/admission-controller/config.go @@ -82,7 +82,7 @@ func configTLS(clientset *kubernetes.Clientset, serverCert, serverKey []byte) *t // register this webhook admission controller with the kube-apiserver // by creating MutatingWebhookConfiguration. -func selfRegistration(clientset *kubernetes.Clientset, caCert []byte, namespace *string) { +func selfRegistration(clientset *kubernetes.Clientset, caCert []byte, namespace *string, path *string) { time.Sleep(10 * time.Second) client := clientset.AdmissionregistrationV1beta1().MutatingWebhookConfigurations() _, err := client.Get(webhookConfigName, metav1.GetOptions{}) @@ -116,6 +116,7 @@ func selfRegistration(clientset *kubernetes.Clientset, caCert []byte, namespace }, }}, ClientConfig: v1beta1.WebhookClientConfig{ + URL: path, Service: &v1beta1.ServiceReference{ Namespace: *namespace, Name: "vpa-webhook", diff --git a/vertical-pod-autoscaler/pkg/admission-controller/main.go b/vertical-pod-autoscaler/pkg/admission-controller/main.go index d244cf60edf..50a6d2c8ec4 100644 --- a/vertical-pod-autoscaler/pkg/admission-controller/main.go +++ b/vertical-pod-autoscaler/pkg/admission-controller/main.go @@ -43,6 +43,7 @@ var ( address = flag.String("address", ":8944", "The address to expose Prometheus metrics.") namespace = os.Getenv("NAMESPACE") + path = flag.String("path","https://127.0.01","path for admission controller") ) func newReadyVPALister(stopChannel <-chan struct{}) vpa_lister.VerticalPodAutoscalerLister { @@ -75,6 +76,6 @@ func main() { Addr: ":8000", TLSConfig: configTLS(clientset, certs.serverCert, certs.serverKey), } - go selfRegistration(clientset, certs.caCert, &namespace) + go selfRegistration(clientset, certs.caCert, &namespace, path) server.ListenAndServeTLS("", "") }