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

Add events recorder framework #632

Merged
merged 1 commit into from
Apr 18, 2022

Conversation

Prajyot-Parab
Copy link
Contributor

Signed-off-by: Prajyot-Parab [email protected]

What this PR does / why we need it:

  • Add events recorder framework

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Fixes #547

Special notes for your reviewer:

/area provider/ibmcloud

  1. Please confirm that if this PR changes any image versions, then that's the sole change this PR makes.

Release note:

Add events recorder framework

@k8s-ci-robot k8s-ci-robot added the area/provider/ibmcloud Issues or PRs related to ibmcloud provider label Apr 13, 2022
@netlify
Copy link

netlify bot commented Apr 13, 2022

Deploy Preview for kubernetes-sigs-cluster-api-ibmcloud ready!

Name Link
🔨 Latest commit c07f7c5
🔍 Latest deploy log https://app.netlify.com/sites/kubernetes-sigs-cluster-api-ibmcloud/deploys/625d3044a8ab31000875ec05
😎 Deploy Preview https://deploy-preview-632--kubernetes-sigs-cluster-api-ibmcloud.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@k8s-ci-robot k8s-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Apr 13, 2022
@k8s-triage-robot
Copy link

Unknown CLA label state. Rechecking for CLA labels.

Send feedback to sig-contributor-experience at kubernetes/community.

/check-cla
/easycla

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Apr 13, 2022
Copy link
Member

@mkumatag mkumatag left a comment

Choose a reason for hiding this comment

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

Overall approach lgmt, need few changes:

  • I see the even reason now are more generic like FailedCreate or SuccessfulCreate, it will be good if we have specific reasons e.g FailedCreateVPC or SuccessfulCreateVPC for the VPC resources.
  • Add fake recorder and add enhance the existing test cases to expect the records.

@@ -102,10 +103,12 @@ func (s *ClusterScope) CreateVPC() (*vpcv1.VPC, error) {
options.SetName(s.IBMVPCCluster.Spec.VPC)
vpc, _, err := s.IBMVPCClients.VPCService.CreateVPC(options)
if err != nil {
record.Warnf(s.IBMVPCCluster, "FailedCreate", "Failed vpc creation - %v", err)
return nil, err
} else if err := s.updateDefaultSG(*vpc.DefaultSecurityGroup.ID); err != nil {
return nil, err
Copy link
Member

Choose a reason for hiding this comment

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

Need Warnf for this failure as well

Copy link
Contributor Author

Choose a reason for hiding this comment

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

  1. Added Warnf for above failure.
  2. Updated record reasons to be more specific.

How about we merge this version of the code and add fake recorder + enhance test cases as part of another PR?

Copy link
Member

Choose a reason for hiding this comment

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

better to write test cases with the code itself, for this case we can add later

Copy link
Member

@mkumatag mkumatag left a comment

Choose a reason for hiding this comment

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

I feel overall there can be more Success condition can be added, have that said - this looks good for the initial version. Please fix all the comment and merge this code.

cloud/scope/powervs_image.go Show resolved Hide resolved
cloud/scope/powervs_image.go Outdated Show resolved Hide resolved
cloud/scope/powervs_image.go Outdated Show resolved Hide resolved
cloud/scope/powervs_image.go Outdated Show resolved Hide resolved
cloud/scope/powervs_image.go Outdated Show resolved Hide resolved
@@ -102,10 +103,12 @@ func (s *ClusterScope) CreateVPC() (*vpcv1.VPC, error) {
options.SetName(s.IBMVPCCluster.Spec.VPC)
vpc, _, err := s.IBMVPCClients.VPCService.CreateVPC(options)
if err != nil {
record.Warnf(s.IBMVPCCluster, "FailedCreate", "Failed vpc creation - %v", err)
return nil, err
} else if err := s.updateDefaultSG(*vpc.DefaultSecurityGroup.ID); err != nil {
return nil, err
Copy link
Member

Choose a reason for hiding this comment

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

better to write test cases with the code itself, for this case we can add later

Signed-off-by: Prajyot-Parab <[email protected]>
Copy link
Member

@mkumatag mkumatag left a comment

Choose a reason for hiding this comment

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

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Apr 18, 2022
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: mkumatag, Prajyot-Parab

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

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Apr 18, 2022
@k8s-ci-robot k8s-ci-robot merged commit 2cb8de9 into kubernetes-sigs:main Apr 18, 2022
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. area/provider/ibmcloud Issues or PRs related to ibmcloud provider cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add events recorder framework for recording the events to the resources like errors, warning, info
4 participants