Skip to content
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

[BUG] Kompose should raise and error when profiles are required #1748

Closed
s33kers opened this issue Oct 31, 2023 · 8 comments · Fixed by #1750
Closed

[BUG] Kompose should raise and error when profiles are required #1748

s33kers opened this issue Oct 31, 2023 · 8 comments · Fixed by #1750
Assignees
Labels
kind/bug Categorizes issue or PR as related to a bug.

Comments

@s33kers
Copy link

s33kers commented Oct 31, 2023

Expected Behavior

Resources generated with compose

kompose convert -f docker-compose.yaml -c -v (version 1.29)
output

kompose convert -f docker-compose.yaml -c -v
DEBU Checking validation of provider: kubernetes
DEBU Checking validation of controller:
INFO Network ***-default is detected at Source, shall be converted to equivalent NetworkPolicy at Destination
DEBU Target Dir: docker-compose
INFO Kubernetes file "docker-compose/templates/web-service.yaml" created
INFO Kubernetes file "docker-compose/templates/web-deployment.yaml" created
INFO Kubernetes file "docker-compose/templates/***-default-networkpolicy.yaml" created
INFO chart created in "docker-compose/"

Actual Behavior

No resources generated with compose

kompose convert -f docker-compose.yaml -c -v
output

DEBU Checking validation of provider: kubernetes
DEBU Checking validation of controller:
DEBU Target Dir: docker-compose
INFO chart created in "docker-compose/"

Steps To Reproduce

  1. Create docker-compose.yaml with service and profile
  2. kompose convert -f docker-compose.yaml -c
  3. no templates created

Kompose Version

1.31.2 (a92241f79)
(not working 1.30.0 (9d8dcb518))
(works fine 1.29.0 (997957870))

Docker-Compose file

version: '3'
services:
  web:
    image: nginx
    profiles:
      - test
    ports:
      - 80:80

Anything else?

No response

@s33kers s33kers added the kind/bug Categorizes issue or PR as related to a bug. label Oct 31, 2023
@s33kers s33kers changed the title [BUG] [BUG] docker compose profile breaks convert since kompose 1.30 Oct 31, 2023
@cdrage
Copy link
Member

cdrage commented Oct 31, 2023

@axel7083 @AhmedGrati

@axel7083
Copy link
Contributor

axel7083 commented Oct 31, 2023

What if you use --profile test in your kompose command

@s33kers
Copy link
Author

s33kers commented Oct 31, 2023

Yes, that helped, thanks. I was checking changelog between versions but wasn't aware of such change.

@s33kers s33kers closed this as completed Oct 31, 2023
@AhmedGrati
Copy link
Contributor

Thanks @s33kers for opening the issue and @axel7083 for the followup. I think that it should at least raise an error to make the user aware that something is missing.

@AhmedGrati AhmedGrati reopened this Oct 31, 2023
@AhmedGrati AhmedGrati changed the title [BUG] docker compose profile breaks convert since kompose 1.30 [BUG] Kompose should raise and error when profiles are required Oct 31, 2023
@AhmedGrati AhmedGrati self-assigned this Oct 31, 2023
@AhmedGrati
Copy link
Contributor

After doing some investigations, it seems that compose-go/cli should raise an error when no profile is found, so it's not a behavior that is controlled by Kompose.

@cdrage cdrage reopened this Nov 1, 2023
@cdrage
Copy link
Member

cdrage commented Nov 1, 2023

IMHO it is an error and it currently breaks functionality. kompose convert will not show any output if a profile is not found. Kompose should at least error when trying to convert.

@s33kers
Copy link
Author

s33kers commented Nov 1, 2023

Yes, I would agree with @cdrage as output now is not informative enough. I would say behavior should be same as with docker compose --profile printing no service selected (e.g. with docker-compose.yaml provided in a description). So something similar could be here 🤷

@axel7083
Copy link
Contributor

axel7083 commented Nov 1, 2023

From my memories (need to be fact check) the library used for converting does not allow to know if nothing is output, we could probably some kind of work around to ensure something is produced

or

Parse before using the library, and check if some services have a profile set, and intersect with yhe given --profile arguments and produce warning if none matches or none are provided

PS: I do not have access to a computer until a few day, therefore I cannot help until then

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants