CreatePodParameters( IReadOnlyList <string> env, IDictionary <string, EmptyStruct> exposedPorts, HostConfig hostConfig, string image, IDictionary <string, string> labels, IReadOnlyList <string> cmd, IReadOnlyList <string> entrypoint, string workingDir, IDictionary <string, string> nodeSelector, V1ResourceRequirements resources, IReadOnlyList <KubernetesModuleVolumeSpec> volumes, V1PodSecurityContext securityContext, KubernetesServiceOptions serviceOptions, V1DeploymentStrategy strategy) { this.Env = Option.Maybe(env); this.ExposedPorts = Option.Maybe(exposedPorts); this.HostConfig = Option.Maybe(hostConfig); this.Image = Option.Maybe(image); this.Labels = Option.Maybe(labels); this.Cmd = Option.Maybe(cmd); this.Entrypoint = Option.Maybe(entrypoint); this.WorkingDir = Option.Maybe(workingDir); this.NodeSelector = Option.Maybe(nodeSelector); this.Resources = Option.Maybe(resources); this.Volumes = Option.Maybe(volumes); this.SecurityContext = Option.Maybe(securityContext); this.ServiceOptions = Option.Maybe(serviceOptions); this.DeploymentStrategy = Option.Maybe(strategy); }
public void CreateServiceSetsServiceOptions() { var serviceOptions = new KubernetesServiceOptions("loadBalancerIP", "nodeport"); var module = CreateKubernetesModule(CreatePodParameters.Create(exposedPorts: ExposedPorts, serviceOptions: serviceOptions)); var mapper = new KubernetesServiceMapper(PortMapServiceType.ClusterIP); Option <V1Service> result = mapper.CreateService(CreateIdentity, module, DefaultLabels); Assert.True(result.HasValue); var service = result.OrDefault(); Assert.Equal(PortMapServiceType.NodePort.ToString(), service.Spec.Type); Assert.Equal("loadBalancerIP", service.Spec.LoadBalancerIP); }
public void CreateServiceSetsServiceOptionsSetDefaultOnNullType() { var serviceOptions = new KubernetesServiceOptions("loadBalancerIP", null); var module = CreateKubernetesModule(CreatePodParameters.Create(hostConfig: HostPorts, serviceOptions: serviceOptions)); var mapper = new KubernetesServiceMapper(PortMapServiceType.LoadBalancer); Option <V1Service> result = mapper.CreateService(CreateIdentity, module, DefaultLabels); Assert.True(result.HasValue); var service = result.OrDefault(); Assert.Equal(PortMapServiceType.LoadBalancer.ToString(), service.Spec.Type); Assert.Equal("loadBalancerIP", service.Spec.LoadBalancerIP); }
internal static CreatePodParameters Create( IReadOnlyList <string> env = null, IDictionary <string, EmptyStruct> exposedPorts = null, HostConfig hostConfig = null, string image = null, IDictionary <string, string> labels = null, IReadOnlyList <string> cmd = null, IReadOnlyList <string> entrypoint = null, string workingDir = null, IDictionary <string, string> nodeSelector = null, V1ResourceRequirements resources = null, IReadOnlyList <KubernetesModuleVolumeSpec> volumes = null, V1PodSecurityContext securityContext = null, KubernetesServiceOptions serviceOptions = null, V1DeploymentStrategy deploymentStrategy = null) => new CreatePodParameters(env, exposedPorts, hostConfig, image, labels, cmd, entrypoint, workingDir, nodeSelector, resources, volumes, securityContext, serviceOptions, deploymentStrategy);