Skip to content
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

Merged
merged 1 commit into from Aug 4, 2023

Conversation

jcantrill
Copy link
Contributor

@jcantrill jcantrill commented Jul 17, 2023

Description

This PR updates dependencies for:

  • kubernetes apis
  • openshift apis
  • operator-sdk
  • go.mod go version
  • controllers to support preferred watch syntax
  • replaces deprecated functions and types

Links

@openshift-ci-robot
Copy link

openshift-ci-robot commented Jul 17, 2023

@jcantrill: This pull request references LOG-3792 which is a valid jira issue.

In response to this:

Description

This PR updates dependencies for:

  • kubernetes apis
  • openshift apis
  • operator-sdk
  • go.mod go version
  • controllers to support preferred watch syntax

Links

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.

@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Jul 17, 2023
@openshift-ci openshift-ci bot requested review from Clee2691 and vimalk78 July 17, 2023 17:56
@openshift-ci openshift-ci bot added the midstream/Dockerfile A Dockerfile.in sync is needed with midstream label Jul 17, 2023
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jul 17, 2023

[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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 17, 2023
@jcantrill jcantrill force-pushed the log3797 branch 2 times, most recently from a92a3ab to 545627f Compare July 21, 2023 19:18
@openshift-ci-robot
Copy link

openshift-ci-robot commented Jul 21, 2023

@jcantrill: This pull request references LOG-3792 which is a valid jira issue.

In response to this:

Description

This PR updates dependencies for:

  • kubernetes apis
  • openshift apis
  • operator-sdk
  • go.mod go version
  • controllers to support preferred watch syntax
  • replaces deprecated functions and types

Links

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.

@jcantrill
Copy link
Contributor Author

/test functional

@Clee2691
Copy link
Contributor

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Jul 25, 2023
@openshift-ci-robot
Copy link

/retest-required

Remaining retests: 0 against base HEAD 123524c and 2 for PR HEAD 41c1732 in total

@openshift-ci-robot
Copy link

/retest-required

Remaining retests: 0 against base HEAD e418bc8 and 1 for PR HEAD 41c1732 in total

@openshift-ci openshift-ci bot removed the lgtm Indicates that a PR is ready to be merged. label Jul 26, 2023
@jcantrill jcantrill force-pushed the log3797 branch 2 times, most recently from 0ec9114 to ca5b8ba Compare July 27, 2023 14:55
@jcantrill
Copy link
Contributor Author

/retest

1 similar comment
@jcantrill
Copy link
Contributor Author

/retest

@jcantrill
Copy link
Contributor Author

/test functional

@jcantrill
Copy link
Contributor Author

/test

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jul 27, 2023

@jcantrill: The /test command needs one or more targets.
The following commands are available to trigger required jobs:

  • /test ci-index-cluster-logging-operator-bundle
  • /test e2e-target
  • /test functional-target
  • /test images
  • /test lint
  • /test unit

The following commands are available to trigger optional jobs:

  • /test e2e-ocp-target-minus-one
  • /test e2e-ocp-target-minus-two
  • /test functional

Use /test all to run all jobs.

In response to this:

/test

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.

@jcantrill
Copy link
Contributor Author

/test all

@jcantrill
Copy link
Contributor Author

/test functional-target

1 similar comment
@jcantrill
Copy link
Contributor Author

/test functional-target

DeleteFunc: func(evt event.DeleteEvent) bool {
return IsElasticsearchRelatedObj(evt.Object)
},
GenericFunc: func(evt event.GenericEvent) bool {
Copy link
Contributor

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{},
Copy link
Contributor

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.

Copy link
Contributor

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...

@@ -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()))
Copy link
Contributor

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

Copy link
Contributor Author

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 Show resolved Hide resolved
}

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
Copy link
Contributor

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(),
Copy link
Contributor

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) {
Copy link
Contributor

@syedriko syedriko Jul 29, 2023

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.

Copy link
Contributor Author

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

Copy link
Contributor

@syedriko syedriko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please see inline

@jcantrill jcantrill force-pushed the log3797 branch 3 times, most recently from 8ca88e8 to 8041539 Compare August 3, 2023 18:11
@@ -2,7 +2,4 @@ module _ // Auto generated by https://github.com/bwplotka/bingo. DO NOT EDIT

go 1.14
Copy link
Contributor

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?

Copy link
Contributor Author

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{}},
Copy link
Contributor

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.

@jcantrill
Copy link
Contributor Author

/test functional-target

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Aug 4, 2023

@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.

@syedriko
Copy link
Contributor

syedriko commented Aug 4, 2023

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Aug 4, 2023
@openshift-merge-robot openshift-merge-robot merged commit c151f6e into openshift:master Aug 4, 2023
10 checks passed
@jcantrill jcantrill deleted the log3797 branch August 4, 2023 20:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. lgtm Indicates that a PR is ready to be merged. midstream/Dockerfile A Dockerfile.in sync is needed with midstream release/5.8
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants