Closed anovikov-el closed 3 months ago
When running rmk cluster switch to select an already existing K8S context, there might be a collision for the cases, when a project name includes a name of another project.
rmk cluster switch
For example, the following K8S contexts will conflict:
project1-develop-cluster myproject1-develop-cluster
This is because the regex doesn't have "\b" in the beginning. Actual regex:
<project_name>-<environment>\b
Expected regex:
\b<project_name>-<environment>\b
In the cases, when there are 2 contexts that match the regex, an error should be thrown to clearly indicate an error condition:
project1-develop-cluster new-project1-develop-cluster
Create 2 similar contexts, e.g.:
Run rmk cluster switch from within the both projects. Run rmk release list to verify a wrong context has been selected.
rmk release list
RMK: v0.42.1 OS: macOS Sonoma 14.4.1 Shell: zsh 5.9 (x86_64-apple-darwin23.0) Terminal: iTerm2 3.4.23
Detected "panic", when no context match found.
Description
When running
rmk cluster switch
to select an already existing K8S context, there might be a collision for the cases, when a project name includes a name of another project.For example, the following K8S contexts will conflict:
This is because the regex doesn't have "\b" in the beginning. Actual regex:
Expected regex:
In the cases, when there are 2 contexts that match the regex, an error should be thrown to clearly indicate an error condition:
Steps to reproduce
Create 2 similar contexts, e.g.:
Run
rmk cluster switch
from within the both projects. Runrmk release list
to verify a wrong context has been selected.System info
RMK: v0.42.1 OS: macOS Sonoma 14.4.1 Shell: zsh 5.9 (x86_64-apple-darwin23.0) Terminal: iTerm2 3.4.23