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

docs(cli): introduce examples in the kompose command #1808

Merged
merged 3 commits into from
Jan 19, 2024

Conversation

martinjirku
Copy link
Contributor

@martinjirku martinjirku commented Jan 17, 2024

What type of PR is this?

/kind documentation

What this PR does / why we need it:

This PR adds few basic examples to the cli command.

Which issue(s) this PR fixes:

Fixes #1717

Special notes for your reviewer:

I've considered to update Long instead adding the Examples field. However, it looked more clear to introduce these few examples. Maybe later, there will be more content to add into Long with specific examples.

The result of running kompose

Kompose is a tool to help users who are familiar with docker-compose move to Kubernetes.

Usage:
  kompose [command]

Examples:
  kompose --file compose.yaml convert
  kompose -f first.yaml -f second.yaml convert
  kompose --provider openshift --file compose.yaml convert
  kompose completion bash

Available Commands:
  completion  Output shell completion code
  convert     Convert a Docker Compose file
  help        Help about any command
  version     Print the version of Kompose

Flags:
      --error-on-warning    Treat any warning as an error
  -f, --file strings        Specify an alternative compose file
  -h, --help                help for kompose
      --provider string     Specify a provider. Kubernetes or OpenShift. (default "kubernetes")
      --suppress-warnings   Suppress all warnings
  -v, --verbose             verbose output

Use "kompose [command] --help" for more information about a command.

The result of kompose convert --help:

./kompose convert --help
Convert a Docker Compose file

Usage:
  kompose convert [flags]

Examples:
  kompose --file compose.yaml convert
  kompose -f first.yaml -f second.yaml convert
  kompose --provider openshift --file compose.yaml convert

Kubernetes Flags:
  -c, --chart                    Create a Helm chart for converted objects
      --controller               Set the output controller ("deployment"|"daemonSet"|"replicationController")
      --service-group-mode       Group multiple service to create single workload by "label"("kompose.service.group") or "volume"(shared volumes)
      --service-group-name       Using with --service-group-mode=volume to specific a final service name for the group

OpenShift Flags:
      --build-branch             Specify repository branch to use for buildconfig (default is current branch name)
      --build-repo               Specify source repository for buildconfig (default is current branch's remote url)
      --insecure-repository      Specify to use insecure docker repository while generating Openshift image stream object

Flags:
      --build string                 Set the type of build ("local"|"build-config"(OpenShift only)|"none") (default "none")
      --build-command string         Set the command used to build the container image. override the docker build command.Should be used in conjuction with --push-command flag.
      --controller string            Set the output controller ("deployment"|"daemonSet"|"replicationController")
      --generate-network-policies    Specify whether to generate network policies or not.
  -h, --help                         help for convert
      --indent int                   Spaces length to indent generated yaml files (default 2)
  -j, --json                         Generate resource files into JSON format
  -n, --namespace string             Specify the namespace of the generated resources
  -o, --out string                   Specify a file name or directory to save objects to (if path does not exist, a file will be created)
      --profile stringArray          Specify the profile to use, can use multiple profiles
      --push-command string          Set the command used to push the container image. override the docker push command. Should be used in conjuction with --build-command flag.
      --push-image                   If we should push the docker image we built
      --push-image-registry string   Specify registry for pushing image, which will override registry from image name.
      --pvc-request-size string      Specify the size of pvc storage requests in the generated resource spec
      --replicas int                 Specify the number of replicas in the generated resource spec (default 1)
      --secrets-as-files             Always convert docker-compose secrets into files instead of symlinked directories.
      --service-group-mode label     Group multiple service to create single workload by label(`kompose.service.group`) or `volume`(shared volumes)
      --service-group-name string    Using with --service-group-mode=volume to specific a final service name for the group
      --stdout                       Print converted objects to stdout
      --volumes string               Volumes to be generated ("persistentVolumeClaim"|"emptyDir"|"hostPath" | "configMap") (default "persistentVolumeClaim")
      --with-kompose-annotation      Add kompose annotations to generated resource (default true)

Global Flags:
      --error-on-warning    Treat any warning as an error
  -f, --file strings        Specify an alternative compose file
      --provider string     Specify a provider. Kubernetes or OpenShift. (default "kubernetes")
      --suppress-warnings   Suppress all warnings
  -v, --verbose             verbose output

@k8s-ci-robot k8s-ci-robot added kind/documentation Categorizes issue or PR as related to documentation. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Jan 17, 2024
@k8s-ci-robot k8s-ci-robot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Jan 17, 2024
cmd/convert.go Outdated
@@ -79,6 +79,9 @@ var (
var convertCmd = &cobra.Command{
Use: "convert",
Short: "Convert a Docker Compose file",
Example: ` kompose --file docker-voting.yml convert
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We've removed the voting and guestbook examples and we're trying to go away from using docker-compose.yml / .yml since compose is an open spec.

I think we should just put compose.yaml as even saying .yml is deprecated.

If that's good with you 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No worries, I will update it, so it will be consistent with the #1803.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated! 🎆

Signed-off-by: Martin Jirku <[email protected]>
@k8s-ci-robot k8s-ci-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Jan 18, 2024
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: cdrage, martinjirku

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jan 19, 2024
@cdrage
Copy link
Member

cdrage commented Jan 19, 2024

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jan 19, 2024
@k8s-ci-robot k8s-ci-robot merged commit 8b3595e into kubernetes:main Jan 19, 2024
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/documentation Categorizes issue or PR as related to documentation. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve --help pages
3 participants