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

re-think project_service.go #492

Open
mangas opened this issue Apr 29, 2021 · 0 comments
Open

re-think project_service.go #492

mangas opened this issue Apr 29, 2021 · 0 comments
Labels

Comments

@mangas
Copy link
Contributor

mangas commented Apr 29, 2021

project_service used to deal with the different labels as a just in time validator that supported the converter.

Example:
https://github.com/appvia/kev/blob/master/pkg/kev/converter/kubernetes/project_service.go#L55

Now this validation should be done at the moment when extensions get inferred, parsed and merged.

https://github.com/appvia/kev/blob/5a1c05c568427024fb3ef76a9fc0a5d6bdd1e341/pkg/kev/config/extensions.go#L111

The new process is:

  1. Extension values are inferred from composego.ServiceConfig
  2. Extension values get parsed from composego.ServiceConfig.Extensions
  3. Result of step 2 gets merged into result of step 1. This has some implications:
    a. This code below will get overwritten by the parsed value, so it's important that Validate() is very strict as it's run against the result of the merge. https://github.com/appvia/kev/blob/5a1c05c568427024fb3ef76a9fc0a5d6bdd1e341/pkg/kev/config/extensions.go#L187
    b. If the result of Step 2 has a field that contains the zero value of the type (eg. Boolean false, int 0) then those values are ignored so it's important to keep that in mind.

Essentially validation now happens earlier and more formally, this means that the function project_service.go performs is no longer as relevant because this could be replaced with an adapter/converter that essentially takes a valid K8SConfiguration and produces the necessary K8S-specific values for manifests.

@marcinc marcinc added enhancement New feature or request refactor and removed enhancement New feature or request labels Jul 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants