-
Notifications
You must be signed in to change notification settings - Fork 65
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
Refactor chectl to make tasks reusable for different commands #257
Refactor chectl to make tasks reusable for different commands #257
Conversation
7d1e326
to
980c329
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm fine after 7.1 release
but you need to fix CI build and semantic commits |
@benoitf Sure. This PR rare is not ready for merging. Hopefully, I'll continue testing and fixing this PR after finishing console link issue. |
2c720df
to
f654110
Compare
Update, it's pretty ready to review. TODO list
|
f654110
to
d784047
Compare
8076cd0
to
ab2d57b
Compare
ab2d57b
to
a988cdb
Compare
src/api/kube.ts
Outdated
const agent = new https.Agent({ | ||
rejectUnauthorized: false | ||
}) | ||
let endpoint = '' | ||
try { | ||
endpoint = `${currentCluster.server}/healthz` | ||
let response = await axios.get(`${endpoint}`, { httpsAgent: agent, headers: { Authorization: 'bearer ' + token } }) | ||
let response = await axios.get(`${endpoint}`, { httpsAgent: agent }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why token is removed there ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hum but if you remove it there are failures with some k8s clusters....
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can not guarantee.
I only discovered that it does not work on minishift when logged in as non-admin user.
And tested my changes (without token) that is works on minikube(without explicit specifying RBAC enabled) and minishift.
I can test it on like minikube
with RBAC specified or OpenShift 4.1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested on CRC 4.1 as well
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
security is for remote, not local dev like minishift, minikube or crc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@benoitf Thanks for sharing concrete implementation where it fails.
Because on one of OSIO cluster, healthz endpoint is public and it supposed by be secure
https://api.starter-us-east-2.openshift.com/healthz
I'm going to revert it and create a separate issue that there is an issue with healthz
if user does not have cluster admin rights.
Hello everyone, pls let me know once this is released |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
repository shouldn't use sleshchenko ("eclipse-che-minishift": "git://github.com/sleshchenko/minishift#updateChe", )
and token shouldn't be removed in Kube (or be removed only for minishift)
tasks reusable Signed-off-by: Sergii Leshchenko <sleshche@redhat.com>
…stry that is used by Che Signed-off-by: Sergii Leshchenko <sleshche@redhat.com>
Signed-off-by: Sergii Leshchenko <sleshche@redhat.com>
… addon Signed-off-by: Sergii Leshchenko <sleshche@redhat.com>
d28f176
to
51b8858
Compare
Since my PR to minishift repo is merged, I'm able to do it.
I believe this issue may be resolved out of the scope of current PR, reverted that changes (removing of using service account token) and created the corresponding issue eclipse-che/che#14534 to investigate it deeper and fix |
What does this PR do?
This PR has two major purposed:
The main idea of refactoring is the following:
Have the following different packages:
api
<- holds everything that might be reused while working with different APIs BUT not tasks, cli stuff heretasks
<- holds tasks that are devided into different classes by components| - installers
| - platforms
| che
commands
<- holds commands of chectl, command should reuse tasks fromtasks
package or it can declare it's own unique small tasksThe main pros of this refactoring: encapsulate logic related to some component to one class,
like currently, all commands read
flags['che-namespace']
everytime when they need to do something with che components (find ingress, scale deployment) but it could be encapsulated in oneche-tasks
class.Note that this PR also contains changes how chectl check if there is already deployed Che, after that - with them it's possible to start already deployed but stopped Che.
This PR also contains a lot of small fixes but I did no manage to highlight them and move to separate commits, like:
platform
parameter forserver:start
command is required only when there is no already Deployed Che;server:stop
now stops devfile and plugin registry as well as Che, Postgres and Keycloak;che-operator
is used;Is this PR tested?
I made sure that E2E tests are not broken but there are not much covered cases yet.
I tried to cover start-stop-start scenario with E2E tests https://github.com/sleshchenko/chectl/compare/startStopStartScenario...sleshchenko:startStopStartScenarioE2E?expand=1
but they failed because of the current implementation of
api/kube.ts#waitUntilPodIsDeleted
method, it says that it waits until the pod is deleted but in fact, it waits until pod is not ready. It causes an issue thatserver:start
gets two Che pods intead of expected 1. I'll register a separate issue for it.I did manual testing and here I'm posting detailed results. It may be useful to review them as well since it shows what is the actual output of chectl:
No Platform Specified
Screenshot
Minishift
Minishift Addon
server:start --platform=minishift
server:stop
server:start
server:delete
Che-operator
server:start --platform=minishift --installer=operator
server:stop
server:start (does not work correctly because of https://github.com/eclipse-che/che/issues/14445)
server:delete
Minikube
Helm Single User
server:start --platform=minikube
server:stop
server:start
server:delete
Helm multiuser
server:start --platform=minikube --multiuser
server:stop
server:start
server:delete
CRC
server:start --platform=openshift --installer=operator
server:stop
server:start (does not work correctly because of https://github.com/eclipse-che/che/issues/14445)
server:delete
What issues does this PR fix or reference?
It's done in the scope of the following issue eclipse-che/che#14465
It depends on minishift/minishift#3333