Skip to content

Commit

Permalink
Fix Dev setup
Browse files Browse the repository at this point in the history
  • Loading branch information
vyankd committed Apr 17, 2021
1 parent 56183cc commit 1068fda
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
4 changes: 2 additions & 2 deletions cmd/kyverno/main.go
Expand Up @@ -138,13 +138,14 @@ func main() {
if err != nil {
setupLog.Error(err, "ConfigMap lookup disabled: failed to create resource cache")
}

debug := serverIP != ""
webhookCfg := webhookconfig.NewRegister(
clientConfig,
client,
rCache,
serverIP,
int32(webhookTimeout),
debug,
log.Log)

// Resource Mutating Webhook Watcher
Expand Down Expand Up @@ -334,7 +335,6 @@ func main() {
// -- annotations on resources with update details on mutation JSON patches
// -- generate policy violation resource
// -- generate events on policy and resource
debug := serverIP != ""
server, err := webhooks.NewWebhookServer(
pclient,
client,
Expand Down
10 changes: 7 additions & 3 deletions pkg/webhookconfig/registration.go
Expand Up @@ -39,6 +39,7 @@ type Register struct {
serverIP string // when running outside a cluster
timeoutSeconds int32
log logr.Logger
debug bool
}

// NewRegister creates new Register instance
Expand All @@ -48,6 +49,7 @@ func NewRegister(
resCache resourcecache.ResourceCache,
serverIP string,
webhookTimeout int32,
debug bool,
log logr.Logger) *Register {
return &Register{
clientConfig: clientConfig,
Expand All @@ -56,6 +58,7 @@ func NewRegister(
serverIP: serverIP,
timeoutSeconds: webhookTimeout,
log: log.WithName("Register"),
debug: debug,
}
}

Expand All @@ -65,10 +68,11 @@ func (wrc *Register) Register() error {
if wrc.serverIP != "" {
logger.Info("Registering webhook", "url", fmt.Sprintf("https://%s", wrc.serverIP))
}
if err := wrc.checkEndpoint(); err != nil {
return err
if !wrc.debug {
if err := wrc.checkEndpoint(); err != nil {
return err
}
}

wrc.removeWebhookConfigurations()

caData := wrc.readCaData()
Expand Down

0 comments on commit 1068fda

Please sign in to comment.