Skip to content

Comments

Refactor: move Python SDK constants to a dedicated file and add PodSnapshot constants#337

Open
shrutiyam-glitch wants to merge 2 commits intokubernetes-sigs:mainfrom
shrutiyam-glitch:sdk_small_refactor
Open

Refactor: move Python SDK constants to a dedicated file and add PodSnapshot constants#337
shrutiyam-glitch wants to merge 2 commits intokubernetes-sigs:mainfrom
shrutiyam-glitch:sdk_small_refactor

Conversation

@shrutiyam-glitch
Copy link
Contributor

This PR refactors the Python SDK by extracting API-related constants into a new constants.py file and adding definitions for the PodSnapshot API.

Changes:

  • Created constants.py: Centralized API group, version, and resource constants for better maintainability.
  • Added PodSnapshot constants: Introduced constants for podsnapshot.gke.io and managed snapshot namespaces.
  • Refactored sandbox_client.py: Removed inline constant definitions and replaced them with a wildcard import from the new constants module to keep the client code clean.

Why this is needed:
Moving constants to a dedicated file improves code organization, reduces duplication, and makes these values easily reusable across other components of the python package.

@netlify
Copy link

netlify bot commented Feb 21, 2026

Deploy Preview for agent-sandbox canceled.

Name Link
🔨 Latest commit e925c3e
🔍 Latest deploy log https://app.netlify.com/projects/agent-sandbox/deploys/69991159d7ce1e0007e16283

@k8s-ci-robot k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Feb 21, 2026
@k8s-ci-robot
Copy link
Contributor

Hi @shrutiyam-glitch. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

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.

@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Feb 21, 2026
@janetkuo
Copy link
Member

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Feb 21, 2026
logging.basicConfig(level=logging.INFO,
format='%(asctime)s - %(levelname)s - %(message)s',
stream=sys.stdout)
from .constants import *
Copy link
Member

Choose a reason for hiding this comment

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

Avoid wildcard imports as it pollutes the namespace and makes it difficult to track where names are defined. It is more idiomatic to use explicit imports or from . import constants.

@@ -0,0 +1,37 @@
# Copyright 2025 The Kubernetes Authors.
Copy link
Member

Choose a reason for hiding this comment

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

2026

PODSNAPSHOT_API_VERSION = "v1alpha1"
PODSNAPSHOT_PLURAL = "podsnapshots"
PODSNAPSHOTMANUALTRIGGER_PLURAL = "podsnapshotmanualtriggers"
PODSNAPSHOT_API_KIND = "PodSnapshotManualTrigger"
Copy link
Member

Choose a reason for hiding this comment

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

These constants are defined but currently unused in the client.

A PR should focus on doing one thing. A good way to tell is when you need to add "and" in your commit message, you should split the PR/commit.

You should also only add things when they're being used, so that we make sure the code is clean and won't have zombie code that were added at some point but never used because of a change of plan.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks. I will remove the PodSnapshot constants for now to keep this PR focused strictly on the refactoring of existing constants. I'll re-introduce them in a follow-up PR when the implementation that actually uses them is ready.

@janetkuo janetkuo self-assigned this Feb 21, 2026
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: shrutiyam-glitch
Once this PR has been reviewed and has the lgtm label, please ask for approval from janetkuo. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants