Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Dev setup #1815

Merged
merged 2 commits into from
Apr 21, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions cmd/kyverno/main.go
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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