Skip to content

Commit

Permalink
[WIP]Allow vpa-admission-controler to installl on specific path
Browse files Browse the repository at this point in the history
  • Loading branch information
Rajat-0 committed Jan 30, 2019
1 parent 0a82f0e commit c10c63f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion vertical-pod-autoscaler/pkg/admission-controller/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{})
Expand Down Expand Up @@ -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",
Expand Down
3 changes: 2 additions & 1 deletion vertical-pod-autoscaler/pkg/admission-controller/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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("", "")
}

0 comments on commit c10c63f

Please sign in to comment.