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

feat: solo context connect for single cluster #993

Draft
wants to merge 14 commits into
base: main
Choose a base branch
from

Conversation

Ivo-Yankov
Copy link
Contributor

@Ivo-Yankov Ivo-Yankov commented Dec 16, 2024

…ect-connects-to-a-deployment-and-pulls-back-the-remoteconfig-for-single-cluster-deployment
Signed-off-by: Ivo Yankov <[email protected]>
…s-to-a-deployment-and-pulls-back-the-remoteconfig-for-single-cluster-deployment
…ect-connects-to-a-deployment-and-pulls-back-the-remoteconfig-for-single-cluster-deployment
…s-to-a-deployment-and-pulls-back-the-remoteconfig-for-single-cluster-deployment
@Ivo-Yankov Ivo-Yankov changed the title feat: implement solo context connect for single cluster feat: solo context connect for single cluster Dec 16, 2024
Copy link
Contributor

github-actions bot commented Dec 16, 2024

Unit Test Results - Linux

  1 files  ±0   58 suites  +1   4s ⏱️ -1s
229 tests +9  229 ✅ +9  0 💤 ±0  0 ❌ ±0 
239 runs  +9  239 ✅ +9  0 💤 ±0  0 ❌ ±0 

Results for commit 8a6d1d9. ± Comparison against base commit a4ef700.

This pull request removes 8 and adds 17 tests. Note that renamed tests count towards both.
should not set invalid context mappings ‑ LocalConfig should not set invalid context mappings
should prompt for all flags if none are provided ‑ ContextCommandTasks unit tests updateLocalConfig should prompt for all flags if none are provided
should prompt for cluster if no value is provided ‑ ContextCommandTasks unit tests updateLocalConfig should prompt for cluster if no value is provided
should prompt for context if no value is provided ‑ ContextCommandTasks unit tests updateLocalConfig should prompt for context if no value is provided
should prompt for namespace if no value is provided ‑ ContextCommandTasks unit tests updateLocalConfig should prompt for namespace if no value is provided
should update local configuration with provided values ‑ ContextCommandTasks unit tests updateLocalConfig should update local configuration with provided values
should use cluster from kubectl if no value is provided and quiet=true ‑ ContextCommandTasks unit tests updateLocalConfig should use cluster from kubectl if no value is provided and quiet=true
should use namespace from kubectl if no value is provided and quiet=true ‑ ContextCommandTasks unit tests updateLocalConfig should use namespace from kubectl if no value is provided and quiet=true
should not set invalid clusterContextMapping ‑ LocalConfig should not set invalid clusterContextMapping
should prompt for clusters and contexts if selected deployment is not found in local config ‑ ContextCommandTasks unit tests selectContext should prompt for clusters and contexts if selected deployment is not found in local config
should prompt for context if selected cluster is not found in local config mapping ‑ ContextCommandTasks unit tests selectContext should prompt for context if selected cluster is not found in local config mapping
should prompt for context if selected deployment is found in local config but the context is not ‑ ContextCommandTasks unit tests selectContext should prompt for context if selected deployment is found in local config but the context is not
should set clusterContextMapping ‑ LocalConfig should set clusterContextMapping
should throw a validation error if clusterContextMapping format is not correct ‑ LocalConfig should throw a validation error if clusterContextMapping format is not correct
should update clusterContextMapping with provided context ‑ ContextCommandTasks unit tests updateLocalConfig should update clusterContextMapping with provided context
should update currentDeployment with clusters from remoteConfig ‑ ContextCommandTasks unit tests updateLocalConfig should update currentDeployment with clusters from remoteConfig
should update multiple clusterContextMappings with default KubeConfig context if quiet=true ‑ ContextCommandTasks unit tests updateLocalConfig should update multiple clusterContextMappings with default KubeConfig context if quiet=true
should update multiple clusterContextMappings with prompted context no value was provided ‑ ContextCommandTasks unit tests updateLocalConfig should update multiple clusterContextMappings with prompted context no value was provided
…

♻️ This comment has been updated with latest results.

Copy link
Contributor

github-actions bot commented Dec 16, 2024

Unit Test Results - Windows

  1 files  ±0   58 suites  +1   13s ⏱️ -1s
229 tests +9  229 ✅ +9  0 💤 ±0  0 ❌ ±0 
239 runs  +9  239 ✅ +9  0 💤 ±0  0 ❌ ±0 

Results for commit 8a6d1d9. ± Comparison against base commit a4ef700.

This pull request removes 8 and adds 17 tests. Note that renamed tests count towards both.
should not set invalid context mappings ‑ LocalConfig should not set invalid context mappings
should prompt for all flags if none are provided ‑ ContextCommandTasks unit tests updateLocalConfig should prompt for all flags if none are provided
should prompt for cluster if no value is provided ‑ ContextCommandTasks unit tests updateLocalConfig should prompt for cluster if no value is provided
should prompt for context if no value is provided ‑ ContextCommandTasks unit tests updateLocalConfig should prompt for context if no value is provided
should prompt for namespace if no value is provided ‑ ContextCommandTasks unit tests updateLocalConfig should prompt for namespace if no value is provided
should update local configuration with provided values ‑ ContextCommandTasks unit tests updateLocalConfig should update local configuration with provided values
should use cluster from kubectl if no value is provided and quiet=true ‑ ContextCommandTasks unit tests updateLocalConfig should use cluster from kubectl if no value is provided and quiet=true
should use namespace from kubectl if no value is provided and quiet=true ‑ ContextCommandTasks unit tests updateLocalConfig should use namespace from kubectl if no value is provided and quiet=true
should not set invalid clusterContextMapping ‑ LocalConfig should not set invalid clusterContextMapping
should prompt for clusters and contexts if selected deployment is not found in local config ‑ ContextCommandTasks unit tests selectContext should prompt for clusters and contexts if selected deployment is not found in local config
should prompt for context if selected cluster is not found in local config mapping ‑ ContextCommandTasks unit tests selectContext should prompt for context if selected cluster is not found in local config mapping
should prompt for context if selected deployment is found in local config but the context is not ‑ ContextCommandTasks unit tests selectContext should prompt for context if selected deployment is found in local config but the context is not
should set clusterContextMapping ‑ LocalConfig should set clusterContextMapping
should throw a validation error if clusterContextMapping format is not correct ‑ LocalConfig should throw a validation error if clusterContextMapping format is not correct
should update clusterContextMapping with provided context ‑ ContextCommandTasks unit tests updateLocalConfig should update clusterContextMapping with provided context
should update currentDeployment with clusters from remoteConfig ‑ ContextCommandTasks unit tests updateLocalConfig should update currentDeployment with clusters from remoteConfig
should update multiple clusterContextMappings with default KubeConfig context if quiet=true ‑ ContextCommandTasks unit tests updateLocalConfig should update multiple clusterContextMappings with default KubeConfig context if quiet=true
should update multiple clusterContextMappings with prompted context no value was provided ‑ ContextCommandTasks unit tests updateLocalConfig should update multiple clusterContextMappings with prompted context no value was provided
…

♻️ This comment has been updated with latest results.

@Ivo-Yankov Ivo-Yankov self-assigned this Dec 16, 2024
});
}

selectContext(argv) {
Copy link
Contributor

Choose a reason for hiding this comment

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

would be good to make this method more modular, it is a bit long and has opportunities to be broken down

Signed-off-by: Ivo Yankov <[email protected]>
@@ -255,8 +255,8 @@ export class Templates {
return mapping;
}

static parseClusterAliases(clusters: string) {
return clusters ? clusters.split(',') : [];
static parseCommaSeparatedList(data: string) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think helpers.splitFlagInput would do the same thing and we can remove this.

Signed-off-by: Ivo Yankov <[email protected]>
Signed-off-by: Ivo Yankov <[email protected]>
…s-to-a-deployment-and-pulls-back-the-remoteconfig-for-single-cluster-deployment
Signed-off-by: Ivo Yankov <[email protected]>
Copy link
Contributor

github-actions bot commented Dec 17, 2024

E2E Test Report

 16 files  ±0  121 suites  ±0   1h 18m 52s ⏱️ -13s
256 tests ±0  256 ✅ ±0  0 💤 ±0  0 ❌ ±0 
259 runs  ±0  259 ✅ ±0  0 💤 ±0  0 ❌ ±0 

Results for commit 8a6d1d9. ± Comparison against base commit a4ef700.

♻️ This comment has been updated with latest results.

Copy link

Coverage summary from Codacy

See diff coverage on Codacy

Coverage variation Diff coverage
-0.07% (target: -1.00%) 77.19%
Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (a4ef700) 19197 16504 85.97%
Head commit (8a6d1d9) 19475 (+278) 16730 (+226) 85.91% (-0.07%)

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#993) 320 247 77.19%

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

See your quality gate settings    Change summary preferences

Codacy stopped sending the deprecated coverage status on June 5th, 2024. Learn more

Copy link

codecov bot commented Dec 17, 2024

Codecov Report

Attention: Patch coverage is 77.18750% with 73 lines in your changes missing coverage. Please review.

Project coverage is 84.92%. Comparing base (a4ef700) to head (8a6d1d9).

Files with missing lines Patch % Lines
src/core/config/local_config.ts 31.70% 56 Missing ⚠️
src/commands/context/configs.ts 78.04% 9 Missing ⚠️
src/commands/context/handlers.ts 61.53% 5 Missing ⚠️
src/commands/context/tasks.ts 98.48% 2 Missing ⚠️
src/commands/flags.ts 66.66% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #993      +/-   ##
==========================================
- Coverage   84.99%   84.92%   -0.08%     
==========================================
  Files          71       72       +1     
  Lines       19225    19475     +250     
  Branches     1305     1919     +614     
==========================================
+ Hits        16341    16539     +198     
+ Misses       2858     2768      -90     
- Partials       26      168     +142     
Files with missing lines Coverage Δ
src/commands/base.ts 95.39% <100.00%> (+0.17%) ⬆️
src/commands/context/flags.ts 100.00% <100.00%> (ø)
src/commands/context/index.ts 63.49% <100.00%> (ø)
src/core/error_messages.ts 100.00% <100.00%> (ø)
src/core/helpers.ts 89.35% <100.00%> (+0.28%) ⬆️
src/core/templates.ts 72.46% <ø> (-0.40%) ⬇️
src/core/validator_decorators.ts 98.71% <100.00%> (+0.80%) ⬆️
src/commands/flags.ts 78.51% <66.66%> (ø)
src/commands/context/tasks.ts 93.65% <98.48%> (+5.89%) ⬆️
src/commands/context/handlers.ts 64.51% <61.53%> (+1.05%) ⬆️
... and 2 more

... and 29 files with indirect coverage changes

Impacted file tree graph

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants