-
Notifications
You must be signed in to change notification settings - Fork 752
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
Added feature for placement
key in v3
#813
Conversation
@surajnarwade, thank you for the pull request! We'll request some people to review your PR. @cdrage and @kadel, please review this. |
@surajnarwade Code looks good, but can you add some integration / cmd tests? Then LGTM from me 👍 |
9324bd9
to
06e8b87
Compare
@cdrage , tests added :) |
06e8b87
to
0b13c47
Compare
One last thing, can you update Otherwise, code LGTM. Once docs are updated let's merge. |
2f5c036
to
879e6f4
Compare
@cdrage updated |
// placement: | ||
placement := make(map[string]string) | ||
for _, j := range composeServiceConfig.Deploy.Placement.Constraints { | ||
p := strings.Split(j, " == ") |
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.
missed this, but it's a pain in the butt, but can you test for:
placement:
constraints: [node.role == manager]
as well, as per: https://docs.docker.com/compose/compose-file/#replicas
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.
@cdrage , added functional test for the same example and it's working
879e6f4
to
303a922
Compare
@surajnarwade Alright, code LGTM (thanks for adding another functional test). Fix conflicts and then it should be good to go. |
303a922
to
5161a9b
Compare
@cdrage fixed conflicts |
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.
pkg/loader/compose/v3.go
Outdated
} else if p[0] == "engine.labels.operatingsystem" { | ||
placement["beta.kubernetes.io/os"] = p[1] | ||
} else { | ||
log.Warn(p[0], " constraints in placement is not supported") |
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.
So just a second review, but maybe we should add that only node.hostname
and engine.labels.operatingsystem
is only supported as a constraint in the warning.
script/test/cmd/tests.sh
Outdated
@@ -574,5 +597,7 @@ cmd="kompose convert --provider=openshift --stdout -j -f $KOMPOSE_ROOT/examples/ | |||
sed -e "s;%VERSION%;$version;g" -e "s;%CMD%;$cmd;g" $KOMPOSE_ROOT/script/test/fixtures/examples/output-gitlab-os.json > /tmp/output-os.json | |||
convert::expect_success_and_warning "kompose convert --provider=openshift --stdout -j -f $KOMPOSE_ROOT/examples/docker-gitlab.yaml" "/tmp/output-os.json" | |||
|
|||
|
|||
|
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.
remove extra newlines
it will map `engine.labels.operatingsystem` to `beta.kubernetes.io/os` and `node.hostname` to `kubernetes.io/hostname` and all other constraints will not be supported.
5161a9b
to
35198cc
Compare
LGTM |
it will map
engine.labels.operatingsystem
tobeta.kubernetes.io/os
andnode.hostname
tokubernetes.io/hostname
and all other constraints will not be supported.