redhat-cop / osia

Tool for reliable automated deployments of OpenShift Container Platform 4.x into OpenStack and AWS.
https://osia-python.rtfd.io
Apache License 2.0
12 stars 12 forks source link

Support for specifying a custom OpenShift release image #71

Closed accorvin closed 10 months ago

accorvin commented 10 months ago

I would like to be able to specify a custom OpenShift release image when provisioning the cluster (as described in https://access.redhat.com/solutions/3880221 ) It's not obvious to me from the existing documentation whether this is possible. Can anyone advise on whether it is?

accorvin commented 10 months ago

@mijaros by chance do you know if this is possible?

mijaros commented 10 months ago

Looking at the code I can see the "stupid" mistake, that won't allow you to use the proposed solution [1] or to be precise , if you were to install the cluster into openstack, it should be theoretically possible to set the proposed environment variable and it should be picked up.

But nevertheless this is easy to fix IMO, the question is what approach would be the best. Personally I would go with the solution of setting it as another command line argument which, once set, would be passed to the installer.

The other method would to pass the environment variables inherited from the parent process, which should work as well.

What do you think @accorvin ?

[1] https://github.com/redhat-cop/osia/blob/d69be8e2ad16f199959b7009c58cead166538548/osia/installer/executor.py#L37

mijaros commented 10 months ago

@accorvin Thinking about this again, it seems more clear to me that passing the environment variable will be more clean solution - it is fundamentally different from the OS_IMAGE_OVERRIDE, since this is somehow more tied to the workflow osia uses. I also think that the security implications of passing the variables are low to insignificant given the nature of the tool, ideally it should be somehow whitelisted what will be passed, but I think it is reasonable to assume that there is very low probability that any practical attack would arise from it.

mijaros commented 10 months ago

Ahh, mea culpa parents environment variables should be passed when the env is None (which in this case it is - the copy is there because of the behaviour of Popen, when the env dict is passed) so I "think" that if you'd set the environment variable in the same manner as it is done in the article, it should be passed to the subprocess and modify the behaviour of the installer process.

accorvin commented 10 months ago

Thanks for the pointers @mijaros! I'll spend some time seeing if I can get that to work.

accorvin commented 10 months ago

@mijaros FYI I was able to get this to work simply by setting the environment variable and then executing osia install, so problem solved. Thanks for the pointers!