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

remove status field from generated yaml #1746

Merged
merged 4 commits into from
Oct 30, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions pkg/transformer/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"os/exec"
"path"
"path/filepath"
"regexp"
"strings"

dockerlib "github.com/fsouza/go-dockerclient"
Expand Down Expand Up @@ -274,6 +275,10 @@ func ConfigAnnotations(service kobject.ServiceConfig) map[string]string {
// Print either prints to stdout or to file/s
func Print(name, path string, trailing string, data []byte, toStdout, generateJSON bool, f *os.File, provider string) (string, error) {
file := ""
// simple hack to remove status from the output
shubhindia marked this conversation as resolved.
Show resolved Hide resolved
re := regexp.MustCompile(`(?s)status:.*`)
data = re.ReplaceAll(data, nil)

if generateJSON {
file = fmt.Sprintf("%s-%s.json", name, trailing)
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ spec:
targetPort: 0
selector:
io.kompose.service: redis
status:
loadBalancer: {}


---
apiVersion: v1
Expand All @@ -34,8 +33,7 @@ spec:
targetPort: 5000
selector:
io.kompose.service: web
status:
loadBalancer: {}


---
apiVersion: apps/v1
Expand Down Expand Up @@ -67,7 +65,7 @@ spec:
name: redis
resources: {}
restartPolicy: Always
status: {}


---
apiVersion: apps/v1
Expand Down Expand Up @@ -109,5 +107,5 @@ spec:
volumes:
- emptyDir: {}
name: code-volume
status: {}


10 changes: 4 additions & 6 deletions script/test/fixtures/change-in-volume/output-k8s.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ spec:
targetPort: 0
selector:
io.kompose.service: redis
status:
loadBalancer: {}


---
apiVersion: v1
Expand All @@ -34,8 +33,7 @@ spec:
targetPort: 5000
selector:
io.kompose.service: web
status:
loadBalancer: {}


---
apiVersion: apps/v1
Expand Down Expand Up @@ -67,7 +65,7 @@ spec:
name: redis
resources: {}
restartPolicy: Always
status: {}


---
apiVersion: apps/v1
Expand Down Expand Up @@ -109,5 +107,5 @@ spec:
volumes:
- emptyDir: {}
name: code-volume
status: {}


Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ spec:
targetPort: 0
selector:
io.kompose.service: redis
status:
loadBalancer: {}


---
apiVersion: v1
Expand All @@ -34,8 +33,7 @@ spec:
targetPort: 5000
selector:
io.kompose.service: web
status:
loadBalancer: {}


---
apiVersion: apps.openshift.io/v1
Expand Down Expand Up @@ -76,13 +74,7 @@ spec:
kind: ImageStreamTag
name: redis:latest
type: ImageChange
status:
availableReplicas: 0
latestVersion: 0
observedGeneration: 0
replicas: 0
unavailableReplicas: 0
updatedReplicas: 0


---
apiVersion: image.openshift.io/v1
Expand All @@ -105,8 +97,7 @@ spec:
name: latest
referencePolicy:
type: ""
status:
dockerImageRepository: ""


---
apiVersion: apps.openshift.io/v1
Expand Down Expand Up @@ -159,13 +150,7 @@ spec:
kind: ImageStreamTag
name: web:latest
type: ImageChange
status:
availableReplicas: 0
latestVersion: 0
observedGeneration: 0
replicas: 0
unavailableReplicas: 0
updatedReplicas: 0


---
apiVersion: image.openshift.io/v1
Expand All @@ -188,6 +173,5 @@ spec:
name: latest
referencePolicy:
type: ""
status:
dockerImageRepository: ""


28 changes: 6 additions & 22 deletions script/test/fixtures/change-in-volume/output-os.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ spec:
targetPort: 0
selector:
io.kompose.service: redis
status:
loadBalancer: {}


---
apiVersion: v1
Expand All @@ -34,8 +33,7 @@ spec:
targetPort: 5000
selector:
io.kompose.service: web
status:
loadBalancer: {}


---
apiVersion: apps.openshift.io/v1
Expand Down Expand Up @@ -76,13 +74,7 @@ spec:
kind: ImageStreamTag
name: redis:latest
type: ImageChange
status:
availableReplicas: 0
latestVersion: 0
observedGeneration: 0
replicas: 0
unavailableReplicas: 0
updatedReplicas: 0


---
apiVersion: image.openshift.io/v1
Expand All @@ -105,8 +97,7 @@ spec:
name: latest
referencePolicy:
type: ""
status:
dockerImageRepository: ""


---
apiVersion: apps.openshift.io/v1
Expand Down Expand Up @@ -159,13 +150,7 @@ spec:
kind: ImageStreamTag
name: web:latest
type: ImageChange
status:
availableReplicas: 0
latestVersion: 0
observedGeneration: 0
replicas: 0
unavailableReplicas: 0
updatedReplicas: 0


---
apiVersion: image.openshift.io/v1
Expand All @@ -188,6 +173,5 @@ spec:
name: latest
referencePolicy:
type: ""
status:
dockerImageRepository: ""


Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ spec:
targetPort: 80
selector:
io.kompose.service: foo
status:
loadBalancer: {}


---
apiVersion: apps/v1
Expand Down Expand Up @@ -53,5 +52,5 @@ spec:
protocol: TCP
resources: {}
restartPolicy: Always
status: {}


5 changes: 2 additions & 3 deletions script/test/fixtures/compose-file-support/output-k8s.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ spec:
targetPort: 80
selector:
io.kompose.service: web
status:
loadBalancer: {}


---
apiVersion: apps/v1
Expand Down Expand Up @@ -46,5 +45,5 @@ spec:
protocol: TCP
resources: {}
restartPolicy: Always
status: {}


Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ spec:
path: configs.tar
name: db-cm0
name: db-cm0
status: {}


---
apiVersion: v1
Expand Down Expand Up @@ -102,7 +102,7 @@ spec:
path: test-a-key.key
name: web-cm1
name: web-cm1
status: {}


---
apiVersion: v1
Expand Down
4 changes: 2 additions & 2 deletions script/test/fixtures/configmap-volume/output-k8s.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ spec:
path: configs.tar
name: db-cm0
name: db-cm0
status: {}


---
apiVersion: v1
Expand Down Expand Up @@ -94,7 +94,7 @@ spec:
path: test-a-key.key
name: web-cm1
name: web-cm1
status: {}


---
apiVersion: v1
Expand Down
22 changes: 4 additions & 18 deletions script/test/fixtures/configmap-volume/output-os-withlabel.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,7 @@ spec:
kind: ImageStreamTag
name: db:latest
type: ImageChange
status:
availableReplicas: 0
latestVersion: 0
observedGeneration: 0
replicas: 0
unavailableReplicas: 0
updatedReplicas: 0


---
apiVersion: image.openshift.io/v1
Expand All @@ -78,8 +72,7 @@ spec:
name: latest
referencePolicy:
type: ""
status:
dockerImageRepository: ""


---
apiVersion: v1
Expand Down Expand Up @@ -150,13 +143,7 @@ spec:
kind: ImageStreamTag
name: web:latest
type: ImageChange
status:
availableReplicas: 0
latestVersion: 0
observedGeneration: 0
replicas: 0
unavailableReplicas: 0
updatedReplicas: 0


---
apiVersion: image.openshift.io/v1
Expand All @@ -179,8 +166,7 @@ spec:
name: latest
referencePolicy:
type: ""
status:
dockerImageRepository: ""


---
apiVersion: v1
Expand Down
22 changes: 4 additions & 18 deletions script/test/fixtures/configmap-volume/output-os.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,7 @@ spec:
kind: ImageStreamTag
name: db:latest
type: ImageChange
status:
availableReplicas: 0
latestVersion: 0
observedGeneration: 0
replicas: 0
unavailableReplicas: 0
updatedReplicas: 0


---
apiVersion: image.openshift.io/v1
Expand All @@ -76,8 +70,7 @@ spec:
name: latest
referencePolicy:
type: ""
status:
dockerImageRepository: ""


---
apiVersion: v1
Expand Down Expand Up @@ -146,13 +139,7 @@ spec:
kind: ImageStreamTag
name: web:latest
type: ImageChange
status:
availableReplicas: 0
latestVersion: 0
observedGeneration: 0
replicas: 0
unavailableReplicas: 0
updatedReplicas: 0


---
apiVersion: image.openshift.io/v1
Expand All @@ -175,8 +162,7 @@ spec:
name: latest
referencePolicy:
type: ""
status:
dockerImageRepository: ""


---
apiVersion: v1
Expand Down
Loading
Loading