-
Notifications
You must be signed in to change notification settings - Fork 759
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: Remove crashOnFailureFetchingExpectations flag #3453
Changes from 2 commits
c340a30
003ec99
15b4f45
2a18f78
0a818a0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,7 +17,6 @@ package readiness | |
|
||
import ( | ||
"context" | ||
"flag" | ||
"fmt" | ||
"net/http" | ||
"sync" | ||
|
@@ -46,7 +45,9 @@ import ( | |
|
||
var log = logf.Log.WithName("readiness-tracker") | ||
|
||
var crashOnFailureFetchingExpectations = flag.Bool("crash-on-failure-fetching-expectations", false, "Unless set (defaults to false), gatekeeper will ignore errors that occur when gathering expectations. This prevents bootstrapping errors from crashing Gatekeeper at the cost of increasing the risk Gatekeeper will under-enforce policy by serving before it has loaded in all policies. Enabling this will help prevent under-enforcement at the risk of crashing during startup for issues like network errors. Note that enabling this flag currently does not achieve the aforementioned effect since fetching expectations are set to retry until success so failures during fetching expectations currently do not occur.") | ||
// Commenting out the flag and replacing with a false boolean constant because the value of the flag is currently moot without a retry limit | ||
// var crashOnFailureFetchingExpectations = flag.Bool("crash-on-failure-fetching-expectations", false, "Unless set (defaults to false), gatekeeper will ignore errors when gathering expectations. This prevents bootstrapping errors from crashing Gatekeeper at the cost of increasing the risk Gatekeeper will under-enforce policy. Enabling this will help prevent under-enforcement at the risk of crashing during startup. Note that enabling this flag currently does not achieve the aforementioned effect since fetching expectations will retry until success.") | ||
const crashOnFailureFetchingExpectations = false | ||
|
||
const ( | ||
constraintGroup = "constraints.gatekeeper.sh" | ||
|
@@ -90,7 +91,8 @@ type Tracker struct { | |
|
||
// NewTracker creates a new Tracker and initializes the internal trackers. | ||
func NewTracker(lister Lister, mutationEnabled, externalDataEnabled, expansionEnabled bool) *Tracker { | ||
return newTracker(lister, mutationEnabled, externalDataEnabled, expansionEnabled, *crashOnFailureFetchingExpectations, nil, nil) | ||
// Dereference crashOnFailureFetchingExpectations when we change crashOnFailureFetchingExpectations back to a flag | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As a result of how I set crashOnFailureFetchingExpectations above, I added a comment to change this when we switch back to a flag, but maybe I need to add a TODO? not sure if just a comment is sufficient. @maxsmythe There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add a TODO as a comment and open issue to track so we remember to add the flag back would be great! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done. Is a plain TODO sufficient or is there a way to reference/embed an issue to it. Here is the issue I created: #3460 |
||
return newTracker(lister, mutationEnabled, externalDataEnabled, expansionEnabled, crashOnFailureFetchingExpectations, nil, nil) | ||
} | ||
|
||
func newTracker(lister Lister, mutationEnabled, externalDataEnabled, expansionEnabled bool, crashOnFailure bool, trackListerPredicateOverride retryPredicate, fn objDataFactory) *Tracker { | ||
|
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.
Can't do &false. I could do something like
var falseValue = false
var crashOnFailureFetchingExpectations = &falseValue, but seemed unnecessary