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

Improve cluster config loader #671

Merged
merged 11 commits into from
Mar 28, 2019
Merged

Improve cluster config loader #671

merged 11 commits into from
Mar 28, 2019

Conversation

errordeveloper
Copy link
Contributor

@errordeveloper errordeveloper commented Mar 27, 2019

Description

Checklist

  • Code compiles correctly (i.e make build)
  • Added tests that cover your change (if possible)
  • All unit tests passing (i.e. make test)
  • All integration tests passing (i.e. make integration-test)

@errordeveloper errordeveloper force-pushed the cluster-config-loader branch from 14b3a7d to 9370121 Compare March 28, 2019 12:36
// ImageFamilyAmazonLinux2 represents Amazon Linux 2 family
ImageFamilyAmazonLinux2 = "AmazonLinux2" // Owner 602401143452
ImageFamilyAmazonLinux2 = api.NodeImageFamilyAmazonLinux2 // Owner 602401143452
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The constants are being relocated to api package, so that they can be used there without dragging AWS dependencies from here, as the api package is meant to be free of dependencies.

@@ -0,0 +1,56 @@
package v1alpha4

// SetNodeGroupDefaults will set defaults for a given nodegroup
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This wasn't moved here before due to the concerns regarding ami package and its dependencies.

Copy link
Contributor

Choose a reason for hiding this comment

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

Why not keep this in the nodegroup_filter package as private and only expose ValidateNodeGroupsAndSetDefaults()? Since this is less abstracted and not really useful by itself, or is it? :/

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So NodeGroupFilter is currently designed for CLI use-cases, hence it lives in cmduitls.
This is here so that one can construct ClusterConfig, and apply defaults and validation in a deamon/operator context or whatever other context. I'm just trying to draw a clear line between CLI and API.

These are only meant for interactive use in commands, not the API.
So cmdutils is the best place to keep these.
- make most logic part of the API
- move contstanst out of ami package
- convert subnet checker into a method
- make `SkipAll` an option of the `NodeGroupFilter`
@errordeveloper errordeveloper force-pushed the cluster-config-loader branch from 9370121 to 5cbb187 Compare March 28, 2019 15:07
@errordeveloper errordeveloper changed the title WIP: Improve cluster config loader Improve cluster config loader Mar 28, 2019
martina-if
martina-if previously approved these changes Mar 28, 2019
This is something that can happen due to the fact that defaulting
is now done for both case - config file and flag.
}

// Enable SSH when a key is provided
if ng.SSHPublicKeyPath != "" && ng.SSHPublicKeyPath != DefaultNodeSSHPublicKeyPath {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@martina-if this is a temporary fix, I think we should be able to get rid of != DefaultNodeSSHPublicKeyPath when we switch to references.

martina-if
martina-if previously approved these changes Mar 28, 2019
@errordeveloper errordeveloper merged commit 42e5fd4 into master Mar 28, 2019
@errordeveloper errordeveloper deleted the cluster-config-loader branch March 28, 2019 17:54
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.

2 participants