-
Notifications
You must be signed in to change notification settings - Fork 738
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
PVC name changes if volumes containes .(dot) in it #603
Conversation
49a108e
to
072d7a2
Compare
pkg/loader/compose/compose.go
Outdated
@@ -337,7 +337,12 @@ func (c *Compose) LoadFile(files []string) (kobject.KomposeObject, error) { | |||
if composeServiceConfig.Volumes != nil { | |||
for _, volume := range composeServiceConfig.Volumes.Volumes { | |||
v := normalizeServiceNames(volume.String()) | |||
serviceConfig.Volumes = append(serviceConfig.Volumes, v) | |||
if strings.Contains(v, ".") { |
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.
Instead of putting this if statement here (making compose.go
even larger). Why not put the if / else statement inside of func normalizeVolumeNames
?
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 don't need to do all of these things, check my comment at:
#584 (comment)
072d7a2
to
370ebb4
Compare
@@ -0,0 +1,11 @@ | |||
web: |
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 do version 2 please?
script/test/cmd/tests.sh
Outdated
@@ -218,6 +218,13 @@ cd "$KOMPOSE_ROOT/script/test/fixtures/nginx-node-redis/node" | |||
convert::expect_success_and_warning "kompose convert --provider openshift --stdout -j -f ../docker-compose.yml" "/tmp/output-os.json" "$warning" | |||
cd $CURRENT_DIR | |||
|
|||
#### | |||
# Test related to change in volume-name |
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.
a better line which mentions what this test is about?
370ebb4
to
50f7771
Compare
All tests are passing locally. |
50f7771
to
15a1372
Compare
@procrypt Nope, they're not. Travis still says failing. |
@procrypt update the fixtures with the latest code changes, I mean regenerate them again, it seems that it is taking name of fixture as ''.". |
a7e18e4
to
6f0da4d
Compare
@procrypt openshift output matches but k8s does not? |
@surajssd Test are passing locally. |
c39b1b2
to
bbf901d
Compare
@procrypt Doesn't matter if tests are passing locally or not, it has to pass on Travis in order to get approval. You may have to run these tests manually and troubleshoot to figure out what may be the issue. |
Yeh, this will be quite hard to debug. |
@procrypt tests are failing locally for me with kubernetes. I see that the patch fixes the bug; so it could be a case where the output file you are comparing against is incorrect? |
054271f
to
39a0ca4
Compare
LGTM |
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.
other than small change for port, this code LGTM.
@@ -16,7 +16,7 @@ services: | |||
etherpad: | |||
image: centos/etherpad | |||
ports: | |||
- "80:9001" | |||
- "81:9001" |
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 81? please change back to 80 :(
39a0ca4
to
6faa732
Compare
The commit message needs to framed better also the extra tab space makes it look more weird |
tried running this locally, it fails for some reason: The test fails: $ kompose version
0.6.0 (6faa732)
$ make test-cmd
./script/test/cmd/tests.sh
...
===> Starting test <===
convert::expect_success_and_warning: Running: 'kompose convert -f
/home/hummer/go/src/github.com/kubernetes-incubator/kompose/script/test/fixtures/change-in-volume/docker-compose.yml
--stdout -j' expected_output:
'/home/hummer/go/src/github.com/kubernetes-incubator/kompose/script/test/fixtures/change-in-volume/output-k8s.json'
expected_warning: 'Volume mount on the host "." isn't supported - ignoring path on the host'
FAIL: converted output does not match
... So when I tried re-generating the regenerate: ✔ ~/go/src/github.com/kubernetes-incubator/kompose/script/test/fixtures/change-in-volume [pr_603 L|✔]
12:02 $ kompose convert --stdout -j > ./output-k8s.json
WARN Volume mount on the host "." isn't supported - ignoring path on the host
✔ ~/go/src/github.com/kubernetes-incubator/kompose/script/test/fixtures/change-in-volume [pr_603 L|✚ 1] diff: $ git diff
diff --git a/script/test/fixtures/change-in-volume/output-k8s.json b/script/test/fixtures/change-in-volume/output-k8s.json
index ea27825..6ee4489 100644
--- a/script/test/fixtures/change-in-volume/output-k8s.json
+++ b/script/test/fixtures/change-in-volume/output-k8s.json
@@ -61,10 +61,7 @@
"apiVersion": "extensions/v1beta1",
"metadata": {
"name": "redis",
- "creationTimestamp": null,
- "labels": {
- "io.kompose.service": "redis"
- }
+ "creationTimestamp": null
},
"spec": {
"replicas": 1,
@@ -95,10 +92,7 @@
"apiVersion": "extensions/v1beta1",
"metadata": {
"name": "web",
- "creationTimestamp": null,
- "labels": {
- "io.kompose.service": "web"
- }
+ "creationTimestamp": null
},
"spec": {
"replicas": 1, |
6faa732
to
4baf4fe
Compare
if volumes in docker file is defined as volumes: - .:/code Then the PVC created by kompose will containes .(dot) in it. .-persistentvolumeclaim.yaml
4baf4fe
to
c40bb4b
Compare
@surajssd can you review it again when you get some time, I have updated the PR. |
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.
LGTM
waiting on @cdrage to approve and merge! |
Awesome :) |
LGTM 👍 |
@cdrage you need to approve to merge this! |
If the
docker-compose.yml
hasvolumes
defined like thisThen
pvc
generated bykompose
will be like.-persistentvolumeclaim.yaml
. This PR handles the.(dot)
in thepvc
name.docker-compose.yml
file usedMaster output
This PR output.
Fixes: #584
cc: @surajssd @cdrage @surajnarwade