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

feat: support for passing additional parameters from app repository to root repository using override file #184

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

makrelas
Copy link
Contributor

As requested by @niiku , this is work inspired by: #174 request.
It is supposed to provide capability for the users to pass additional (whitelisted) values to the root repo configuration - which may be used for enhancement purposes (i.e. labeling objects with proper team/project billing code) .

PR is not yet ready - as I would need to know - and discuss - what would be the proper way to raise errors in-line with the rest of the project - and which way will be the correct one to proceed with check "Root repository already up-to-date. I'm done here." - as the implementation of this capability will break the way ho app is behaving now.

Additionally - we would need to agree on way of overriding the whitelist, as well as locations and names of the additional yaml configuration files.

@niiku niiku requested a review from vangual September 29, 2022 13:48
Copy link
Member

@christiansiegel christiansiegel left a comment

Choose a reason for hiding this comment

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

just my 2 cents 😬


**root_repo/whitelist.yaml**
```yaml
teamcode: null
Copy link
Member

Choose a reason for hiding this comment

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

why not a list of allowed keys?

allowed_custom_parameters: 
- teamcode
- keyallowed

teamcode: null
keyallowed: null
```
**app_repo/app-xy-test/custom_values.yaml**
Copy link
Member

Choose a reason for hiding this comment

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

maybe custom_project_config.yaml, custom_namespace_config.yaml or custom_root_config.yaml gives a bit more context to what the file is for

except YAMLException as yex:
logging.error("Unable to load whitelist.yaml from root repository, please validate if this is a correct YAML file" , exc_info=yex)
return {}
#TODO: should sync fail, assume default whitelist or skip adding custom values (return {})
Copy link
Member

Choose a reason for hiding this comment

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

Taking into account that the sync-apps command is usually run by some pipeline not directly maintained by the individual teams, it might be a bit hard to figure out what went wrong (or even notice that it failed in the first place).

A compromise could be to create a YAML comment in the resulting root config file with the failure message:

applications:
  app-xy-staging:
    teamcode: team-xy
   # sync-apps error: 'keydisallowed' not allowed (custom_values.yaml, line 3)

This way you neither have to swallow the error nor break the sync.

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