Skip to content

Commit

Permalink
fix: docker entrypoint/command to kube command/args
Browse files Browse the repository at this point in the history
As referred in CorentinTh/it-tools#890 (comment):
- `entrypoint` in Docker Compose is `command` in Kubernetes
- `command` in Docker Compose is `args` in Kubernetes
  • Loading branch information
sharevb committed Feb 18, 2024
1 parent dbdce0f commit 2e33837
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,10 @@ export function convert(yaml: string): string {
const container: Iok8SApiCoreV1Container = {} as Iok8SApiCoreV1Container;
container.name = name;
container.image = service.image || 'PLACEHOLDER';
container.command = typeof service.command === 'string' ?
container.args = typeof service.command === 'string' ?
parseCommand(service.command) :
service.command === null ? undefined : service.command;
container.entrypoint = typeof service.entrypoint === 'string' ?
container.command = typeof service.entrypoint === 'string' ?
service.entrypoint.split(/\s+/) :
service.entrypoint === null ? undefined : service.entrypoint;

Expand Down
4 changes: 3 additions & 1 deletion test/__snapshots__/index.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,12 @@ spec:
containers:
- name: frontend
image: awesome/webapp
command:
args:
- echo
- hello
- world
command:
- /bin/sh
volumeMounts:
- name: httpd-config
mountPath: /httpd-config
Expand Down
1 change: 1 addition & 0 deletions test/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ describe('convert', () => {
- httpd-config
secrets:
- server-certificate
entrypoint: /bin/sh
command: echo hello world
deploy:
replicas: 3
Expand Down

0 comments on commit 2e33837

Please sign in to comment.