Orborus autodeploy pipeline
This commit is contained in:
@@ -110,6 +110,7 @@ var pipelineUrl = os.Getenv("SHUFFLE_PIPELINE_URL")
|
|||||||
var executionIds = []string{}
|
var executionIds = []string{}
|
||||||
var pipelines = []shuffle.PipelineInfoMini{}
|
var pipelines = []shuffle.PipelineInfoMini{}
|
||||||
var namespacemade = false // For K8s
|
var namespacemade = false // For K8s
|
||||||
|
var skipPipelineMount = false
|
||||||
|
|
||||||
var dockercli *dockerclient.Client
|
var dockercli *dockerclient.Client
|
||||||
var containerId string
|
var containerId string
|
||||||
@@ -2838,8 +2839,22 @@ func createAndStartTenzirNode(ctx context.Context, containerName, imageName stri
|
|||||||
anyFound = true
|
anyFound = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tenzirStorageFolder := os.Getenv("SHUFFLE_STORAGE_FOLDER")
|
||||||
|
if len(tenzirStorageFolder) > 0 {
|
||||||
|
tenzirStorageFolder = tenzirStorageFolder
|
||||||
|
|
||||||
|
if !strings.HasSuffix(tenzirStorageFolder, "/") {
|
||||||
|
tenzirStorageFolder = tenzirStorageFolder + "/"
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
tenzirStorageFolder = "/tmp/tenzir/"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if !anyFound {
|
if !anyFound {
|
||||||
log.Printf("[DEBUG] No Tenzir Plugin environment variables found.")
|
log.Printf("[DEBUG] No Tenzir Plugin environment variables found.")
|
||||||
|
} else {
|
||||||
|
//log.Printf("[DEBUG] Attempting Tenzir connection with app.tenzir.com tenant '%s'", tenzirPluginsPlatform)
|
||||||
}
|
}
|
||||||
|
|
||||||
hostConfig := &container.HostConfig{
|
hostConfig := &container.HostConfig{
|
||||||
@@ -2850,10 +2865,20 @@ func createAndStartTenzirNode(ctx context.Context, containerName, imageName stri
|
|||||||
},
|
},
|
||||||
Mounts: []mount.Mount{
|
Mounts: []mount.Mount{
|
||||||
{
|
{
|
||||||
Type: mount.TypeVolume,
|
Type: "bind",
|
||||||
Source: containerName,
|
Source: tenzirStorageFolder,
|
||||||
Target: "/var/lib/tenzir/",
|
Target: "/var/lib/tenzir/",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
Type: "bind",
|
||||||
|
Source: tenzirStorageFolder,
|
||||||
|
Target: "/var/log/tenzir/",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Type: "bind",
|
||||||
|
Source: tenzirStorageFolder,
|
||||||
|
Target: "/var/cache/tenzir/",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
VolumeDriver: "local",
|
VolumeDriver: "local",
|
||||||
RestartPolicy: container.RestartPolicy{
|
RestartPolicy: container.RestartPolicy{
|
||||||
@@ -2861,6 +2886,10 @@ func createAndStartTenzirNode(ctx context.Context, containerName, imageName stri
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if skipPipelineMount {
|
||||||
|
hostConfig.Mounts = []mount.Mount{}
|
||||||
|
}
|
||||||
|
|
||||||
networkingConfig := &network.NetworkingConfig{
|
networkingConfig := &network.NetworkingConfig{
|
||||||
EndpointsConfig: map[string]*network.EndpointSettings{
|
EndpointsConfig: map[string]*network.EndpointSettings{
|
||||||
"tenzir-network": {
|
"tenzir-network": {
|
||||||
@@ -2873,6 +2902,13 @@ func createAndStartTenzirNode(ctx context.Context, containerName, imageName stri
|
|||||||
|
|
||||||
_, err := dockercli.ContainerCreate(ctx, config, hostConfig, networkingConfig, nil, containerName)
|
_, err := dockercli.ContainerCreate(ctx, config, hostConfig, networkingConfig, nil, containerName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
if strings.Contains(err.Error(), "path does not exist") {
|
||||||
|
log.Printf("[ERROR] Not using permanent pipeline storage as storage folder /opt/tenzir/ does not exist. If you want permanent storage, create the /opt/tendir/ folder then restart Orborus. Raw: %s", err)
|
||||||
|
skipPipelineMount = true
|
||||||
|
} else {
|
||||||
|
log.Printf("[ERROR] Failed to create Tenzir Node container: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2886,6 +2922,7 @@ func createAndStartTenzirNode(ctx context.Context, containerName, imageName stri
|
|||||||
time.Sleep(10 * time.Second)
|
time.Sleep(10 * time.Second)
|
||||||
err = checkTenzirNode()
|
err = checkTenzirNode()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
log.Printf("[ERROR] Tenzir node is not available during deployment: %s", err)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user