Skip to content

Commit

Permalink
feat(provider/kubernetes): Add hostNetwork option for pod creation. … (
Browse files Browse the repository at this point in the history
…#1504)

feat(provider/kubernetes): Add hostNetwork option for pod creation.  These are backend changes.
  • Loading branch information
chlung authored and lwander committed Mar 10, 2017
1 parent 5c2e4c7 commit af7e18b
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion clouddriver-kubernetes/clouddriver-kubernetes.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ dependencies {
compile spinnaker.dependency('bootWeb')

// TODO (move to https://github.com/spinnaker/spinnaker-dependencies/blob/master/src/spinnaker-dependencies.yml)
compile 'io.fabric8:kubernetes-api:2.2.184'
compile 'io.fabric8:kubernetes-client:1.4.35'
}
Original file line number Diff line number Diff line change
Expand Up @@ -610,6 +610,8 @@ class KubernetesApiConverter {
fromVolume(it)
} ?: []

deployDescription.hostNetwork = replicaSet?.spec?.template?.spec?.hostNetwork

deployDescription.containers = replicaSet?.spec?.template?.spec?.containers?.collect {
fromContainer(it)
} ?: []
Expand Down Expand Up @@ -896,6 +898,8 @@ class KubernetesApiConverter {
podTemplateSpecBuilder = podTemplateSpecBuilder.withVolumes(volumeSources)
}

podTemplateSpecBuilder = podTemplateSpecBuilder.withHostNetwork(description.hostNetwork)

def containers = description.containers.collect { container ->
toContainer(container)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ class DeployKubernetesAtomicOperationDescription extends KubernetesAtomicOperati
String namespace
String restartPolicy
Integer targetSize
Boolean hostNetwork
List<String> loadBalancers
List<String> securityGroups
List<KubernetesContainerDescription> containers
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ class RunKubernetesJobAtomicOperation implements AtomicOperation<DeploymentResul
podBuilder = podBuilder.addNewImagePullSecret(imagePullSecret)
}

if (description.hostNetwork) {
podBuilder = podBuilder.withHostNetwork(description.hostNetwork)
}
description.container.name = description.container.name ?: "job"
def container = KubernetesApiConverter.toContainer(description.container)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ class CloneKubernetesAtomicOperation implements AtomicOperation<DeploymentResult
newDescription.loadBalancers = description.loadBalancers != null ? description.loadBalancers : KubernetesUtil.getLoadBalancers(ancestorServerGroup)
newDescription.restartPolicy = description.restartPolicy ?: ancestorServerGroup.spec?.template?.spec?.restartPolicy
newDescription.nodeSelector = description.nodeSelector ?: ancestorServerGroup.spec?.template?.spec?.nodeSelector
newDescription.hostNetwork = description.hostNetwork ?: ancestorServerGroup.spec?.template?.spec?.hostNetwork
if (!description.containers) {
newDescription.containers = ancestorServerGroup.spec?.template?.spec?.containers?.collect { it ->
KubernetesApiConverter.fromContainer(it)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ class KubernetesServerGroup implements ServerGroup, Serializable {
String account
Long createdTime
Integer replicas = 0
Boolean hostNetwork = false
Set<String> zones
Set<KubernetesInstance> instances
Set<String> loadBalancers = [] as Set
Expand Down

0 comments on commit af7e18b

Please sign in to comment.