Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upDon't loose additional metadata fields when read/writing contexts metadata #2572
Conversation
Signed-off-by: Simon Ferquel <simon.ferquel@docker.com>
|
LGTM |
|
LGTM |
|
LGTM |
- What I did
Make the cli accept additional (untyped) fields in its contexts metadata. Primary goal is to unlock interoperability with our Docker experience for Azure ACI work, which needs to add some metadata into docker contexts to work properly.
The fact that additional fields where not supported previously is actually a bug I introduced when introducing "typed endpoints and contexts metadata".
- How I did it
DockerContext struct now has a custom implementation of json.Marshaler and json.Unmarshaler, keeping addition fields in a map.
- How to verify it
docker context create test --from=default~/.docker/contexts/meta/9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08/meta.json) to add fields in the "metadata" object such as{"Name":"test","Metadata":{"StackOrchestrator":"swarm","AdditionalKey":"Value"},"Endpoints":{"docker":{"Host":"unix:///var/run/docker.sock","SkipTLSVerify":false}}}docker context inspect testwith the modification should have the AdditionalKey field in its output.docker context update test --description=fooshould not drop the AdditionalKey field anymore.- Description for the changelog
- A picture of a cute animal (not mandatory but encouraged)