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

Move KUBE_CONFIG_PATH variable to KUBECONFIG variable #3015

Merged
merged 5 commits into from
Oct 10, 2024

Conversation

852hamza
Copy link
Contributor

What type of PR is this?

Type: Bug
Which issue does this PR fix?

This PR addresses an issue where the unconventional KUBE_CONFIG_PATH environment variable was being used across multiple scripts and configurations, causing confusion. The conventional KUBECONFIG variable is now used instead to align with standard practices.
What does this PR do / Why do we need it?

The main objective of this PR is to replace all instances of the KUBE_CONFIG_PATH variable with the conventional KUBECONFIG variable. This change reduces potential confusion and aligns the project with standard Kubernetes practices.
Key Changes:

Replaced all occurrences of KUBE_CONFIG_PATH with KUBECONFIG in the following scripts:
    scripts/lib/canary.sh
    scripts/run-static-canary.sh
    scripts/run-ginkgo-integration-suite.sh
    scripts/lib/cluster.sh
    scripts/run-canary-test.sh
    scripts/run-multus-tests.sh
    test/integration/README.md
    scripts/run-ipv6-canary-test.sh
    scripts/run-cni-release-tests.sh
    scripts/run-soak-test.sh
    scripts/run-ipv6-integration-tests.sh

Testing done on this change:

Manual and integration tests were run to ensure that the changes did not introduce any issues and that all scripts and configurations functioned as expected with the KUBECONFIG variable. Logs were reviewed to confirm successful execution.
Test Results:

All tests passed without any errors.
Verified that the scripts correctly reference the KUBECONFIG variable.

Will this PR introduce any new dependencies?

No, this PR does not introduce any new dependencies.
Will this break upgrades or downgrades? Has updating a running cluster been tested?

No, this change will not break upgrades or downgrades. Updating a running cluster was tested and confirmed to be unaffected by this change.
Does this change require updates to the CNI daemonset config files to work?

No, this change does not require updates to the CNI daemonset config files.
Does this PR introduce any user-facing change?

No user-facing changes are introduced. The changes are internal to the scripts and configurations.

@orsenthil
Copy link
Member

@852hamza - We need this is backwards compatible manner, can you see if there is any reference that can be take KUBE_CONFIG_PATH and assign it to KUBECONFIG ?

@852hamza
Copy link
Contributor Author

@orsenthil I've added a fallback mechanism in the script to ensure compatibility with previous versions that still use KUBE_CONFIG_PATH. The logic checks if KUBE_CONFIG_PATH is set, then assigns KUBECONFIG to the value of KUBE_CONFIG_PATH. This ensures that the script works seamlessly with both old and new configurations without requiring any changes to existing setups. Let me know if you need any further adjustments!

@852hamza
Copy link
Contributor Author

@orsenthil any update plz

scripts/lib/canary.sh Outdated Show resolved Hide resolved
@852hamza
Copy link
Contributor Author

@orsenthil

  • Created a new script, set_kubeconfig.sh, to centralize the Kubernetes configuration setting. This script checks and sets the KUBECONFIG environment variable based on KUBE_CONFIG_PATH if KUBECONFIG is not already set.

  • Updated several scripts to source this new script for setting KUBECONFIG. This change ensures all scripts consistently use the correct configuration without duplicating code across multiple files. This centralization also simplifies maintenance and potential future changes to the environment configuration logic.

Scripts updated to source set_kubeconfig.sh:

  • scripts/run-canary-test.sh
  • scripts/run-ginkgo-integration-suite.sh
  • scripts/run-static-canary.sh
  • etc.

This change aids in maintaining a cleaner and more manageable codebase by reducing redundancy and centralizing configuration logic.

scripts/lib/canary.sh Outdated Show resolved Hide resolved
@852hamza
Copy link
Contributor Author

@orsenthil can you check the latest commit code

Copy link
Member

@orsenthil orsenthil left a comment

Choose a reason for hiding this comment

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

LGTM.

We can remove $SCRIPT_DIR/set_kubeconfig.sh when no other helper scripts are using the old KUBE_CONFIG_PATH.

@orsenthil orsenthil merged commit 751aedf into aws:master Oct 10, 2024
6 checks passed
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