Example #1
0
        static async Task CreateKubeJob(int jobCount = 1)
        {
            if (jobCount <= 0)
            {
                return;
            }

            var job_name = Guid.NewGuid().ToString();

            Console.WriteLine($"Job {job_name} has been created!");
            var job = await kube.CreateJobAsync(job_name, jobCount, jobCount, containerName, containerImage, k8Secret, k8Namespace);
        }
Example #2
0
        static async Task CreateKubeJob(KubeClient kubeClient, ConfigurationKubernetes configuration, string label, int jobCount = 1)
        {
            if (jobCount <= 0)
            {
                return;
            }

            var configMap = await kubeClient.GetConfigMapListAsync(configuration.K8Namespace, configuration.JobConfigMapName);

            if (configMap == null)
            {
                throw new ApplicationException($"Configuration Map '{configuration.JobConfigMapName}' for the nanny queue");
            }

            var job_name = Guid.NewGuid().ToString();

            Console.WriteLine($"Job {job_name} has been created!");
            var job = await kubeClient.CreateJobAsync(job_name, jobCount, 1, configuration.ContainerName, configuration.ContainerImage, configuration.K8Secret, label, configMap.Data, configuration.K8Namespace, configuration.JobCpuRequest, configuration.JobMemRequest, configuration.JobCpuLimit, configuration.JobMemLimit);
        }
Example #3
0
        static async Task CreateKubeJob()
        {
            var job = await kube.CreateJobAsync(Guid.NewGuid().ToString(), 1, 1, "queueconsumer", "twgnanny.azurecr.io/app/queueconsumer", "acrkey");

            Console.WriteLine("The job was created!");
        }