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

Commit

Permalink
feat: improve robustness in case manager is down (#289)
Browse files Browse the repository at this point in the history
* feat: improve robustness in case manager is down

Signed-off-by: Lin Yang <reaver@flomesh.io>

* fix: FailurePolicy

Signed-off-by: Lin Yang <reaver@flomesh.io>

---------

Signed-off-by: Lin Yang <reaver@flomesh.io>
  • Loading branch information
reaver-flomesh committed Jun 27, 2023
1 parent c62574f commit 28cae4f
Show file tree
Hide file tree
Showing 15 changed files with 31 additions and 2 deletions.
6 changes: 4 additions & 2 deletions pkg/admission/admission.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,10 @@ func NewMutatingWebhook(
caBundle []byte,
namespaceSelector *metav1.LabelSelector,
objectSelector *metav1.LabelSelector,
failurePolicy admissionregv1.FailurePolicyType,
rules []admissionregv1.RuleWithOperations,
) admissionregv1.MutatingWebhook {
failurePolicy := admissionregv1.Fail
//failurePolicy := admissionregv1.Fail
matchPolicy := admissionregv1.Exact
sideEffect := admissionregv1.SideEffectClassNone

Expand Down Expand Up @@ -129,9 +130,10 @@ func NewValidatingWebhook(
caBundle []byte,
namespaceSelector *metav1.LabelSelector,
objectSelector *metav1.LabelSelector,
failurePolicy admissionregv1.FailurePolicyType,
rules []admissionregv1.RuleWithOperations,
) admissionregv1.ValidatingWebhook {
failurePolicy := admissionregv1.Fail
//failurePolicy := admissionregv1.Fail
matchPolicy := admissionregv1.Exact
sideEffect := admissionregv1.SideEffectClassNone

Expand Down
1 change: 1 addition & 0 deletions pkg/injector/webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ func RegisterWebhooks(webhookSvcNs, webhookSvcName string, caBundle []byte) {
},
},
nil,
admissionregv1.Ignore,
[]admissionregv1.RuleWithOperations{rule},
)

Expand Down
2 changes: 2 additions & 0 deletions pkg/webhooks/cluster/cluster_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ func RegisterWebhooks(webhookSvcNs, webhookSvcName string, caBundle []byte) {
caBundle,
nil,
nil,
admissionregv1.Fail,
[]admissionregv1.RuleWithOperations{rule},
)

Expand All @@ -81,6 +82,7 @@ func RegisterWebhooks(webhookSvcNs, webhookSvcName string, caBundle []byte) {
caBundle,
nil,
nil,
admissionregv1.Fail,
[]admissionregv1.RuleWithOperations{rule},
)

Expand Down
2 changes: 2 additions & 0 deletions pkg/webhooks/cm/config_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ func RegisterWebhooks(webhookSvcNs, webhookSvcName string, caBundle []byte) {
caBundle,
nsSelector,
nil,
admissionregv1.Ignore,
[]admissionregv1.RuleWithOperations{rule},
)

Expand All @@ -84,6 +85,7 @@ func RegisterWebhooks(webhookSvcNs, webhookSvcName string, caBundle []byte) {
caBundle,
nsSelector,
nil,
admissionregv1.Ignore,
[]admissionregv1.RuleWithOperations{rule},
)

Expand Down
2 changes: 2 additions & 0 deletions pkg/webhooks/flb/secret/webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ func RegisterWebhooks(webhookSvcNs, webhookSvcName string, caBundle []byte) {
commons.FlbSecretLabel: "true",
},
},
admissionregv1.Ignore,
[]admissionregv1.RuleWithOperations{rule},
)

Expand All @@ -83,6 +84,7 @@ func RegisterWebhooks(webhookSvcNs, webhookSvcName string, caBundle []byte) {
commons.FlbSecretLabel: "true",
},
},
admissionregv1.Ignore,
[]admissionregv1.RuleWithOperations{rule},
)

Expand Down
2 changes: 2 additions & 0 deletions pkg/webhooks/flb/service/webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ func RegisterWebhooks(webhookSvcNs, webhookSvcName string, caBundle []byte) {
caBundle,
nil,
nil,
admissionregv1.Ignore,
[]admissionregv1.RuleWithOperations{rule},
)

Expand All @@ -76,6 +77,7 @@ func RegisterWebhooks(webhookSvcNs, webhookSvcName string, caBundle []byte) {
caBundle,
nil,
nil,
admissionregv1.Ignore,
[]admissionregv1.RuleWithOperations{rule},
)

Expand Down
2 changes: 2 additions & 0 deletions pkg/webhooks/gateway/gateway_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ func RegisterWebhooks(webhookSvcNs, webhookSvcName string, caBundle []byte) {
caBundle,
nil,
nil,
admissionregv1.Ignore,
[]admissionregv1.RuleWithOperations{rule},
)

Expand All @@ -76,6 +77,7 @@ func RegisterWebhooks(webhookSvcNs, webhookSvcName string, caBundle []byte) {
caBundle,
nil,
nil,
admissionregv1.Ignore,
[]admissionregv1.RuleWithOperations{rule},
)

Expand Down
2 changes: 2 additions & 0 deletions pkg/webhooks/gatewayclass/gatewayclass_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ func RegisterWebhooks(webhookSvcNs, webhookSvcName string, caBundle []byte) {
caBundle,
nil,
nil,
admissionregv1.Ignore,
[]admissionregv1.RuleWithOperations{rule},
)

Expand All @@ -76,6 +77,7 @@ func RegisterWebhooks(webhookSvcNs, webhookSvcName string, caBundle []byte) {
caBundle,
nil,
nil,
admissionregv1.Ignore,
[]admissionregv1.RuleWithOperations{rule},
)

Expand Down
2 changes: 2 additions & 0 deletions pkg/webhooks/globaltrafficpolicy/webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ func RegisterWebhooks(webhookSvcNs, webhookSvcName string, caBundle []byte) {
caBundle,
nil,
nil,
admissionregv1.Fail,
[]admissionregv1.RuleWithOperations{rule},
)

Expand All @@ -75,6 +76,7 @@ func RegisterWebhooks(webhookSvcNs, webhookSvcName string, caBundle []byte) {
caBundle,
nil,
nil,
admissionregv1.Fail,
[]admissionregv1.RuleWithOperations{rule},
)

Expand Down
2 changes: 2 additions & 0 deletions pkg/webhooks/httproute/httproute_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ func RegisterWebhooks(webhookSvcNs, webhookSvcName string, caBundle []byte) {
caBundle,
nil,
nil,
admissionregv1.Ignore,
[]admissionregv1.RuleWithOperations{rule},
)

Expand All @@ -76,6 +77,7 @@ func RegisterWebhooks(webhookSvcNs, webhookSvcName string, caBundle []byte) {
caBundle,
nil,
nil,
admissionregv1.Ignore,
[]admissionregv1.RuleWithOperations{rule},
)

Expand Down
2 changes: 2 additions & 0 deletions pkg/webhooks/ingress/webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ func RegisterWebhooks(webhookSvcNs, webhookSvcName string, caBundle []byte) {
caBundle,
nil,
nil,
admissionregv1.Ignore,
[]admissionregv1.RuleWithOperations{rule},
)

Expand All @@ -77,6 +78,7 @@ func RegisterWebhooks(webhookSvcNs, webhookSvcName string, caBundle []byte) {
caBundle,
nil,
nil,
admissionregv1.Ignore,
[]admissionregv1.RuleWithOperations{rule},
)

Expand Down
2 changes: 2 additions & 0 deletions pkg/webhooks/namespacedingress/namespacedingress_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ func RegisterWebhooks(webhookSvcNs, webhookSvcName string, caBundle []byte) {
caBundle,
nil,
nil,
admissionregv1.Fail,
[]admissionregv1.RuleWithOperations{rule},
)

Expand All @@ -79,6 +80,7 @@ func RegisterWebhooks(webhookSvcNs, webhookSvcName string, caBundle []byte) {
caBundle,
nil,
nil,
admissionregv1.Fail,
[]admissionregv1.RuleWithOperations{rule},
)

Expand Down
2 changes: 2 additions & 0 deletions pkg/webhooks/proxyprofile/proxyprofile_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ func RegisterWebhooks(webhookSvcNs, webhookSvcName string, caBundle []byte) {
caBundle,
nil,
nil,
admissionregv1.Fail,
[]admissionregv1.RuleWithOperations{rule},
)

Expand All @@ -77,6 +78,7 @@ func RegisterWebhooks(webhookSvcNs, webhookSvcName string, caBundle []byte) {
caBundle,
nil,
nil,
admissionregv1.Fail,
[]admissionregv1.RuleWithOperations{rule},
)

Expand Down
2 changes: 2 additions & 0 deletions pkg/webhooks/serviceexport/webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ func RegisterWebhooks(webhookSvcNs, webhookSvcName string, caBundle []byte) {
caBundle,
nil,
nil,
admissionregv1.Fail,
[]admissionregv1.RuleWithOperations{rule},
)

Expand All @@ -73,6 +74,7 @@ func RegisterWebhooks(webhookSvcNs, webhookSvcName string, caBundle []byte) {
caBundle,
nil,
nil,
admissionregv1.Fail,
[]admissionregv1.RuleWithOperations{rule},
)

Expand Down
2 changes: 2 additions & 0 deletions pkg/webhooks/serviceimport/webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ func RegisterWebhooks(webhookSvcNs, webhookSvcName string, caBundle []byte) {
caBundle,
nil,
nil,
admissionregv1.Fail,
[]admissionregv1.RuleWithOperations{rule},
)

Expand All @@ -74,6 +75,7 @@ func RegisterWebhooks(webhookSvcNs, webhookSvcName string, caBundle []byte) {
caBundle,
nil,
nil,
admissionregv1.Fail,
[]admissionregv1.RuleWithOperations{rule},
)

Expand Down

0 comments on commit 28cae4f

Please sign in to comment.