-
Notifications
You must be signed in to change notification settings - Fork 752
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
add prometheus for pub and deletion protection #1346
Conversation
Signed-off-by: liheng.zms <liheng.zms@alibaba-inc.com>
Sonatype Lift is retiringSonatype Lift will be retiring on Sep 12, 2023, with its analysis stopping on Aug 12, 2023. We understand that this news may come as a disappointment, and Sonatype is committed to helping you transition off it seamlessly. If you’d like to retain your data, please export your issues from the web console. |
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
name = pod.Name | ||
} | ||
PodUnavailableBudgetMetrics.WithLabelValues(kind, name, username).Add(1) | ||
recorder.Eventf(pod, corev1.EventTypeWarning, "PubPreventPodDeletion", fmt.Sprintf("openkruise pub prevents pod deletion")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
S1039: unnecessary use of fmt.Sprintf
ℹ️ Expand to see all @sonatype-lift commands
You can reply with the following commands. For example, reply with @sonatype-lift ignoreall to leave out all findings.
Command | Usage |
---|---|
@sonatype-lift ignore |
Leave out the above finding from this PR |
@sonatype-lift ignoreall |
Leave out all the existing findings from this PR |
@sonatype-lift exclude <file|issue|path|tool> |
Exclude specified file|issue|path|tool from Lift findings by updating your config.toml file |
Note: When talking to LiftBot, you need to refresh the page to see its response.
Click here to add LiftBot to another repo.
@@ -55,24 +56,39 @@ const ( | |||
PodRelatedPubAnnotation = "kruise.io/related-pub" | |||
) | |||
|
|||
var ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
consider moving metrics related variables and initialization logic into a separate file e.g. pub_control_metrics.go
|
||
var ( | ||
NamespaceDeletionProtectionMetrics = prometheus.NewGaugeVec( | ||
prometheus.GaugeOpts{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
consider replacing Gauge with Counter, protection metrics will not be decreased
prometheus.GaugeOpts{ | ||
Name: "workload_deletion_protection", | ||
Help: "Workload Deletion Protection", | ||
}, []string{"kind", "name", "username"}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
consider combine workload type, namespace, and name into a single label so as to avoid metrics flood.
@@ -133,7 +129,7 @@ func (c *realControl) Update(cs *appsv1alpha1.CloneSet, | |||
for _, idx := range waitUpdateIndexes { | |||
pod := pods[idx] | |||
// Determine the pub before updating the pod | |||
if utilfeature.DefaultFeatureGate.Enabled(features.PodUnavailableBudgetUpdateGate) { | |||
/*if utilfeature.DefaultFeatureGate.Enabled(features.PodUnavailableBudgetUpdateGate) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why comment out this code block
@zmberg: PR needs rebase. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Ⅰ. Describe what this PR does
Add prometheus for pub and deletion protection.
Add event in pod for pub.