|
|
@@ -56,9 +56,9 @@ public class Deployment extends K8sAbstractObject<V1Deployment> {
|
|
|
|
|
|
public Deployment(V1Deployment v1Deployment) {
|
|
|
super(v1Deployment);
|
|
|
- this.containers = v1Deployment.getSpec().getTemplate().getSpec().getContainers()
|
|
|
+ this.containers = v1Deployment.getSpec().getTemplate().getSpec().getContainers() == null ? null : v1Deployment.getSpec().getTemplate().getSpec().getContainers()
|
|
|
.stream().map(Container::new).collect(Collectors.toList());
|
|
|
- this.imagePullSecrets = v1Deployment.getSpec().getTemplate().getSpec().getImagePullSecrets()
|
|
|
+ this.imagePullSecrets = v1Deployment.getSpec().getTemplate().getSpec().getImagePullSecrets() == null ? null : v1Deployment.getSpec().getTemplate().getSpec().getImagePullSecrets()
|
|
|
.stream().map(V1LocalObjectReference::getName).collect(Collectors.toList());
|
|
|
this.replicas = v1Deployment.getSpec().getReplicas();
|
|
|
this.timeout = v1Deployment.getSpec().getProgressDeadlineSeconds();
|
|
|
@@ -78,12 +78,12 @@ public class Deployment extends K8sAbstractObject<V1Deployment> {
|
|
|
.withLabels(getLabels())
|
|
|
.withAnnotations(getAnnotations())
|
|
|
.build();
|
|
|
- List<V1LocalObjectReference> references = imagePullSecrets
|
|
|
+ List<V1LocalObjectReference> references = imagePullSecrets == null ? null : imagePullSecrets
|
|
|
.stream()
|
|
|
.map(secret -> new V1LocalObjectReference().name(secret))
|
|
|
.collect(Collectors.toList());
|
|
|
V1PodSpec v1PodSpec = new V1PodSpecBuilder()
|
|
|
- .addAllToContainers(containers.stream().map(Container::toK8sObject).collect(Collectors.toList()))
|
|
|
+ .addAllToContainers(containers == null ? null : containers.stream().map(Container::toK8sObject).collect(Collectors.toList()))
|
|
|
.withImagePullSecrets(references)
|
|
|
.withVolumes(volumes)
|
|
|
.build();
|
|
|
@@ -120,10 +120,10 @@ public class Deployment extends K8sAbstractObject<V1Deployment> {
|
|
|
v1Deployment.getSpec().setReplicas(this.replicas);
|
|
|
v1Deployment.getSpec().setProgressDeadlineSeconds(timeout);
|
|
|
v1Deployment.getSpec().setRevisionHistoryLimit(revisionHistoryLimit);
|
|
|
- v1Deployment.getSpec().getTemplate().getSpec().setContainers(this.containers.stream().map(Container::toK8sObject).collect(Collectors.toList()));
|
|
|
- v1Deployment.getSpec().getTemplate().getSpec().setVolumes(this.volumes);
|
|
|
+ v1Deployment.getSpec().getTemplate().getSpec().setContainers(containers == null ? null : this.containers.stream().map(Container::toK8sObject).collect(Collectors.toList()));
|
|
|
+ v1Deployment.getSpec().getTemplate().getSpec().setVolumes(volumes == null ? null : this.volumes);
|
|
|
v1Deployment.getSpec().getTemplate().getSpec().setImagePullSecrets(
|
|
|
- this.imagePullSecrets
|
|
|
+ imagePullSecrets == null ? null : this.imagePullSecrets
|
|
|
.stream()
|
|
|
.map(secret -> new V1LocalObjectReference().name(secret))
|
|
|
.collect(Collectors.toList()));
|