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

Reopen "get k8s config from requestConfig. and added test." #1692

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

hnarimiya
Copy link
Contributor

I rebased this PR(#1279) from master.
Please review.

@yoyama
Copy link
Contributor

yoyama commented Apr 15, 2022

IIUC, this PR will allow to configure K8 in workflow definition ?
If so, I would like to ask you to add server configuration to enable/disable of it and default is disable for server administrators.

@yoyama yoyama requested review from yoyama and szyn April 15, 2022 01:55
Copy link
Contributor

@yoyama yoyama left a comment

Choose a reason for hiding this comment

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

Please check my comment

@hnarimiya
Copy link
Contributor Author

@yoyama
Sorry for late reply.

I'm sorry if it's not what I intended.

I would like to add a parameter that allows setting using the parameter of "kubernetes" from the workflow.
The parameters are as follows.

agent.command_executor.kubernetes.allow_configure_workflow_definition=true

If this parameter is true, requestConfig is merged with systemConfig and used like PR.

If false, only systemConfig is used. (As an image, the original createFromSystemConfig method)

If this parameter is not set or defaults, it is treated as false.

if (extractedSystemConfig != null && extractedRequestConfig != null) {
config = extractedSystemConfig.merge(extractedRequestConfig);

} else if (extractedRequestConfig != null) {
Copy link
Contributor

Choose a reason for hiding this comment

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

May I ask you to change the format ?

}
else if (

// from system config
return KubernetesClientConfig.createFromSystemConfig(name, systemConfig);

String clusterName = null;
Copy link
Contributor

Choose a reason for hiding this comment

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

Better to use Optional


// Create a config that merges RequestConfig with SystemConfig
final Config config;
if (extractedSystemConfig != null && extractedRequestConfig != null) {
Copy link
Contributor

Choose a reason for hiding this comment

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

If you set empty Config as default value in both extractedSystemConfig and extractedRequestConfig.
You can simply merge them without if ... else if ... ?
And at last check required keys are set.

config = extractedSystemConfig;

} else {
throw new ConfigException("systemConfig and requestConfig does not exist");
Copy link
Contributor

Choose a reason for hiding this comment

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

It might be better to improve the message to make users understand what is wrong.

@hnarimiya
Copy link
Contributor Author

@yoyama
Added parameter.
#1692 (comment)

I don't know if this is intended by yoyama san, so please tell me your opinion.

I fixed it based on some indications in the code.
#1692 (comment)
#1692 (comment)
#1692 (comment)

Please review.

@yoyama
Copy link
Contributor

yoyama commented Dec 23, 2022

@hnarimiya Could you rebase your PR to the latest master and fix the CI failures ?

@hnarimiya
Copy link
Contributor Author

@yoyama @szyn
I'm sorry for being late.
Please review.

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.

3 participants