Skip to content
This repository has been archived by the owner on Oct 28, 2024. It is now read-only.

[VC] unset the VC validation webhook CABundle #55

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import (
"crypto/x509/pkix"
"encoding/pem"
"fmt"
"io/ioutil"
"net"
"os"
"path/filepath"
Expand Down Expand Up @@ -65,7 +64,6 @@ const (
VCWebhookServiceName = "virtualcluster-webhook-service"
DefaultVCWebhookServiceNs = "vc-manager"
VCWebhookCfgName = "virtualcluster-validating-webhook-configuration"
VCWebhookCAFile = "/var/run/secrets/kubernetes.io/serviceaccount/ca.crt"
VCWebhookCSRName = "virtualcluster-webhook-csr"
)

Expand Down Expand Up @@ -145,11 +143,6 @@ func createValidatingWebhookConfiguration(client client.Client) error {
svcPort := int32(constants.VirtualClusterWebhookPort)
// reject request if the webhook doesn't work
failPolicy := admv1beta1.Fail
// use the serviceaccount ca file as the authority
CAPemByts, err := ioutil.ReadFile(VCWebhookCAFile)
if err != nil {
return fmt.Errorf("fail to read ca file(%s): %s", VCWebhookCAFile, err)
}
vwhCfg := admv1beta1.ValidatingWebhookConfiguration{
ObjectMeta: metav1.ObjectMeta{
Name: VCWebhookCfgName,
Expand All @@ -167,7 +160,6 @@ func createValidatingWebhookConfiguration(client client.Client) error {
Path: &validatePath,
Port: &svcPort,
},
CABundle: CAPemByts,
},
FailurePolicy: &failPolicy,
Rules: []admv1beta1.RuleWithOperations{
Expand Down