-
Notifications
You must be signed in to change notification settings - Fork 26
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
Add restart support for docker-compose #157
Add restart support for docker-compose #157
Conversation
…ct_describe_backend Feature/85 project describe backend
…re/85_project_describe_backend Revert "Feature/85 project describe backend"
This reverts commit e23297c7d4b27d7b6f59bb055cb938fc3bba6cdf. (cherry picked from commit b93108249bc51e44e475dcaca29d369ce2a23822)
dcd42ad
to
8056eac
Compare
Convert docker-compose restart options to Kubernetes restartPolicy docker-compose docs: https://docs.docker.com/compose/compose-file/#restart kubernetes docs: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#restart-policy
8056eac
to
637c323
Compare
Tagging @moklidia for review of this PR |
when 'no', 'always', 'on-failure' | ||
restart_policy | ||
when 'unless-stopped' | ||
raise UffizziCore::ComposeFile::ParseError, I18n.t('compose.invalid_restart_policy') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's add a default case
|
||
hello-world: | ||
image: nginx:latest | ||
restart: always |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's add a test to check that the option is parsed correctly
@@ -152,6 +152,7 @@ | |||
t.string "command" | |||
t.string "service_name" | |||
t.jsonb "healthcheck" | |||
t.jsonb "restart" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why restart is jsonb? It's looks like a string
class UffizziCore::ComposeFile::Parsers::Services::RestartParserService | ||
class << self | ||
def parse(restart_data) | ||
return nil if restart_data.nil? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can do return if restart_data.nil?
without explicitly return nil
|
||
private | ||
|
||
def parse_restart(restart_data) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe it would be better to put this code in the method def parse
? I mean, this code looks simple and maybe it doesn't make sense to split it into two methods
Convert docker-compose restart options to Kubernetes restartPolicy
docker-compose docs:
https://docs.docker.com/compose/compose-file/#restart
kubernetes docs:
https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#restart-policy
fixes #140