mirror of
https://github.com/kyverno/kyverno.git
synced 2025-03-31 03:45:17 +00:00
added trace in debug mode on issue faile to register webhookConfigurations
This commit is contained in:
parent
3a92bde097
commit
d8da84a5b5
2 changed files with 16 additions and 4 deletions
|
@ -11,6 +11,7 @@ import (
|
||||||
client "github.com/nirmata/kyverno/pkg/dclient"
|
client "github.com/nirmata/kyverno/pkg/dclient"
|
||||||
|
|
||||||
admregapi "k8s.io/api/admissionregistration/v1beta1"
|
admregapi "k8s.io/api/admissionregistration/v1beta1"
|
||||||
|
errorsapi "k8s.io/apimachinery/pkg/api/errors"
|
||||||
meta "k8s.io/apimachinery/pkg/apis/meta/v1"
|
meta "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
admregclient "k8s.io/client-go/kubernetes/typed/admissionregistration/v1beta1"
|
admregclient "k8s.io/client-go/kubernetes/typed/admissionregistration/v1beta1"
|
||||||
rest "k8s.io/client-go/rest"
|
rest "k8s.io/client-go/rest"
|
||||||
|
@ -86,9 +87,21 @@ func (wrc *WebhookRegistrationClient) Register() error {
|
||||||
// Register will fail if the config exists, so there is no need to fail on error
|
// Register will fail if the config exists, so there is no need to fail on error
|
||||||
func (wrc *WebhookRegistrationClient) Deregister() {
|
func (wrc *WebhookRegistrationClient) Deregister() {
|
||||||
if wrc.serverIP != "" {
|
if wrc.serverIP != "" {
|
||||||
wrc.registrationClient.MutatingWebhookConfigurations().Delete(config.MutatingWebhookConfigurationDebug, &meta.DeleteOptions{})
|
if err := wrc.registrationClient.MutatingWebhookConfigurations().Delete(config.MutatingWebhookConfigurationDebug, &meta.DeleteOptions{}); err != nil {
|
||||||
wrc.registrationClient.ValidatingWebhookConfigurations().Delete(config.ValidatingWebhookConfigurationDebug, &meta.DeleteOptions{})
|
if !errorsapi.IsNotFound(err) {
|
||||||
wrc.registrationClient.ValidatingWebhookConfigurations().Delete(config.PolicyValidatingWebhookConfigurationDebug, &meta.DeleteOptions{})
|
glog.Errorf("Failed to deregister debug mutatingWebhookConfiguratinos, err: %v\n", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if err := wrc.registrationClient.ValidatingWebhookConfigurations().Delete(config.ValidatingWebhookConfigurationDebug, &meta.DeleteOptions{}); err != nil {
|
||||||
|
if !errorsapi.IsNotFound(err) {
|
||||||
|
glog.Errorf("Failed to deregister debug validatingWebhookConfiguratinos, err: %v\n", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if err := wrc.registrationClient.ValidatingWebhookConfigurations().Delete(config.PolicyValidatingWebhookConfigurationDebug, &meta.DeleteOptions{}); err != nil {
|
||||||
|
if !errorsapi.IsNotFound(err) {
|
||||||
|
glog.Errorf("Failed to deregister debug policyValidatingWebhookConfiguratinos, err: %v\n", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -55,7 +55,6 @@ openssl x509 -req -in ${destdir}/webhook.csr -CA ${destdir}/rootCA.crt -CAkey ${
|
||||||
|
|
||||||
|
|
||||||
kubectl delete -f definitions/install_debug.yaml 2>/dev/null
|
kubectl delete -f definitions/install_debug.yaml 2>/dev/null
|
||||||
kubectl delete csr,MutatingWebhookConfiguration,ValidatingWebhookConfiguration --all 2>/dev/null
|
|
||||||
|
|
||||||
echo "Generating corresponding kubernetes secrets for TLS pair and root CA"
|
echo "Generating corresponding kubernetes secrets for TLS pair and root CA"
|
||||||
# create project namespace
|
# create project namespace
|
||||||
|
|
Loading…
Add table
Reference in a new issue