io.fabric8.kubernetes.api.model.apps.DeploymentSpec Java Examples
The following examples show how to use
io.fabric8.kubernetes.api.model.apps.DeploymentSpec.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TillerInstaller.java From microbean-helm with Apache License 2.0 | 6 votes |
@Deprecated protected DeploymentSpec createDeploymentSpec(final Map<String, String> labels, final String serviceAccountName, final String imageName, final ImagePullPolicy imagePullPolicy, final String namespace, final boolean hostNetwork, final boolean tls, final boolean verifyTls) { return this.createDeploymentSpec(1, labels, null, serviceAccountName, imageName, imagePullPolicy, 0, namespace, hostNetwork, tls, verifyTls); }
Example #2
Source File: TillerInstaller.java From microbean-helm with Apache License 2.0 | 6 votes |
@Deprecated protected DeploymentSpec createDeploymentSpec(final Map<String, String> labels, final Map<String, String> nodeSelector, String serviceAccountName, final String imageName, final ImagePullPolicy imagePullPolicy, final int maxHistory, final String namespace, final boolean hostNetwork, final boolean tls, final boolean verifyTls) { return this.createDeploymentSpec(1, labels, nodeSelector, serviceAccountName, imageName, imagePullPolicy, maxHistory, namespace, hostNetwork, tls, verifyTls); }
Example #3
Source File: Readiness.java From kubernetes-client with Apache License 2.0 | 6 votes |
public static boolean isDeploymentReady(Deployment d) { Utils.checkNotNull(d, "Deployment can't be null."); DeploymentSpec spec = d.getSpec(); DeploymentStatus status = d.getStatus(); if (status == null || status.getReplicas() == null || status.getAvailableReplicas() == null) { return false; } //Can be true in testing, so handle it to make test writing easier. if (spec == null || spec.getReplicas() == null) { return false; } return spec.getReplicas().intValue() == status.getReplicas() && spec.getReplicas().intValue() <= status.getAvailableReplicas(); }
Example #4
Source File: DeploymentConfigEnricher.java From jkube with Eclipse Public License 2.0 | 5 votes |
private DeploymentConfig convertFromAppsV1Deployment(HasMetadata item) { Deployment resource = (Deployment) item; DeploymentConfigBuilder builder = new DeploymentConfigBuilder(); builder.withMetadata(resource.getMetadata()); DeploymentSpec spec = resource.getSpec(); if (spec != null) { builder.withSpec(getDeploymentConfigSpec(spec.getReplicas(), spec.getRevisionHistoryLimit(), spec.getSelector(), spec.getTemplate(), spec.getStrategy() != null ? spec.getStrategy().getType() : null)); } return builder.build(); }
Example #5
Source File: DeploymentConfigEnricher.java From jkube with Eclipse Public License 2.0 | 5 votes |
private DeploymentConfig convertFromExtensionsV1Beta1Deployment(HasMetadata item) { io.fabric8.kubernetes.api.model.extensions.Deployment resource = (io.fabric8.kubernetes.api.model.extensions.Deployment) item; DeploymentConfigBuilder builder = new DeploymentConfigBuilder(); builder.withMetadata(resource.getMetadata()); io.fabric8.kubernetes.api.model.extensions.DeploymentSpec spec = resource.getSpec(); if (spec != null) { builder.withSpec(getDeploymentConfigSpec(spec.getReplicas(), spec.getRevisionHistoryLimit(), spec.getSelector(), spec.getTemplate(), spec.getStrategy() != null ? spec.getStrategy().getType() : null)); } return builder.build(); }
Example #6
Source File: TillerInstaller.java From microbean-helm with Apache License 2.0 | 5 votes |
protected DeploymentSpec createDeploymentSpec(final int replicas, final Map<String, String> labels, final Map<String, String> nodeSelector, String serviceAccountName, final String imageName, final ImagePullPolicy imagePullPolicy, final int maxHistory, final String namespace, final boolean hostNetwork, final boolean tls, final boolean verifyTls) { final DeploymentSpec deploymentSpec = new DeploymentSpec(); deploymentSpec.setReplicas(Math.max(1, replicas)); final PodTemplateSpec podTemplateSpec = new PodTemplateSpec(); final ObjectMeta metadata = new ObjectMeta(); metadata.setLabels(normalizeLabels(labels)); podTemplateSpec.setMetadata(metadata); final PodSpec podSpec = new PodSpec(); serviceAccountName = normalizeServiceAccountName(serviceAccountName); podSpec.setServiceAccountName(serviceAccountName); podSpec.setContainers(Arrays.asList(this.createContainer(imageName, imagePullPolicy, maxHistory, namespace, tls, verifyTls))); podSpec.setHostNetwork(Boolean.valueOf(hostNetwork)); if (nodeSelector != null && !nodeSelector.isEmpty()) { podSpec.setNodeSelector(nodeSelector); } if (tls) { final Volume volume = new Volume(); volume.setName(DEFAULT_NAME + "-certs"); final SecretVolumeSource secretVolumeSource = new SecretVolumeSource(); secretVolumeSource.setSecretName(SECRET_NAME); volume.setSecret(secretVolumeSource); podSpec.setVolumes(Arrays.asList(volume)); } podTemplateSpec.setSpec(podSpec); deploymentSpec.setTemplate(podTemplateSpec); final LabelSelector selector = new LabelSelector(); selector.setMatchLabels(labels); deploymentSpec.setSelector(selector); return deploymentSpec; }
Example #7
Source File: KubernetesJobManagerFactoryTest.java From flink with Apache License 2.0 | 5 votes |
@Test public void testDeploymentSpec() { final DeploymentSpec resultDeploymentSpec = this.kubernetesJobManagerSpecification.getDeployment().getSpec(); assertEquals(1, resultDeploymentSpec.getReplicas().intValue()); final Map<String, String> expectedLabels = new HashMap<>(getCommonLabels()); expectedLabels.put(Constants.LABEL_COMPONENT_KEY, Constants.LABEL_COMPONENT_JOB_MANAGER); expectedLabels.putAll(userLabels); assertEquals(expectedLabels, resultDeploymentSpec.getTemplate().getMetadata().getLabels()); assertEquals(expectedLabels, resultDeploymentSpec.getSelector().getMatchLabels()); assertNotNull(resultDeploymentSpec.getTemplate().getSpec()); }
Example #8
Source File: DeploymentHandler.java From jkube with Eclipse Public License 2.0 | 4 votes |
private DeploymentSpec createDeploymentSpec(ResourceConfig config, List<ImageConfiguration> images) { return new DeploymentSpecBuilder() .withReplicas(config.getReplicas()) .withTemplate(podTemplateHandler.getPodTemplate(config,images)) .build(); }
Example #9
Source File: ControllerViaPluginConfigurationEnricher.java From jkube with Eclipse Public License 2.0 | 4 votes |
private void mergeDeploymentSpec(DeploymentBuilder builder, DeploymentSpec spec) { DeploymentFluent.SpecNested<DeploymentBuilder> specBuilder = builder.editSpec(); KubernetesResourceUtil.mergeSimpleFields(specBuilder, spec); specBuilder.endSpec(); }