Merge branch 'master' into patch-1

This commit is contained in:
Matt Trower
2018-08-06 10:32:56 -06:00
committed by GitHub
148 changed files with 9828 additions and 12700 deletions

View File

@@ -63,7 +63,7 @@ func (p *FargateProvider) loadConfigFile(filePath string) error {
return err
}
// loadConfigStream loads the given Fargate provider TOML configuration stream.
// loadConfig loads the given Fargate provider TOML configuration stream.
func (p *FargateProvider) loadConfig(r io.Reader) error {
var config providerConfig
var q resource.Quantity

View File

@@ -52,6 +52,18 @@ func newContainer(spec *corev1.Container) (*container, error) {
cntr.definition.WorkingDirectory = aws.String(spec.WorkingDir)
}
// Add environment variables.
if spec.Env != nil {
for _, env := range spec.Env {
cntr.definition.Environment = append(
cntr.definition.Environment,
&ecs.KeyValuePair{
Name: aws.String(env.Name),
Value: aws.String(env.Value),
})
}
}
// Translate the Kubernetes container resource requirements to Fargate units.
cntr.setResourceRequirements(&spec.Resources)

View File

@@ -32,6 +32,10 @@ var (
Command: []string{"anyCmd"},
Args: []string{"anyArg1", "anyArg2"},
WorkingDir: "/any/working/dir",
Env: []corev1.EnvVar{
{Name: "anyEnvName1", Value: "anyEnvValue1"},
{Name: "anyEnvName2", Value: "anyEnvValue2"},
},
}
)
@@ -46,8 +50,17 @@ func TestContainerDefinition(t *testing.T) {
assert.Equal(t, cntrSpec.Name, *cntr.definition.Name, "incorrect name")
assert.Equal(t, cntrSpec.Image, *cntr.definition.Image, "incorrect image")
assert.Equal(t, cntrSpec.Command[0], *cntr.definition.EntryPoint[0], "incorrect command")
assert.Equal(t, cntrSpec.Args[0], *cntr.definition.Command[0], "incorrect args")
for i, env := range cntrSpec.Args {
assert.Equal(t, env, *cntr.definition.Command[i], "incorrect args")
}
assert.Equal(t, cntrSpec.WorkingDir, *cntr.definition.WorkingDirectory, "incorrect working dir")
for i, env := range cntrSpec.Env {
assert.Equal(t, env.Name, *cntr.definition.Environment[i].Name, "incorrect env name")
assert.Equal(t, env.Value, *cntr.definition.Environment[i].Value, "incorrect env value")
}
}
// TestContainerResourceRequirementsDefaults verifies whether the container gets default CPU

View File

@@ -178,17 +178,18 @@ func (p *FargateProvider) GetContainerLogs(namespace, podName, containerName str
return p.cluster.GetContainerLogs(namespace, podName, containerName, tail)
}
// Get full pod name as defined in the provider context
// GetPodFullName retrieves the full pod name as defined in the provider context.
func (p *FargateProvider) GetPodFullName(namespace string, pod string) string {
return ""
}
// ExecInContainer executes a command in a container in the pod, copying data
// between in/out/err and the container's stdin/stdout/stderr.
// TODO: Implementation
func (p *FargateProvider) ExecInContainer(name string, uid types.UID, container string, cmd []string, in io.Reader, out, err io.WriteCloser, tty bool, resize <-chan remotecommand.TerminalSize, timeout time.Duration) error {
log.Printf("receive ExecInContainer %q\n", container)
return nil
func (p *FargateProvider) ExecInContainer(
name string, uid types.UID, container string, cmd []string, in io.Reader, out, err io.WriteCloser,
tty bool, resize <-chan remotecommand.TerminalSize, timeout time.Duration) error {
log.Printf("Received ExecInContainer request for %s.\n", container)
return errNotImplemented
}
// GetPodStatus retrieves the status of a pod by name from the provider.

View File

@@ -237,7 +237,13 @@ func TestAWSFargateProviderPodLifecycle(t *testing.T) {
"/bin/sh",
},
Args: []string{
"-c", "echo \"Started\"; while true; do sleep 1; done",
"-c",
"echo \"Started\";" +
"echo \"TEST_ENV=$TEST_ENV\";" +
"while true; do sleep 1; done",
},
Env: []v1.EnvVar{
{Name: "TEST_ENV", Value: "AnyValue"},
},
Resources: v1.ResourceRequirements{
Limits: v1.ResourceList{
@@ -281,8 +287,18 @@ func TestAWSFargateProviderPodLifecycle(t *testing.T) {
t.Error(err)
}
if logs != "Started\n" {
t.Errorf("Expected logs to be \"Started\\n\", but received \"%v\"", logs)
// Test log output.
receivedLogs := strings.Split(logs, "\n")
expectedLogs := []string{
"Started",
pod.Spec.Containers[0].Env[0].Name + "=" + pod.Spec.Containers[0].Env[0].Value,
}
for i, line := range receivedLogs {
fmt.Printf("Log[#%d]: %v\n", i, line)
if len(expectedLogs) > i && receivedLogs[i] != expectedLogs[i] {
t.Errorf("Expected log line %d to be %q, but received %q", i, line, receivedLogs[i])
}
}
// Delete the pod.

View File

@@ -1,12 +1,12 @@
# Kubernetes Virtual Kubelet with Service Fabric Mesh
[Service Fabric Mesh](https://docs.microsoft.com/en-us/azure/service-fabric-mesh/service-fabric-mesh-overview) is a fully managed service that enables developers to deploy microservices applications without managing virtual machines, storage, or networking. Applications hosted on Service Fabric Mesh run and scale without you worrying about the infrastructure powering it.
[Service Fabric Mesh](https://docs.microsoft.com/en-us/azure/service-fabric-mesh/service-fabric-mesh-overview) is a fully managed service that enables developers to deploy microservices applications without managing virtual machines, storage, or networking. Applications hosted on Service Fabric Mesh run and scale without you worrying about the infrastructure powering them.
The Virtual kubelet integration allows you to use the Kubernetes API to burst out compute to Service Fabric Mesh and schedule pods as Mesh Applications.
## Status: Experimental
This provider is currently in the exterimental stages. Contributions welcome!
This provider is currently in the experimental stages. Contributions are welcome!
## Setup

View File

@@ -49,7 +49,7 @@ type VicProvider struct {
client *client.PortLayer
imageStore proxy.ImageStore
isolationProxy proxy.IsolationProxy
systemProxy vicproxy.VicSystemProxy
systemProxy *vicproxy.VicSystemProxy
}
const (