bug: fix annotation bug (#1887)

#### What type of PR is this?

<!--
Add one of the following kinds:
/kind bug
/kind cleanup
/kind documentation
/kind feature
-->

#### What this PR does / why we need it:

When supplying a label in the compose file, it should stay in the output
too.

#### Which issue(s) this PR fixes:
<!--
*Automatically closes linked issue when PR is merged.
Usage: `Fixes #<issue number>`, or `Fixes (paste link of issue)`.
-->

Fixes https://github.com/kubernetes/kompose/issues/1885

#### Special notes for your reviewer:

Signed-off-by: Charlie Drage <charlie@charliedrage.com>
This commit is contained in:
Charlie Drage
2024-06-02 20:46:39 +02:00
committed by GitHub
parent 50ec43d1e0
commit 1f7441845e
7 changed files with 71 additions and 7 deletions
+7
View File
@@ -0,0 +1,7 @@
services:
app:
image: node:18-alpine
ports:
- 3000:3000
labels:
- "com.example.label=foo"
+47
View File
@@ -0,0 +1,47 @@
---
apiVersion: v1
kind: Service
metadata:
annotations:
com.example.label: foo
labels:
io.kompose.service: app
name: app
spec:
ports:
- name: "3000"
port: 3000
targetPort: 3000
selector:
io.kompose.service: app
---
apiVersion: apps/v1
kind: Deployment
metadata:
annotations:
com.example.label: foo
labels:
io.kompose.service: app
name: app
spec:
replicas: 1
selector:
matchLabels:
io.kompose.service: app
template:
metadata:
annotations:
com.example.label: foo
labels:
io.kompose.network/label-default: "true"
io.kompose.service: app
spec:
containers:
- image: node:18-alpine
name: app
ports:
- containerPort: 3000
protocol: TCP
restartPolicy: Always