Create a provider to use Azure Batch (#133)
* Started work on provider * WIP Adding batch provider * Working basic call into pool client. Need to parameterize the baseurl * Fixed job creation by manipulating the content-type * WIP Kicking off containers. Dirty * [wip] More meat around scheduling simple containers. * Working on basic task wrapper to co-schedule pods * WIP on task wrapper * WIP * Working pod minimal wrapper for batch * Integrate pod template code into provider * Cleaning up * Move to docker without gpu * WIP batch integration * partially working * Working logs * Tidy code * WIP: Testing and readme * Added readme and terraform deployment for GPU Azure Batch pool. * Update to enable low priority nodes for gpu * Fix log formatting bug. Return node logs when container not yet started * Moved to golang v1.10 * Fix cri test * Fix up minor docs Issue. Add provider to readme. Add var for vk image.
This commit is contained in:
committed by
Robbie Zhang
parent
1ad6fb434e
commit
d6e8b3daf7
126
providers/azurebatch/deployment/virtualkubelet/main.tf
Normal file
126
providers/azurebatch/deployment/virtualkubelet/main.tf
Normal file
@@ -0,0 +1,126 @@
|
||||
provider "kubernetes" {
|
||||
host = "${var.cluster_host}"
|
||||
|
||||
client_certificate = "${var.cluster_client_certificate}"
|
||||
client_key = "${var.cluster_client_key}"
|
||||
cluster_ca_certificate = "${var.cluster_ca}"
|
||||
}
|
||||
|
||||
resource "kubernetes_secret" "vkcredentials" {
|
||||
metadata {
|
||||
name = "vkcredentials"
|
||||
}
|
||||
|
||||
data {
|
||||
cert.pem = "${var.cluster_client_certificate}"
|
||||
key.pem = "${var.cluster_client_key}"
|
||||
}
|
||||
}
|
||||
|
||||
resource "kubernetes_deployment" "vkdeployment" {
|
||||
metadata {
|
||||
name = "vkdeployment"
|
||||
}
|
||||
|
||||
spec {
|
||||
selector {
|
||||
app = "virtualkubelet"
|
||||
}
|
||||
|
||||
template {
|
||||
metadata {
|
||||
labels {
|
||||
app = "virtualkubelet"
|
||||
}
|
||||
}
|
||||
|
||||
spec {
|
||||
container {
|
||||
name = "vk"
|
||||
image = "${var.virtualkubelet_docker_image}"
|
||||
|
||||
args = [
|
||||
"--provider",
|
||||
"azurebatch",
|
||||
"--taint",
|
||||
"azure.com/batch",
|
||||
"--namespace",
|
||||
"default",
|
||||
]
|
||||
|
||||
port {
|
||||
container_port = 10250
|
||||
protocol = "TCP"
|
||||
name = "kubeletport"
|
||||
}
|
||||
|
||||
volume_mount {
|
||||
name = "azure-credentials"
|
||||
mount_path = "/etc/aks/azure.json"
|
||||
}
|
||||
|
||||
volume_mount {
|
||||
name = "credentials"
|
||||
mount_path = "/etc/virtual-kubelet"
|
||||
}
|
||||
|
||||
env = [
|
||||
{
|
||||
name = "AZURE_BATCH_ACCOUNT_LOCATION"
|
||||
value = "${var.resource_group_location}"
|
||||
},
|
||||
{
|
||||
name = "AZURE_BATCH_ACCOUNT_NAME"
|
||||
value = "${var.azure_batch_account_name}"
|
||||
},
|
||||
{
|
||||
name = "AZURE_BATCH_POOLID"
|
||||
value = "${var.azure_batch_pool_id}"
|
||||
},
|
||||
{
|
||||
name = "KUBELET_PORT"
|
||||
value = "10250"
|
||||
},
|
||||
{
|
||||
name = "AZURE_CREDENTIALS_LOCATION"
|
||||
value = "/etc/aks/azure.json"
|
||||
},
|
||||
{
|
||||
name = "APISERVER_CERT_LOCATION"
|
||||
value = "/etc/virtual-kubelet/cert.pem"
|
||||
},
|
||||
{
|
||||
name = "APISERVER_KEY_LOCATION"
|
||||
value = "/etc/virtual-kubelet/key.pem"
|
||||
},
|
||||
{
|
||||
name = "VKUBELET_POD_IP"
|
||||
|
||||
value_from {
|
||||
field_ref {
|
||||
field_path = "status.podIP"
|
||||
}
|
||||
}
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
volume {
|
||||
name = "azure-credentials"
|
||||
|
||||
host_path {
|
||||
path = "/etc/kubernetes/azure.json"
|
||||
}
|
||||
}
|
||||
|
||||
volume {
|
||||
name = "credentials"
|
||||
|
||||
secret {
|
||||
secret_name = "vkcredentials"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user