fix issue https://github.com/kubernetes/kompose/issues/1683#1684
fix issue https://github.com/kubernetes/kompose/issues/1683#1684cdrage merged 6 commits intokubernetes:mainfrom
Conversation
AhmedGrati
left a comment
There was a problem hiding this comment.
Thanks for the PR. left some comments.
AhmedGrati
left a comment
There was a problem hiding this comment.
Thanks for the PR @realgam3. It looks good overall, but I think adding unit tests showing how the mentioned issues were fixed should be a great addition. wdyt?
The tests are running on Linux so the windows fix is not relevant to the test. and I already fixed the unit test.
What do you think? |
|
@realgam3 yes please you can add/update existing tests for pod envfile. |
I will, Thank you! Edit: While I'm trying to create test for pod I am using the command: ./kompose -f script/test/fixtures/configmap-pod/docker-compose.yaml convert --stdout -jTo create a JSON file as other tests and I get the error: Is it a known issue? or am I missing something?
|
AhmedGrati
left a comment
There was a problem hiding this comment.
@realgam3 can we change the test output-k8s-template.json to yaml format?
|
Hi, it would be really cool if the commit was merged. Thanks. |
cdrage
left a comment
There was a problem hiding this comment.
Only one comment with regards to using [0] which isn't a good idea.
We also need tests added to kubernetes.go
Sorry for the delayed response in review! It's been a busy couple of weeks.
| // InitConfigMapForEnv initializes a ConfigMap object | ||
| func (k *Kubernetes) InitConfigMapForEnv(name string, opt kobject.ConvertOptions, envFile string) *api.ConfigMap { | ||
| envs, err := GetEnvsFromFile(envFile) | ||
| workDir := filepath.Dir(opt.InputFiles[0]) |
There was a problem hiding this comment.
Using opt.InputFiles[0] throughout the code is kinda scary, I'd advise that we check to see that it's not an empty array.
What would be better is putting this into a function instead similar to
kompose/pkg/transformer/utils.go
Line 331 in ddd5f33
There was a problem hiding this comment.
One question?
How you can convert docker-compose files without files?
If opt.InputFiles is empty there is nothing to do... if there is a way to use stdin to get the the docker-compose file that's another issue and we need to prepare for it.
GetComposeFileDir also Doesn't check if the InputFiles is empty and it needs to be fixed because it search for / and it will not find it in windows... it's really bad idea to do path operations yourself.
But if you want me to do more checks let me know...
There was a problem hiding this comment.
Just checking to see if opt.InputFiles is empty and then fail is enough.
It's just odd having it check the first element of the array.
|
ping @realgam3. Any updates on this? |
5588708 to
f445590
Compare
Done |
|
@cdrage, @AhmedGrati anything else you need from me? |
|
@realgam3 gonna review it ASAP. |
Any updates / comments? |
AhmedGrati
left a comment
There was a problem hiding this comment.
Leaving final approve to @cdrage!
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: AhmedGrati, cdrage, realgam3 The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
What type of PR is this?
/kind bug
Which issue(s) this PR fixes:
Fixes #1683
Special notes for your reviewer:
\to Linux paths/