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

[bulder] Add MsSQL and OracleXE #533

Merged
merged 1 commit into from
Mar 29, 2023

Conversation

OndrejGerzicak
Copy link

This PR adds OracleXe and MsSQL Server databases to the builder. Since the provided images don't create custom databases and users on setup, we need to use the default, that's why I added the new constructors to AbstractDatabase and AbstractSQLDatabase classes.
Because the defualt database of OracleXE is XE I've come across a possible issue with Uppercase dbName that gets to the opensihft deployment config name. Although the OracleXE database server is case insensitive, it is possible to crate a case sensitive SQL server so it's seems safer to me to use lower case equivalent in the deployment name deployment config name

Please make sure your PR meets the following requirements:

  • Pull Request contains a description of the changes
  • Pull Request does not include fixes for multiple issues/topics
  • Code is formatted, imports ordered, code compiles and tests are passing
  • Code is self-descriptive and/or documented

new ServiceAccountBuilder().withNewMetadata().withName(ANYUID_SERVICE_ACCOUNT).endMetadata().build());
}
}
try (OpenShift admin = OpenShifts.admin()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This is common to both MsSQL and OracleXE. Have you tried to avoid using admin ? It can happen we will be forced to run this code on cluster without admin. Would that be possible? If not can you document which permission regular master user will be missing?

Copy link
Author

Choose a reason for hiding this comment

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

Regular master is missing permissions to add security context constraint. I added this info in the comment before the classes.


//Setting up the anyuid service account
try (OpenShift master = OpenShifts.master()) {
if (master.getServiceAccount("ANYUID_SERVICE_ACCOUNT") == null) {
Copy link
Contributor

Choose a reason for hiding this comment

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

this needs to be unquoted to actually use the variable's value

Copy link
Author

Choose a reason for hiding this comment

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

Yikes. Fixed now.

super.configureContainer(containerBuilder);

//Setting up the anyuid service account
//Don't close the OpenShift Client instance, it could cause trouble with pod shell access
Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure we want this info here, it is a general note more suited for README or maybe OpenShifts.master() javadoc .. but it isn't a socpe of this PR at all

Copy link
Author

Choose a reason for hiding this comment

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

I added this comment just in case someone else would see this line and wanted to use the try with resource block as it's suggested by IDEA.
Agree that it should be mentioned elsewhere though.

Copy link
Contributor

@mchoma mchoma Mar 28, 2023

Choose a reason for hiding this comment

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

If IDEA is suggesting something we know can bring problem, can it be fixed in XTF code? Can we handle it as XTF bug? To change XTF API in backward compatible manner so IDEA stop suggesting try with resource?

Copy link
Contributor

Choose a reason for hiding this comment

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

you can skip the IDEA from suggesting this by introducing comment

Suggested change
//Don't close the OpenShift Client instance, it could cause trouble with pod shell access
//noinspection resource

But IDEA is not the only IDE in the world so I don't know if we want to go this road

@OndrejGerzicak OndrejGerzicak marked this pull request as ready for review March 28, 2023 10:55
@mchoma
Copy link
Contributor

mchoma commented Mar 28, 2023

@mnovak1 please work with @OndrejGerzicak (@jbliznak) to merge this and release this for their work.

@mnovak1 mnovak1 merged commit 158b13a into xtf-cz:master Mar 29, 2023
@mnovak1
Copy link
Contributor

mnovak1 commented Mar 29, 2023

LGTM. merging. Thanks!

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

Successfully merging this pull request may close these issues.

4 participants