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
LOG-3792: Update operator dependencies for kubernetes #2095
Conversation
@jcantrill: This pull request references LOG-3792 which is a valid jira issue. In response to this:
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. |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: jcantrill The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
a92a3ab
to
545627f
Compare
@jcantrill: This pull request references LOG-3792 which is a valid jira issue. In response to this:
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. |
/test functional |
/lgtm |
0ec9114
to
ca5b8ba
Compare
/retest |
1 similar comment
/retest |
/test functional |
/test |
@jcantrill: The
The following commands are available to trigger optional jobs:
Use In response to this:
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. |
/test all |
/test functional-target |
1 similar comment
/test functional-target |
DeleteFunc: func(evt event.DeleteEvent) bool { | ||
return IsElasticsearchRelatedObj(evt.Object) | ||
}, | ||
GenericFunc: func(evt event.GenericEvent) bool { |
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.
We can drop the evt here
Owns(&corev1.ServiceAccount{}). | ||
Owns(&appsv1.Deployment{}). | ||
Owns(&appsv1.DaemonSet{}). | ||
Owns(&corev1.Secret{}, |
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.
I think we need to keep the old Watches() stanza for the Elastic Secrets or else we end up with
Owns(&corev1.Secret{}).
...
Owns(&corev1.Secret{}, builder.WithPredicates(...
where the first Owns() subsumes all the events of the second.
CL doesn't own the Elastic Secrets and the old Watches() caters to that.
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.
@jcantrill I think this is important to address...
internal/utils/utils.go
Outdated
@@ -263,15 +265,15 @@ func WriteToWorkingDirFile(toFile string, value []byte) error { | |||
} | |||
|
|||
func init() { | |||
rand.Seed(time.Now().UnixNano()) | |||
rgen = rand.New(rand.NewSource(time.Now().UnixNano())) |
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.
we actively do not want this: "this source is not safe for concurrent use"
https://pkg.go.dev/math/rand#NewSource
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.
Moved into test/helpers given we no longer use this (was used for Logstore) but I do not think it matters. We are not relying on any consistently generated "Random" name
internal/utils/utils.go
Outdated
} | ||
|
||
var letters = []rune("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789") | ||
|
||
func GetRandomWord(wordSize int) []byte { | ||
b := make([]rune, wordSize) | ||
for i := range b { | ||
b[i] = letters[rand.Intn(len(letters))] //nolint:gosec | ||
b[i] = letters[rgen.Intn(len(letters))] //nolint:gosec |
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.
Since Go 1.20, we can just call rand.Intn()
. There's no longer a need to manually seed the generator: https://cs.opensource.google/go/go/+/refs/tags/go1.20.6:src/math/rand/rand.go;l=306-313
@@ -70,7 +70,7 @@ func (f *CollectorFunctionalFramework) GetLogStreamsByGroup(client *cwl.Client, | |||
myStreams []string | |||
logStreamsOutput *cwl.DescribeLogStreamsOutput | |||
) | |||
err := wait.PollImmediate(defaultRetryInterval, f.GetMaxReadDuration(), func() (done bool, err error) { | |||
err := wait.PollUntilContextTimeout(context.TODO(), defaultRetryInterval, f.GetMaxReadDuration(), true, func(cxt context.Context) (done bool, err error) { | |||
// TODO: need to query for log group or get more log group info above | |||
logStreamsOutput, err = client.DescribeLogStreams( | |||
context.TODO(), |
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.
context.TODO() -> cxt
@@ -179,8 +180,7 @@ func (r *Receiver) Query(logQL string, orgID string, limit int) ([]StreamValues, | |||
// QueryUntil repeats the query until at least n lines are received. | |||
func (r *Receiver) QueryUntil(logQL string, orgID string, n int) (values []StreamValues, err error) { |
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.
Might want to add context.Context to the Query() method and pass it on to the http request like above. For direct calls to Query(), call Query(context.TODO()...), there're only three places its called from.
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.
I find 13. This change is primary meant to update dependencies and remove dead code. I'd like to limit the scope as much as possible
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.
Please see inline
8ca88e8
to
8041539
Compare
@@ -2,7 +2,4 @@ module _ // Auto generated by https://github.com/bwplotka/bingo. DO NOT EDIT | |||
|
|||
go 1.14 |
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.
Does this need an update to 1.20?
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.
All our tests pass so doesn't look critical
Owns(&corev1.ServiceAccount{}). | ||
Owns(&appsv1.Deployment{}). | ||
Owns(&appsv1.DaemonSet{}). | ||
Watches(&source.Kind{Type: &corev1.Secret{}}, |
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.
I think we still need an Owns(&rbacv1.Secret{})
so we receive events for the Secrets that CL owns.
/test functional-target |
@jcantrill: all tests passed! Full PR test history. Your PR dashboard. 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. I understand the commands that are listed here. |
/lgtm |
Description
This PR updates dependencies for:
Links