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

Update paasta validate to use eks instance type where necessary - PAASTA-17992 #3683

Merged
merged 2 commits into from
Aug 25, 2023

Conversation

EmanElsaban
Copy link
Contributor

@EmanElsaban EmanElsaban commented Aug 23, 2023

This PR checks for EKS instance types wherever we check for Kubernetes instance types. Since eks_schema.json is a symbolic link to kubernetes_schema.json, I had to override in def get_schema(file_type) the eks file_type since eks_schema.json doesn't actually exist so we get none

Testing

  • Adjusting the unit tests to account for "eks"

Copy link
Member

@nemacysts nemacysts left a comment

Choose a reason for hiding this comment

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

looking good - my comments are all generally about slight simplifications/refactoring, no real issues i can see!

Comment on lines 165 to 167
if file_type == "eks":
# since eks_schema.json is a symlink to kubernetes_schema.json
file_type = "kubernetes"
Copy link
Member

Choose a reason for hiding this comment

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

we should be able to let the symlink do the redirection here (i.e., not update file_type and let this code read schemas/eks_schema.json)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ohh, I think I linked the eks_schema.json to the full path instead of just "kubernetes_schema.json" and thus wasn't able to open the file. Will correct that

config_file_object, file_path
):
if (
file_type == "kubernetes" or file_type == "eks"
Copy link
Member

Choose a reason for hiding this comment

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

we do this check of if X == "kubernetes" or X == "eks" in several places - thoughts on adding a named constant like K8S_TYPES = {"eks, "kubernetes"}?

we could then use it like if file_type in K8S_TYPES or if instance_config.get_instance_type() in K8S_TYPES

Comment on lines 589 to 591
workload="eks"
if instance_config.get_instance_type() == "eks"
else "kubernetes",
Copy link
Member

Choose a reason for hiding this comment

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

workload=instance_config.get_instance_type() should do the same, right? if i'm following this correctly, we should only get into this block of code if the instance type is eks or kubernetes, so this should do the same thing :)

Comment on lines 630 to 632
f"eks-{cluster}.yaml"
if instance_config.get_instance_type() == "eks"
else f"kubernetes-{cluster}.yaml",
Copy link
Member

Choose a reason for hiding this comment

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

somewhat the same as above: would f"{instance_config.get_instance_type()}-{cluster}.yaml" do the same thing?

@EmanElsaban EmanElsaban merged commit eb00b30 into master Aug 25, 2023
6 checks passed
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