-
Notifications
You must be signed in to change notification settings - Fork 771
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add label support to named volumes in docker compose v3 to Kubernetes (…
…#1083) * Support read specific label (kompose.volume.size) from named volume and apply to kubernetes supported volume size * Fix the PVC size in log message when deploy Kubernetes * Skip creation of PersistentVolumeClaim if it is already created in the same kubernetes deploy * Add selector to PersistentVolumeClaim only when specific label (kompose.volume.selector) is used in named volume * Add test case to named-volume for the new labels
- Loading branch information
Showing
6 changed files
with
256 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
script/test/fixtures/volume-mounts/named-volume/docker-compose-v3.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
version: '3' | ||
services: | ||
db: | ||
image: postgres:10.1 | ||
ports: | ||
- "5432" | ||
labels: | ||
kompose.volume.size: 200Mi | ||
volumes: | ||
- db-data:/var/lib/postgresql/data | ||
- db-config:/var/lib/postgresql/config | ||
volumes: | ||
db-data: | ||
labels: | ||
kompose.volume.selector: db-data-dev | ||
kompose.volume.size: 500Mi |
157 changes: 157 additions & 0 deletions
157
script/test/fixtures/volume-mounts/named-volume/output-k8s-v3.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,157 @@ | ||
{ | ||
"kind": "List", | ||
"apiVersion": "v1", | ||
"metadata": {}, | ||
"items": [ | ||
{ | ||
"kind": "Service", | ||
"apiVersion": "v1", | ||
"metadata": { | ||
"name": "db", | ||
"creationTimestamp": null, | ||
"labels": { | ||
"io.kompose.service": "db" | ||
}, | ||
"annotations": { | ||
"kompose.cmd": "%CMD%", | ||
"kompose.version": "%VERSION%", | ||
"kompose.volume.size": "200Mi" | ||
} | ||
}, | ||
"spec": { | ||
"ports": [ | ||
{ | ||
"name": "5432", | ||
"port": 5432, | ||
"targetPort": 5432 | ||
} | ||
], | ||
"selector": { | ||
"io.kompose.service": "db" | ||
} | ||
}, | ||
"status": { | ||
"loadBalancer": {} | ||
} | ||
}, | ||
{ | ||
"kind": "Deployment", | ||
"apiVersion": "extensions/v1beta1", | ||
"metadata": { | ||
"name": "db", | ||
"creationTimestamp": null, | ||
"labels": { | ||
"io.kompose.service": "db" | ||
}, | ||
"annotations": { | ||
"kompose.cmd": "%CMD%", | ||
"kompose.version": "%VERSION%", | ||
"kompose.volume.size": "200Mi" | ||
} | ||
}, | ||
"spec": { | ||
"replicas": 1, | ||
"template": { | ||
"metadata": { | ||
"creationTimestamp": null, | ||
"labels": { | ||
"io.kompose.service": "db" | ||
} | ||
}, | ||
"spec": { | ||
"volumes": [ | ||
{ | ||
"name": "db-data", | ||
"persistentVolumeClaim": { | ||
"claimName": "db-data" | ||
} | ||
}, | ||
{ | ||
"name": "db-config", | ||
"persistentVolumeClaim": { | ||
"claimName": "db-config" | ||
} | ||
} | ||
], | ||
"containers": [ | ||
{ | ||
"name": "db", | ||
"image": "postgres:10.1", | ||
"ports": [ | ||
{ | ||
"containerPort": 5432 | ||
} | ||
], | ||
"resources": {}, | ||
"volumeMounts": [ | ||
{ | ||
"name": "db-data", | ||
"mountPath": "/var/lib/postgresql/data" | ||
}, | ||
{ | ||
"name": "db-config", | ||
"mountPath": "/var/lib/postgresql/config" | ||
} | ||
] | ||
} | ||
], | ||
"restartPolicy": "Always" | ||
} | ||
}, | ||
"strategy": { | ||
"type": "Recreate" | ||
} | ||
}, | ||
"status": {} | ||
}, | ||
{ | ||
"kind": "PersistentVolumeClaim", | ||
"apiVersion": "v1", | ||
"metadata": { | ||
"name": "db-data", | ||
"creationTimestamp": null, | ||
"labels": { | ||
"io.kompose.service": "db-data" | ||
} | ||
}, | ||
"spec": { | ||
"accessModes": [ | ||
"ReadWriteOnce" | ||
], | ||
"selector": { | ||
"matchLabels": { | ||
"io.kompose.service": "db-data-dev" | ||
} | ||
}, | ||
"resources": { | ||
"requests": { | ||
"storage": "500Mi" | ||
} | ||
} | ||
}, | ||
"status": {} | ||
}, | ||
{ | ||
"kind": "PersistentVolumeClaim", | ||
"apiVersion": "v1", | ||
"metadata": { | ||
"name": "db-config", | ||
"creationTimestamp": null, | ||
"labels": { | ||
"io.kompose.service": "db-config" | ||
} | ||
}, | ||
"spec": { | ||
"accessModes": [ | ||
"ReadWriteOnce" | ||
], | ||
"resources": { | ||
"requests": { | ||
"storage": "200Mi" | ||
} | ||
} | ||
}, | ||
"status": {} | ||
} | ||
] | ||
} |