当前位置: 首页>>代码示例>>Java>>正文


Java DeploymentSpec类代码示例

本文整理汇总了Java中io.fabric8.kubernetes.api.model.extensions.DeploymentSpec的典型用法代码示例。如果您正苦于以下问题:Java DeploymentSpec类的具体用法?Java DeploymentSpec怎么用?Java DeploymentSpec使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


DeploymentSpec类属于io.fabric8.kubernetes.api.model.extensions包,在下文中一共展示了DeploymentSpec类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: matches

import io.fabric8.kubernetes.api.model.extensions.DeploymentSpec; //导入依赖的package包/类
@Override
public boolean matches(Object object) {
    if (object == null || !(object instanceof Deployment)) {
        return false;
    }
    Deployment deployment = (Deployment)object;

    ObjectMeta metadata = deployment.getMetadata();

    DeploymentSpec spec = deployment.getSpec();
    PodTemplateSpec podTemplateSpec = spec.getTemplate();
    String podLabel = podTemplateSpec.getMetadata().getLabels().get("osc-deployment");

    Container container = podTemplateSpec.getSpec().getContainers().get(0);

    return this.name.equals(metadata.getName()) &&
            this.name.equals(podLabel) &&
            this.replicaCount == spec.getReplicas() &&
            this.imageName.equals(container.getImage()) &&
            this.name.equals(container.getName());
}
 
开发者ID:opensecuritycontroller,项目名称:osc-core,代码行数:22,代码来源:KubernetesDeploymentApiTest.java

示例2: createDeploymentSpec

import io.fabric8.kubernetes.api.model.extensions.DeploymentSpec; //导入依赖的package包/类
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) {    
  final DeploymentSpec deploymentSpec = new DeploymentSpec();
  final PodTemplateSpec podTemplateSpec = new PodTemplateSpec();
  final ObjectMeta metadata = new ObjectMeta();
  metadata.setLabels(normalizeLabels(labels));
  podTemplateSpec.setMetadata(metadata);
  final PodSpec podSpec = new PodSpec();
  podSpec.setServiceAccountName(normalizeServiceAccountName(serviceAccountName));
  podSpec.setContainers(Arrays.asList(this.createContainer(imageName, imagePullPolicy, namespace, tls, verifyTls)));
  podSpec.setHostNetwork(Boolean.valueOf(hostNetwork));
  final Map<String, String> nodeSelector = new HashMap<>();
  nodeSelector.put("beta.kubernetes.io/os", "linux");
  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);    
  return deploymentSpec;
}
 
开发者ID:microbean,项目名称:microbean-helm,代码行数:33,代码来源:TillerInstaller.java

示例3: newDeployment

import io.fabric8.kubernetes.api.model.extensions.DeploymentSpec; //导入依赖的package包/类
private Deployment newDeployment(String uid, String namespace, String name, int desiredReplicaCount, String containerImageName) {
    Deployment deployment = new Deployment();

    ObjectMeta objMeta = new ObjectMeta();
    objMeta.setName(name);
    objMeta.setNamespace(namespace);
    objMeta.setUid(uid);

    DeploymentSpec spec = new DeploymentSpec();
    spec.setReplicas(desiredReplicaCount);

    Container container = new Container();
    container.setImage(containerImageName);

    PodSpec podSpec = new PodSpec();
    podSpec.setContainers(Arrays.asList(container));

    PodTemplateSpec podTemplateSpec = new PodTemplateSpec();
    podTemplateSpec.setSpec(podSpec);
    spec.setTemplate(podTemplateSpec);

    deployment.setMetadata(objMeta);
    deployment.setSpec(spec);

    DeploymentStatus deploymentStatus = new DeploymentStatus();
    deploymentStatus.setAvailableReplicas(3);
    deployment.setStatus(deploymentStatus);

    return deployment;
}
 
开发者ID:opensecuritycontroller,项目名称:osc-core,代码行数:31,代码来源:KubernetesDeploymentApiTest.java


注:本文中的io.fabric8.kubernetes.api.model.extensions.DeploymentSpec类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。