public static async Task ReplaceModuleImageAsync(this KubernetesClient client, string name, string image) { V1Deployment deployment = await client.Kubernetes.ReadNamespacedDeploymentAsync(name, client.DeviceNamespace); deployment.Spec.Template.Spec.Containers[0].Image = image; await client.Kubernetes.ReplaceNamespacedDeploymentAsync(deployment, name, client.DeviceNamespace); }
public static async Task AddNamespaceAsync(this KubernetesClient client) { var @namespace = new V1Namespace { Metadata = new V1ObjectMeta { Name = client.DeviceNamespace } }; await client.Kubernetes.CreateNamespaceAsync(@namespace); }
public static async Task AddModuleServiceAccountAsync(this KubernetesClient client, string name, IDictionary <string, string> labels, IDictionary <string, string> annotations) { var serviceAccount = new V1ServiceAccount { Metadata = new V1ObjectMeta { Name = name, Annotations = annotations, Labels = labels } }; await client.Kubernetes.CreateNamespacedServiceAccountAsync(serviceAccount, client.DeviceNamespace); }
public static async Task AddModuleDeploymentAsync(this KubernetesClient client, string name, IDictionary <string, string> labels, IDictionary <string, string> annotations) { var deployment = new V1Deployment { Metadata = new V1ObjectMeta { Name = name, NamespaceProperty = client.DeviceNamespace, Labels = labels }, Spec = new V1DeploymentSpec { Template = new V1PodTemplateSpec { Metadata = new V1ObjectMeta { Name = name, Labels = labels, Annotations = annotations }, Spec = new V1PodSpec { Containers = new[] { new V1Container { Image = "busybox:latest", Name = name, Command = new[] { "/bin/sh" }, Args = new[] { "-c", "while true; do echo hello; sleep 10;done" } } }, ServiceAccountName = name } }, Selector = new V1LabelSelector { MatchLabels = labels } } }; await client.Kubernetes.CreateNamespacedDeploymentAsync(deployment, client.DeviceNamespace); }
public static async Task <V1ServiceList> ListServicesAsync(this KubernetesClient client, string deviceSelector) => await client.Kubernetes.ListNamespacedServiceAsync(client.DeviceNamespace, labelSelector : deviceSelector);
public static async Task <V1PersistentVolumeClaimList> ListPeristentVolumeClaimsAsync(this KubernetesClient client) => await client.Kubernetes.ListNamespacedPersistentVolumeClaimAsync(client.DeviceNamespace);
public static async Task <Option <V1PersistentVolumeClaimList> > WaitUntilAnyPersistentVolumeClaimAsync(this KubernetesClient client, CancellationToken token) => await KubernetesClient.WaitUntilAsync( () => client.Kubernetes.ListNamespacedPersistentVolumeClaimAsync(client.DeviceNamespace, cancellationToken: token), p => p.Items.Any(), token);
public static async Task <V1DeploymentList> ListDeploymentsAsync(this KubernetesClient client, string deviceSelector) => await client.Kubernetes.ListNamespacedDeploymentAsync(client.DeviceNamespace, labelSelector : deviceSelector);
public static async Task DeleteModuleDeploymentAsync(this KubernetesClient client, string name) => await client.Kubernetes.DeleteNamespacedDeploymentAsync(name, client.DeviceNamespace);