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

✨ Switch zap log for global hub agent #1184

Merged
merged 12 commits into from
Oct 29, 2024

Conversation

yanmxa
Copy link
Member

@yanmxa yanmxa commented Oct 25, 2024

Summary

Related issue(s)

Fixes # #1178, https://issues.redhat.com/browse/ACM-13421

  1. Configure the LogLevel at runtime!
  2. Integrate the log format with the third part library - cloudevents, and controller-runtime
  3. The underlayer is based on Zap Logger and SugarLogger, we also provide the zapr if you use the logr interface.
  4. The manifestwork only updates the configmap, the agent deployment will not be updated. Let the operator read the config and propagate it to the configmap in the manifest
  5. Format
2024-10-29T03:43:41.290Z        INFO    utils/utils.go:28       Go OS/Arch: linux/amd64
2024-10-29T03:43:41.290Z        INFO    utils/utils.go:29       Go Version: go1.22.5
2024-10-29T03:43:41.290Z        INFO    utils/utils.go:30       Git Commit: b46e471c
2024-10-29T03:43:41.313Z        INFO    controller-runtime.metrics      server/server.go:208    Starting metrics server
I1029 03:43:41.313460       1 leaderelection.go:254] attempting to acquire leader lease multicluster-global-hub-agent/multicluster-global-hub-agent-lock...
2024-10-29T03:43:41.313Z        INFO    controller-runtime.metrics      server/server.go:247    Serving metrics server  {"bindAddress": "0.0.0.0:8384", "secure": false}
I1029 03:43:41.317722       1 leaderelection.go:268] successfully acquired lease multicluster-global-hub-agent/multicluster-global-hub-agent-lock
2024-10-29T03:43:41.318Z        INFO    controller/controller.go:175    Starting EventSource    {"controller": "secret", "controllerGroup": "", "controllerKind": "Secret", "source": "kind source: *v1.Secret"}
2024-10-29T03:43:41.318Z        INFO    controller/controller.go:183    Starting Controller     {"controller": "secret", "controllerGroup": "", "controllerKind": "Secret"}
2024-10-29T03:43:41.521Z        INFO    controller/controller.go:217    Starting workers        {"controller": "secret", "controllerGroup": "", "controllerKind": "Secret", "worker count": 1}
2024-10-29T03:43:41.521Z        INFO    kafka-consumer  consumer/generic_consumer.go:84 transport consumer with cloudevents-kafka receiver
2024-10-29T03:43:41.525Z        INFO    cloudevents     [email protected]/protocol.go:166   Subscribing to topics: [gh-spec]
2024-10-29T03:43:41.526Z        INFO    cmd/main.go:240 add the init controller to manager

We can see the cloudevents, controller runtime is the same as the format we set. But the lease still uses the klog, which we won't update in this PR. Visit here for more detail about that: kubernetes-sigs/controller-runtime#2656, kubernetes/enhancements#3077

Tests

  • Unit/function tests have been added and incorporated into make unit-tests.
  • Integration tests have been added and incorporated into make integration-test.
  • E2E tests have been added and incorporated into make e2e-test-all.
  • List other manual tests you have done.

Signed-off-by: myan <[email protected]>
@yanmxa
Copy link
Member Author

yanmxa commented Oct 28, 2024

the environment isn't ready, re run it

/test e2e-test

Copy link

openshift-ci bot commented Oct 28, 2024

@yanmxa: The specified target(s) for /test were not found.
The following commands are available to trigger required jobs:

  • /test gofmt
  • /test images
  • /test sonarcloud
  • /test test-e2e
  • /test test-integration
  • /test test-unit

Use /test all to run all jobs.

In response to this:

the environment isn't ready, re run it

/test e2e-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-sigs/prow repository.

@yanmxa
Copy link
Member Author

yanmxa commented Oct 28, 2024

/test test-e2e

@yanmxa
Copy link
Member Author

yanmxa commented Oct 28, 2024

/override ci/prow/sonarcloud

Copy link

openshift-ci bot commented Oct 28, 2024

@yanmxa: Overrode contexts on behalf of yanmxa: ci/prow/sonarcloud

In response to this:

/override ci/prow/sonarcloud

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-sigs/prow repository.

@yanmxa
Copy link
Member Author

yanmxa commented Oct 28, 2024

setup error

/test test-e2e

@yanmxa
Copy link
Member Author

yanmxa commented Oct 29, 2024

database isn't ready

/test test-e2e

@yanmxa
Copy link
Member Author

yanmxa commented Oct 29, 2024

the kafka cluster is not created

/test test-e2e

Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
61.8% Coverage on New Code (required ≥ 70%)

See analysis details on SonarCloud

@yanmxa
Copy link
Member Author

yanmxa commented Oct 29, 2024

/override ci/prow/sonarcloud

Copy link

openshift-ci bot commented Oct 29, 2024

@yanmxa: Overrode contexts on behalf of yanmxa: ci/prow/sonarcloud

In response to this:

/override ci/prow/sonarcloud

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-sigs/prow repository.

@yanmxa
Copy link
Member Author

yanmxa commented Oct 29, 2024

/cc @clyang82 @ldpliu

@openshift-ci openshift-ci bot requested review from clyang82 and ldpliu October 29, 2024 04:24
enableLocalPolicies: "{{ .EnableLocalPolicies }}"
logLevel: {{.LogLevel}}
Copy link
Contributor

Choose a reason for hiding this comment

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

where is LogLevel from? I do not see any changes in agent controller to set this value.

Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link
Contributor

@clyang82 clyang82 left a comment

Choose a reason for hiding this comment

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

Need to have a document about how to change the log level in the runtime environment

@yanmxa
Copy link
Member Author

yanmxa commented Oct 29, 2024

Need to have a document about how to change the log level in the runtime environment

Add the document in this pr: #1188

@clyang82
Copy link
Contributor

/lgtm

Copy link

openshift-ci bot commented Oct 29, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: clyang82, yanmxa

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-merge-bot openshift-merge-bot bot merged commit 93d0563 into stolostron:main Oct 29, 2024
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants