Skip to content

Commit

Permalink
Merge pull request kubevirt#5661 from davidvossel/configure-webhook-t…
Browse files Browse the repository at this point in the history
…imeouts

Add default webhook timeouts
  • Loading branch information
kubevirt-bot authored May 18, 2021
2 parents 1637470 + 54bd8ae commit b9cf56d
Showing 1 changed file with 22 additions and 4 deletions.
26 changes: 22 additions & 4 deletions pkg/virt-operator/resource/generate/components/webhooks.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ var sideEffectNoneOnDryRun = admissionregistrationv1.SideEffectClassNoneOnDryRun

const certificatesSecretAnnotationKey = "certificates.kubevirt.io/secret"

var defaultTimeoutSeconds = int32(10)

func NewOperatorWebhookService(operatorNamespace string) *corev1.Service {
return &corev1.Service{
TypeMeta: metav1.TypeMeta{
Expand Down Expand Up @@ -89,13 +91,15 @@ func NewOpertorValidatingWebhookConfiguration(operatorNamespace string) *admissi
Resources: []string{"kubevirts"},
},
}},
FailurePolicy: &failurePolicy,
SideEffects: &sideEffectNone,
FailurePolicy: &failurePolicy,
TimeoutSeconds: &defaultTimeoutSeconds,
SideEffects: &sideEffectNone,
},
{
Name: "kubevirt-update-validator.kubevirt.io",
AdmissionReviewVersions: []string{"v1", "v1beta1"},
FailurePolicy: &failurePolicy,
TimeoutSeconds: &defaultTimeoutSeconds,
SideEffects: &sideEffectNone,
Rules: []admissionregistrationv1.RuleWithOperations{{
Operations: []admissionregistrationv1.OperationType{
Expand Down Expand Up @@ -146,6 +150,7 @@ func NewVirtAPIMutatingWebhookConfiguration(installNamespace string) *admissionr
AdmissionReviewVersions: []string{"v1", "v1beta1"},
SideEffects: &sideEffectNone,
FailurePolicy: &failurePolicy,
TimeoutSeconds: &defaultTimeoutSeconds,
Rules: []admissionregistrationv1.RuleWithOperations{{
Operations: []admissionregistrationv1.OperationType{
admissionregistrationv1.Create,
Expand All @@ -170,6 +175,7 @@ func NewVirtAPIMutatingWebhookConfiguration(installNamespace string) *admissionr
AdmissionReviewVersions: []string{"v1", "v1beta1"},
SideEffects: &sideEffectNone,
FailurePolicy: &failurePolicy,
TimeoutSeconds: &defaultTimeoutSeconds,
Rules: []admissionregistrationv1.RuleWithOperations{{
Operations: []admissionregistrationv1.OperationType{
admissionregistrationv1.Create,
Expand All @@ -194,6 +200,7 @@ func NewVirtAPIMutatingWebhookConfiguration(installNamespace string) *admissionr
AdmissionReviewVersions: []string{"v1", "v1beta1"},
SideEffects: &sideEffectNone,
FailurePolicy: &failurePolicy,
TimeoutSeconds: &defaultTimeoutSeconds,
Rules: []admissionregistrationv1.RuleWithOperations{{
Operations: []admissionregistrationv1.OperationType{
admissionregistrationv1.Create,
Expand Down Expand Up @@ -253,8 +260,9 @@ func NewVirtAPIValidatingWebhookConfiguration(installNamespace string) *admissio
AdmissionReviewVersions: []string{"v1", "v1beta1"},
// We don't want to block evictions in the cluster in a case where this webhook is down.
// The eviction of virt-launcher will still be protected by our pdb.
FailurePolicy: &ignorePolicy,
SideEffects: &sideEffectNoneOnDryRun,
FailurePolicy: &ignorePolicy,
TimeoutSeconds: &defaultTimeoutSeconds,
SideEffects: &sideEffectNoneOnDryRun,
Rules: []admissionregistrationv1.RuleWithOperations{{
Operations: []admissionregistrationv1.OperationType{
admissionregistrationv1.OperationAll,
Expand All @@ -277,6 +285,7 @@ func NewVirtAPIValidatingWebhookConfiguration(installNamespace string) *admissio
Name: "virtualmachineinstances-create-validator.kubevirt.io",
AdmissionReviewVersions: []string{"v1", "v1beta1"},
FailurePolicy: &failurePolicy,
TimeoutSeconds: &defaultTimeoutSeconds,
SideEffects: &sideEffectNone,
Rules: []admissionregistrationv1.RuleWithOperations{{
Operations: []admissionregistrationv1.OperationType{
Expand All @@ -300,6 +309,7 @@ func NewVirtAPIValidatingWebhookConfiguration(installNamespace string) *admissio
Name: "virtualmachineinstances-update-validator.kubevirt.io",
AdmissionReviewVersions: []string{"v1", "v1beta1"},
FailurePolicy: &failurePolicy,
TimeoutSeconds: &defaultTimeoutSeconds,
SideEffects: &sideEffectNone,
Rules: []admissionregistrationv1.RuleWithOperations{{
Operations: []admissionregistrationv1.OperationType{
Expand All @@ -323,6 +333,7 @@ func NewVirtAPIValidatingWebhookConfiguration(installNamespace string) *admissio
Name: "virtualmachine-validator.kubevirt.io",
AdmissionReviewVersions: []string{"v1", "v1beta1"},
FailurePolicy: &failurePolicy,
TimeoutSeconds: &defaultTimeoutSeconds,
SideEffects: &sideEffectNone,
Rules: []admissionregistrationv1.RuleWithOperations{{
Operations: []admissionregistrationv1.OperationType{
Expand All @@ -347,6 +358,7 @@ func NewVirtAPIValidatingWebhookConfiguration(installNamespace string) *admissio
Name: "virtualmachinereplicaset-validator.kubevirt.io",
AdmissionReviewVersions: []string{"v1", "v1beta1"},
FailurePolicy: &failurePolicy,
TimeoutSeconds: &defaultTimeoutSeconds,
SideEffects: &sideEffectNone,
Rules: []admissionregistrationv1.RuleWithOperations{{
Operations: []admissionregistrationv1.OperationType{
Expand All @@ -371,6 +383,7 @@ func NewVirtAPIValidatingWebhookConfiguration(installNamespace string) *admissio
Name: "virtualmachinepreset-validator.kubevirt.io",
AdmissionReviewVersions: []string{"v1", "v1beta1"},
FailurePolicy: &failurePolicy,
TimeoutSeconds: &defaultTimeoutSeconds,
SideEffects: &sideEffectNone,
Rules: []admissionregistrationv1.RuleWithOperations{{
Operations: []admissionregistrationv1.OperationType{
Expand All @@ -395,6 +408,7 @@ func NewVirtAPIValidatingWebhookConfiguration(installNamespace string) *admissio
Name: "migration-create-validator.kubevirt.io",
AdmissionReviewVersions: []string{"v1", "v1beta1"},
FailurePolicy: &failurePolicy,
TimeoutSeconds: &defaultTimeoutSeconds,
SideEffects: &sideEffectNone,
Rules: []admissionregistrationv1.RuleWithOperations{{
Operations: []admissionregistrationv1.OperationType{
Expand All @@ -418,6 +432,7 @@ func NewVirtAPIValidatingWebhookConfiguration(installNamespace string) *admissio
Name: "migration-update-validator.kubevirt.io",
AdmissionReviewVersions: []string{"v1", "v1beta1"},
FailurePolicy: &failurePolicy,
TimeoutSeconds: &defaultTimeoutSeconds,
SideEffects: &sideEffectNone,
Rules: []admissionregistrationv1.RuleWithOperations{{
Operations: []admissionregistrationv1.OperationType{
Expand All @@ -441,6 +456,7 @@ func NewVirtAPIValidatingWebhookConfiguration(installNamespace string) *admissio
Name: "virtualmachinesnapshot-validator.snapshot.kubevirt.io",
AdmissionReviewVersions: []string{"v1", "v1beta1"},
FailurePolicy: &failurePolicy,
TimeoutSeconds: &defaultTimeoutSeconds,
SideEffects: &sideEffectNone,
Rules: []admissionregistrationv1.RuleWithOperations{{
Operations: []admissionregistrationv1.OperationType{
Expand All @@ -466,6 +482,7 @@ func NewVirtAPIValidatingWebhookConfiguration(installNamespace string) *admissio
AdmissionReviewVersions: []string{"v1", "v1beta1"},
SideEffects: &sideEffectNone,
FailurePolicy: &failurePolicy,
TimeoutSeconds: &defaultTimeoutSeconds,
Rules: []admissionregistrationv1.RuleWithOperations{{
Operations: []admissionregistrationv1.OperationType{
admissionregistrationv1.Create,
Expand All @@ -489,6 +506,7 @@ func NewVirtAPIValidatingWebhookConfiguration(installNamespace string) *admissio
Name: "kubevirt-crd-status-validator.kubevirt.io",
AdmissionReviewVersions: []string{"v1", "v1beta1"},
FailurePolicy: &failurePolicy,
TimeoutSeconds: &defaultTimeoutSeconds,
SideEffects: &sideEffectNone,
Rules: []admissionregistrationv1.RuleWithOperations{{
Operations: []admissionregistrationv1.OperationType{
Expand Down

0 comments on commit b9cf56d

Please sign in to comment.