- Add support for kubernetes for docker stack command - Update to go 1.9 - Add kubernetes to vendors - Print orchestrator in docker version command Signed-off-by: Vincent Demeester <vincent@sbr.pm> Signed-off-by: Silvin Lubecki <silvin.lubecki@docker.com>
42 lines
945 B
Go
42 lines
945 B
Go
package kubernetes
|
|
|
|
import (
|
|
"github.com/docker/cli/cli/command/stack/kubernetes/api/labels"
|
|
apiv1 "k8s.io/api/core/v1"
|
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
|
)
|
|
|
|
// toConfigMap converts a Compose Config to a Kube ConfigMap.
|
|
func toConfigMap(stackName, name, key string, content []byte) *apiv1.ConfigMap {
|
|
return &apiv1.ConfigMap{
|
|
TypeMeta: metav1.TypeMeta{
|
|
Kind: "ConfigMap",
|
|
APIVersion: "v1",
|
|
},
|
|
ObjectMeta: metav1.ObjectMeta{
|
|
Name: name,
|
|
Labels: map[string]string{
|
|
labels.ForStackName: stackName,
|
|
},
|
|
},
|
|
Data: map[string]string{
|
|
key: string(content),
|
|
},
|
|
}
|
|
}
|
|
|
|
// toSecret converts a Compose Secret to a Kube Secret.
|
|
func toSecret(stackName, name, key string, content []byte) *apiv1.Secret {
|
|
return &apiv1.Secret{
|
|
ObjectMeta: metav1.ObjectMeta{
|
|
Name: name,
|
|
Labels: map[string]string{
|
|
labels.ForStackName: stackName,
|
|
},
|
|
},
|
|
Data: map[string][]byte{
|
|
key: content,
|
|
},
|
|
}
|
|
}
|