-
Notifications
You must be signed in to change notification settings - Fork 764
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 issue https://github.com/kubernetes/kompose/issues/1683 #1684
Conversation
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.
Thanks for the PR. left some comments.
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.
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 -j To create a JSON file as other tests and I get the error:
Is it a known issue? or am I missing something?
|
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.
@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. |
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.
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.
@@ -220,7 +220,8 @@ func (k *Kubernetes) InitSvc(name string, service kobject.ServiceConfig) *api.Se | |||
|
|||
// 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
// GetComposeFileDir returns compose file directory |
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
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.
It's now ready
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? |
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.
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
Needs 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/