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

fix: reject unsupported features and log ignored ones #55

Merged
merged 1 commit into from
Mar 4, 2024

Conversation

astromechza
Copy link
Member

Users face a log of confusion when features in the score file are ignored without any notice or error.

In this PR we do things to improve this:

  1. Update the logger to the modern log/slog package which allows log levels to be tracked. We use a simple handler here that ignores structured fields and just writes out the message with the level. We don't need timestamps here since the execution of the problem is fast and deterministic at this time.
  2. Reject the files element which isn't supported yet.
  3. Log warnings for unsupported resources when falling back to the environment variable references.
  4. Log warnings for the ignored spec sections: probes and resources.

For example we get the following output out of the big RunExample test:

$ ./score-compose run -f ../schema/samples/score-full.yaml
WARN: resources.resource-two2: 'Resource-Two.default' is not directly supported in score-compose, references will be converted to environment variables
WARN: resources.resource-one1: 'Resource-One.default' is not directly supported in score-compose, references will be converted to environment variables
Error: building docker-compose configuration: containers.container-one1.volumes[0].path: can't mount named volume with sub path '/sub/path': not supported

And fixing any issues while running with verbose on:

$ ./score-compose run -f ../schema/samples/score-full.yaml  --verbose
INFO: Reading Score file '../schema/samples/score-full.yaml'
INFO: Parsing Score specification
INFO: Loading Score overrides file './overrides.score.yaml'
INFO: Validating final Score specification
INFO: Building docker-compose configuration
WARN: resources.resource-one1: 'Resource-One.default' is not directly supported in score-compose, references will be converted to environment variables
WARN: resources.resource-two2: 'Resource-Two.default' is not directly supported in score-compose, references will be converted to environment variables
WARN: containers.container-one1.resources.requests: not supported - ignoring
WARN: containers.container-one1.resources.limits: not supported - ignoring
WARN: containers.container-one1.readinessProbe: not supported - ignoring
WARN: containers.container-one1.livenessProbe: not supported - ignoring
...

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • New chore (expected functionality to be implemented)

Checklist:

  • My change requires a change to the documentation.
    • I have updated the documentation accordingly.
  • I've signed off with an email address that matches the commit author.

Copy link

@delca85 delca85 left a comment

Choose a reason for hiding this comment

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

LGTM

@astromechza astromechza merged commit 9c0c165 into overhaul-resource-referencing Mar 4, 2024
3 checks passed
@astromechza astromechza deleted the warn-and-reject branch March 4, 2024 14:47
@astromechza astromechza restored the warn-and-reject branch March 4, 2024 14:48
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