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

Drop deprecated module and fix tests #3114

Merged
merged 1 commit into from
Jan 1, 2024
Merged

Conversation

hdkshingala
Copy link
Contributor

@hdkshingala hdkshingala commented Jan 1, 2024

Summary by CodeRabbit

  • New Features

    • Introduced a retry_policy configuration for improved object storage reliability with customizable timeout and backoff settings.
  • Refactor

    • Transitioned to a new utility library for pointer operations across the codebase to enhance maintainability.
  • Bug Fixes

    • Ensured consistency in pointer operations to prevent potential configuration issues in Kubernetes resources.

@hdkshingala hdkshingala requested review from a team as code owners January 1, 2024 08:07
Copy link
Contributor

coderabbitai bot commented Jan 1, 2024

Walkthrough

The overarching change across multiple files involves updating the import path and function calls from an older package k8s.io/utils/pointer to a newer k8s.io/utils/ptr. This change requires the corresponding update of function calls, such as converting pointer.Int(0) to ptr.To(0). Additionally, a retry_policy configuration has been introduced in the config_test.tpl for object_storage.

Changes

Files Change Summary
cmd/aperturectl/.../radio-button.go
operator/controllers/.../*.go
operator/controllers/.../*_test.go
Updated import path from k8s.io/utils/pointer to k8s.io/utils/ptr and modified function calls accordingly.
operator/controllers/agent/config_test.tpl Added retry_policy configuration under object_storage.

🐇
In the realm of code where changes bound,
From pointer to ptr, our paths are sound.
With To we call, to set our aim,
In Kubernetes' dance, a new name to claim.
🌟🚀🌟


Tips

Chat with CodeRabbit Bot (@coderabbitai)

  • You can directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit-tests for this file.
  • You can tag CodeRabbit on specific lines of code or entire files in the PR by tagging @coderabbitai in a comment. Examples:
    • @coderabbitai generate unit tests for this file.
    • @coderabbitai modularize this function.
  • You can tag @coderabbitai in a PR comment and ask questions about the PR and the codebase. Examples:
    • @coderabbitai generate interesting stats about this repository from git and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit tests.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid.
    • @coderabbitai read the files in the src/scheduler package and generate README in the markdown format.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • The JSON schema for the configuration file is available here.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/coderabbit-overrides.v2.json

CodeRabbit Discord Community

Join our Discord Community to get help, request features, and share feedback.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 2d93d7d and 89a54e4.
Files selected for processing (27)
  • cmd/aperturectl/cmd/tui/radio-button.go (2 hunks)
  • operator/controllers/agent/config_test.tpl (1 hunks)
  • operator/controllers/agent/configmaps_test.go (2 hunks)
  • operator/controllers/agent/daemonset.go (2 hunks)
  • operator/controllers/agent/daemonset_test.go (9 hunks)
  • operator/controllers/agent/deployment.go (3 hunks)
  • operator/controllers/agent/deployment_test.go (9 hunks)
  • operator/controllers/agent/mutating_webhook_configuration.go (3 hunks)
  • operator/controllers/agent/mutating_webhook_configuration_test.go (3 hunks)
  • operator/controllers/agent/secrets_test.go (3 hunks)
  • operator/controllers/agent/serviceaccount_test.go (3 hunks)
  • operator/controllers/agent/services_test.go (3 hunks)
  • operator/controllers/controller/configmaps_test.go (2 hunks)
  • operator/controllers/controller/deployment.go (2 hunks)
  • operator/controllers/controller/deployment_test.go (10 hunks)
  • operator/controllers/controller/secrets_test.go (3 hunks)
  • operator/controllers/controller/serviceaccount_test.go (3 hunks)
  • operator/controllers/controller/services_test.go (3 hunks)
  • operator/controllers/controller/validating_webhook_configuration.go (3 hunks)
  • operator/controllers/controller/validating_webhook_configuration_test.go (6 hunks)
  • operator/controllers/mutate_func_test.go (4 hunks)
  • operator/controllers/mutatingwebhook/agent_pod_test.go (6 hunks)
  • operator/controllers/mutatingwebhook/mutating_webhook_configuration.go (5 hunks)
  • operator/controllers/mutatingwebhook/mutating_webhook_configuration_test.go (5 hunks)
  • operator/controllers/mutatingwebhook/reconciler_test.go (3 hunks)
  • operator/controllers/utils.go (9 hunks)
  • operator/controllers/utils_test.go (11 hunks)
Files skipped from review due to trivial changes (9)
  • operator/controllers/agent/config_test.tpl
  • operator/controllers/agent/mutating_webhook_configuration.go
  • operator/controllers/agent/mutating_webhook_configuration_test.go
  • operator/controllers/controller/configmaps_test.go
  • operator/controllers/controller/validating_webhook_configuration.go
  • operator/controllers/mutatingwebhook/agent_pod_test.go
  • operator/controllers/mutatingwebhook/mutating_webhook_configuration.go
  • operator/controllers/mutatingwebhook/mutating_webhook_configuration_test.go
  • operator/controllers/mutatingwebhook/reconciler_test.go
Additional comments: 90
cmd/aperturectl/cmd/tui/radio-button.go (2)
  • 7-7: The update of the import path from "k8s.io/utils/pointer" to "k8s.io/utils/ptr" is correct and aligns with the PR objectives.

  • 23-23: The change from pointer.Int(0) to ptr.To(0) in the InitialRadioButtonModel function is correct and aligns with the PR objectives.

operator/controllers/agent/secrets_test.go (3)
  • 28-28: The update of the import path from "k8s.io/utils/pointer" to "k8s.io/utils/ptr" is correct and aligns with the PR objectives.

  • 69-70: The changes from pointer.Bool(true) to ptr.To(true) for the Controller and BlockOwnerDeletion fields in the test case are correct and align with the PR objectives.

  • 125-126: The changes from pointer.Bool(true) to ptr.To(true) for the Controller and BlockOwnerDeletion fields in the test case are correct and align with the PR objectives.

operator/controllers/agent/serviceaccount_test.go (5)
  • 26-26: The update of the import path from "k8s.io/utils/pointer" to "k8s.io/utils/ptr" is correct and aligns with the PR objectives.

  • 66-67: The changes from pointer.Bool(true) to ptr.To(true) for the Controller and BlockOwnerDeletion fields in the test case are correct and align with the PR objectives.

  • 71-71: The change from pointer.Bool(true) to ptr.To(true) for the AutomountServiceAccountToken field in the test case is correct and aligns with the PR objectives.

  • 121-122: The changes from pointer.Bool(true) to ptr.To(true) for the Controller and BlockOwnerDeletion fields in the test case are correct and align with the PR objectives.

  • 126-126: The change from pointer.Bool(false) to ptr.To(false) for the AutomountServiceAccountToken field in the test case is correct and aligns with the PR objectives.

operator/controllers/controller/serviceaccount_test.go (5)
  • 26-26: The update of the import path from "k8s.io/utils/pointer" to "k8s.io/utils/ptr" is correct and aligns with the PR objectives.

  • 65-66: The changes from pointer.Bool(true) to ptr.To(true) for the Controller and BlockOwnerDeletion fields in the test case are correct and align with the PR objectives.

  • 70-70: The change from pointer.Bool(true) to ptr.To(true) for the AutomountServiceAccountToken field in the test case is correct and aligns with the PR objectives.

  • 120-121: The changes from pointer.Bool(true) to ptr.To(true) for the Controller and BlockOwnerDeletion fields in the test case are correct and align with the PR objectives.

  • 125-125: The change from pointer.Bool(true) to ptr.To(false) for the AutomountServiceAccountToken field in the test case is correct and aligns with the PR objectives.

operator/controllers/agent/configmaps_test.go (2)
  • 32-32: The update of the import path from "k8s.io/utils/pointer" to "k8s.io/utils/ptr" is correct and aligns with the PR objectives.

  • 146-147: The changes from pointer.Bool(true) to ptr.To(true) for the Controller and BlockOwnerDeletion fields in the test case are correct and align with the PR objectives.

operator/controllers/controller/services_test.go (3)
  • 29-29: The update of the import path from "k8s.io/utils/pointer" to "k8s.io/utils/ptr" is correct and aligns with the PR objectives.

  • 74-75: The changes from pointer.Bool(true) to ptr.To(true) for the Controller and BlockOwnerDeletion fields in the test case are correct and align with the PR objectives.

  • 152-153: The changes from pointer.Bool(true) to ptr.To(true) for the Controller and BlockOwnerDeletion fields in the test case are correct and align with the PR objectives.

operator/controllers/controller/secrets_test.go (3)
  • 29-29: The import statement has been correctly updated from k8s.io/utils/pointer to k8s.io/utils/ptr. This change aligns with the PR objectives to replace the deprecated module.

  • 70-71: The usage of ptr.To(true) for the Controller and BlockOwnerDeletion fields in the OwnerReferences is correct and follows the new ptr package API.

  • 126-127: The usage of ptr.To(true) for the Controller and BlockOwnerDeletion fields in the OwnerReferences is correct and follows the new ptr package API.

operator/controllers/mutate_func_test.go (4)
  • 28-28: The import statement has been correctly updated from k8s.io/utils/pointer to k8s.io/utils/ptr. This change aligns with the PR objectives to replace the deprecated module.

  • 107-107: The usage of ptr.To[int32](10) for the TimeoutSeconds field in the MutatingWebhookConfiguration is correct and follows the new ptr package API.

  • 147-147: The usage of ptr.To(true) for the AutomountServiceAccountToken field in the ServiceAccount is correct and follows the new ptr package API.

  • 204-204: The usage of ptr.To[int32](10) for the TimeoutSeconds field in the ValidatingWebhookConfiguration is correct and follows the new ptr package API.

operator/controllers/agent/services_test.go (3)
  • 27-27: The import statement has been correctly updated from k8s.io/utils/pointer to k8s.io/utils/ptr. This change aligns with the PR objectives to replace the deprecated module.

  • 79-80: The usage of ptr.To(true) for the Controller and BlockOwnerDeletion fields in the OwnerReferences is correct and follows the new ptr package API.

  • 174-175: The usage of ptr.To(true) for the Controller and BlockOwnerDeletion fields in the OwnerReferences is correct and follows the new ptr package API.

operator/controllers/agent/daemonset.go (2)
  • 31-31: The import statement has been correctly updated from k8s.io/utils/pointer to k8s.io/utils/ptr. This change aligns with the PR objectives to replace the deprecated module.

  • 95-95: The usage of ptr.To[int64](spec.TerminationGracePeriodSeconds) for the TerminationGracePeriodSeconds field in the PodSpec is correct and follows the new ptr package API.

operator/controllers/controller/deployment.go (2)
  • 31-31: The import statement has been correctly updated to use the new ptr package.

  • 95-95: The usage of ptr.To[int64] correctly follows the new ptr package's API for creating a pointer to an int64 value.

operator/controllers/agent/deployment.go (3)
  • 31-31: The import statement has been correctly updated to use the new ptr package.

  • 79-79: The usage of ptr.To[int32] correctly follows the new ptr package's API for creating a pointer to an int32 value.

  • 98-98: The usage of ptr.To[int64] correctly follows the new ptr package's API for creating a pointer to an int64 value.

operator/controllers/controller/validating_webhook_configuration_test.go (6)
  • 27-27: The import statement has been correctly updated to use the new ptr package.

  • 80-81: The usage of ptr.To for the Path field and ptr.To[int32] for the Port field correctly follows the new ptr package's API.

  • 104-104: The usage of ptr.To[int32] for the TimeoutSeconds field correctly follows the new ptr package's API.

  • 166-167: The usage of ptr.To for the Path field and ptr.To[int32] for the Port field correctly follows the new ptr package's API.

  • 190-190: The usage of ptr.To[int32] for the TimeoutSeconds field correctly follows the new ptr package's API.

  • 224-224: The usage of ptr.To[int32] for the TimeoutSeconds field correctly follows the new ptr package's API.

operator/controllers/agent/daemonset_test.go (7)
  • 29-29: The import statement has been correctly updated to use the new ptr package.

  • 151-152: The usage of ptr.To(true) for the Controller and BlockOwnerDeletion fields is correct and follows the new ptr package API.

  • 177-177: The usage of ptr.To[int64](0) for the TerminationGracePeriodSeconds field is correct and follows the new ptr package API.

  • 268-268: The usage of ptr.To[int32](420) for the DefaultMode field is correct and follows the new ptr package API.

  • 449-449: The usage of ptr.To[int64](1001) for the FSGroup field is correct and follows the new ptr package API.

  • 463-466: The usage of ptr.To for the RunAsUser, RunAsGroup, RunAsNonRoot, and ReadOnlyRootFilesystem fields is correct and follows the new ptr package API.

  • 649-649: The usage of ptr.To[int64](1001) for the FSGroup field within the Mutate function is correct and follows the new ptr package API.

operator/controllers/agent/deployment_test.go (10)
  • 29-29: The import statement has been correctly updated to use the new ptr package.

  • 155-156: The replacement of pointer.Bool(true) with ptr.To(true) is correct and follows the new ptr package API for creating boolean pointers.

  • 162-162: The replacement of pointer.Int32(1) with ptr.To[int32](1) is correct and follows the new ptr package API for creating integer pointers.

  • 184-184: The replacement of pointer.Int64(0) with ptr.To[int64](0) is correct and follows the new ptr package API for creating integer pointers.

  • 271-271: The replacement of pointer.Int32(420) with ptr.To[int32](420) is correct and follows the new ptr package API for creating integer pointers.

  • 460-460: The replacement of pointer.Int64(1001) with ptr.To[int64](1001) is correct and follows the new ptr package API for creating integer pointers.

  • 462-462: The replacement of pointer.Int64(10) with ptr.To[int64](10) is correct and follows the new ptr package API for creating integer pointers.

  • 474-477: The replacement of pointer functions with ptr.To for the SecurityContext fields is correct and follows the new ptr package API for creating pointers of various types.

  • 616-616: The replacement of pointer.Int32(420) with ptr.To[int32](420) is consistent with the previous hunk and is correct.

  • 661-661: The replacement of pointer.Int64(1001) with ptr.To[int64](1001) is consistent with the previous hunk and is correct.

operator/controllers/controller/deployment_test.go (11)
  • 31-31: The import statement has been correctly updated to use the new ptr package instead of the deprecated pointer package.

  • 154-155: The use of ptr.To(true) is correct and follows the new ptr package API for creating pointers to literals.

  • 263-263: The update from pointer.Int32(420) to ptr.To[int32](420) is correct and follows the new ptr package API for creating pointers to integer literals.

  • 274-274: The update from pointer.Int32(420) to ptr.To[int32](420) is correct and follows the new ptr package API for creating pointers to integer literals.

  • 416-417: The use of ptr.To(true) is consistent with the changes in Hunk 2 and is correct according to the new ptr package API.

  • 455-455: The update from pointer.Int64(1001) to ptr.To[int64](1001) is correct and follows the new ptr package API for creating pointers to integer literals.

  • 457-457: The update from pointer.Int64(10) to ptr.To[int64](10) is correct and follows the new ptr package API for creating pointers to integer literals.

  • 469-472: The updates to RunAsUser, RunAsGroup, RunAsNonRoot, and ReadOnlyRootFilesystem fields are correct and follow the new ptr package API for creating pointers to the respective types.

  • 601-601: The update from pointer.Int32(420) to ptr.To[int32](420) is correct and follows the new ptr package API for creating pointers to integer literals.

  • 612-612: The update from pointer.Int32(420) to ptr.To[int32](420) is correct and follows the new ptr package API for creating pointers to integer literals.

  • 653-653: The update from pointer.Int64(1001) to ptr.To[int64](1001) is correct and follows the new ptr package API for creating pointers to integer literals.

operator/controllers/utils.go (8)
  • 45-45: The import statement has been correctly updated to use the new ptr package.

  • 60-63: The pointer conversion functions have been correctly updated to use the new ptr package syntax.

  • 77-77: The pointer conversion for FSGroup has been correctly updated to use the new ptr package syntax.

  • 257-257: The pointer conversion for the Optional field in corev1.EnvVar has been correctly updated to use the new ptr package syntax.

  • 294-294: The pointer conversion for DefaultMode in corev1.ConfigMapVolumeSource has been correctly updated to use the new ptr package syntax.

  • 349-349: The pointer conversion for the Optional field in corev1.EnvVar has been correctly updated to use the new ptr package syntax.

  • 382-382: The pointer conversion for DefaultMode in corev1.ConfigMapVolumeSource has been correctly updated to use the new ptr package syntax.

  • 393-393: The pointer conversion for DefaultMode in corev1.SecretVolumeSource has been correctly updated to use the new ptr package syntax.

operator/controllers/utils_test.go (11)
  • 30-30: The import path for the pointer utility has been updated to use the new ptr package.

  • 80-83: The usage of ptr.To from the k8s.io/utils/ptr package is correct and replaces the deprecated pointer package functions.

  • 132-132: The usage of ptr.To for FSGroup in corev1.PodSecurityContext is correct and follows the same pattern as the previous hunk.

  • 644-644: The Optional field in corev1.SecretKeySelector is correctly set using ptr.To. This ensures that the Optional field is explicitly set, which is a good practice for clarity.

  • 784-784: The DefaultMode for corev1.ConfigMapVolumeSource is correctly set using ptr.To. This change is consistent with the new ptr package usage.

  • 830-830: The DefaultMode for another corev1.ConfigMapVolumeSource is set using ptr.To, which is consistent with the changes made throughout the file.

  • 890-890: The Optional field in corev1.SecretKeySelector is set using ptr.To, similar to the change in Hunk 4, which is correct.

  • 1031-1031: The DefaultMode for corev1.ConfigMapVolumeSource is set using ptr.To, which is consistent with the changes made in the AgentVolumes function.

  • 1042-1042: The DefaultMode for corev1.SecretVolumeSource is set using ptr.To, which is consistent with the changes made in the AgentVolumes function for config maps.

  • 1086-1086: The DefaultMode for another corev1.ConfigMapVolumeSource is set using ptr.To, which is consistent with the changes made throughout the file.

  • 1097-1097: The DefaultMode for another corev1.SecretVolumeSource is set using ptr.To, which is consistent with the changes made throughout the file.

@hdkshingala hdkshingala merged commit ab4e6ed into main Jan 1, 2024
21 checks passed
@hdkshingala hdkshingala deleted the drop-deprecated-function branch January 1, 2024 09:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants