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

Dockerfile and need for oc / kubeconfig #159

Open
erwangranger opened this issue Dec 23, 2021 · 7 comments
Open

Dockerfile and need for oc / kubeconfig #159

erwangranger opened this issue Dec 23, 2021 · 7 comments

Comments

@erwangranger
Copy link

Hello,

I was trying to use ODS-CI, yesterday, and I noticed some changes. (I had last used it a few months ago).
I managed to get it working again, but before I submit PRs, I wanted to check a few things.

  1. Dockerfile
    It seems that the Dockerfile has not been udpated in a while. That's what I prefer to use, personally.
    If I get that working again, is it ok to send a PR to get that fixed?

  2. oc and OpenShiftCLI
    To get the container version of ods-ci to work I had to update the Dockerfile. I had to:

  • install the oc cli in the container
  • add the ./libs folder into the container
  • provide a valid $HOME/.kube/config
    That last one has given me the most trouble, and is also the one I'm the least sure about.
    Since User and Pass are provided as variables, I would have thought that would be used to authenticate.
    However, without a valid config file, it keeps failing with:
[ ERROR ] Error in file '/tmp/ods-ci/tests/Resources/Page/OCPDashboard/InstalledOperators/InstalledOperators.robot' 
on line 3: Initializing library 'OpenShiftCLI' with no arguments failed: 
ConfigException: Invalid kube-config file. No configuration found.

Is there a way to not require this file?

Thanks!

@vasukulkarni
Copy link
Contributor

PRs are always welcome, please free to send the patch

@vasukulkarni
Copy link
Contributor

Some of the tasks are handled here: https://github.com/red-hat-data-services/ods-ci/pull/160/files

@lugi0
Copy link
Contributor

lugi0 commented Jan 4, 2022

Regarding >provide a valid $HOME/.kube/config

I believe this file is automatically created the first time you connect to a cluster with the oc CLI tool.
OpenShiftCLI expects you to be logged in before launching the library, and I am not sure there's a way around that currently. Pinging @pablofelix for confirmation, but he's on PTO until next week.

EDIT: I manually removed my config and could reproduce the same error you are facing, manually logging in to a cluster with oc login recreated the config file and tests run fine.

@erwangranger
Copy link
Author

Right. It just felt a bit strange to me: I'm logged in oc with my own credentials, with a high level of access. And I might be "oc logged" into another cluster than the one I intend to run ods-ci against.
But mostly, I provide other credentials in the variable file, so I was expecting them to be used everywhere.

I did a bit of experimenting, and it is possible to generate the ./kube/config file based on those credentials provided in the variable file.
I think that could/should be the default moving forward.

@lugi0
Copy link
Contributor

lugi0 commented Jan 5, 2022

I agree with you that this is not an ideal behaviour and that the library itself should oc login with the credentials we want when running the tests.

I am not sure if generating a config file from the variables.yaml file would actually solve the issue. If you only have the file but are not currently logged into a cluster, I believe the library will fail with a 403 error; the other issue is that if you are logged into any other cluster it will still pick up the oc session to a random cluster which might not be the one you were thinking of running ods-ci on.

Not quite sure about relying on the variables file being there either. The library is supposed to work on its own as well as with ods-ci, and I'm not sure we want to enforce the presence of our own variable file to everyone who might use it.

@pablofelix
Copy link
Contributor

I agree with you both, to log manually to clusters is no the ideal behaviour and I also agree that the library should work on its own and not rely on the variable file. To add the login feature to the library is needed, already under development and will be available soon. The login feature will also give us the ability to log to different clusters between tests and also to change the user within the same cluster.

@erwangranger
Copy link
Author

I have submitted a PR (#166) that, among other things, attempts to do an oc login based on the admin credentials in the variable file.
Because this is done in the run_robot_test.sh, it would work both from inside a container, or directly on your workstation.

@pablofelix pablofelix modified the milestone: mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmnko¡ Apr 3, 2022
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

No branches or pull requests

4 participants