in src/Cli/func/Actions/DeployActions/Platforms/KubernetesPlatform.cs [131:205]
private DeploymentV1Apps GetDeployment(string name, string image, double cpu, int memory, string port, string nameSpace, int min, string pullSecret)
{
var deployment = new DeploymentV1Apps
{
ApiVersion = "apps/v1beta1",
Kind = "Deployment",
Metadata = new ObjectMetadataV1
{
Namespace = nameSpace,
Name = name,
Labels = new Dictionary<string, string>
{
{ "app", name }
}
},
Spec = new DeploymentSpecV1Apps
{
Replicas = min,
Selector = new SelectorV1
{
MatchLabels = new Dictionary<string, string>
{
{ "app", name }
}
},
Template = new PodTemplateV1
{
Metadata = new ObjectMetadataV1
{
Labels = new Dictionary<string, string>
{
{ "app", name }
}
},
Spec = new PodTemplateSpecV1
{
Containers =
[
new ContainerV1
{
Name = name,
Image = image,
Resources = new ContainerResourcesV1()
{
Requests = new ContainerResourceRequestsV1()
{
Cpu = cpu.ToString(),
Memory = $"{memory}Mi"
}
},
Ports = string.IsNullOrEmpty(port)
? Array.Empty<ContainerPortV1>()
: [new ContainerPortV1 { ContainerPort = int.Parse(port) }],
}
],
Tolerations =
[
new PodTolerationV1
{
Key = "azure.com/aci",
Effect = "NoSchedule"
}
],
ImagePullSecrets = string.IsNullOrEmpty(pullSecret)
? null
: new ImagePullSecretV1[] { new ImagePullSecretV1 { Name = pullSecret } }
}
}
}
};
return deployment;
}