Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

12 changes: 0 additions & 12 deletions qa-tests-backend/artifacts/tls-challenge-test/nginx-proxy.conf

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ import io.fabric8.kubernetes.api.model.apps.DaemonSetBuilder
import io.fabric8.kubernetes.api.model.apps.DaemonSetList
import io.fabric8.kubernetes.api.model.apps.DaemonSetSpec
import io.fabric8.kubernetes.api.model.apps.Deployment as K8sDeployment
import io.fabric8.kubernetes.api.model.apps.DeploymentBuilder
import io.fabric8.kubernetes.api.model.apps.DeploymentList
import io.fabric8.kubernetes.api.model.apps.DeploymentSpec
import io.fabric8.kubernetes.api.model.apps.StatefulSet as K8sStatefulSet
Expand Down Expand Up @@ -308,40 +307,6 @@ class Kubernetes implements OrchestratorMain {
client.pods().inNamespace(ns).withLabels(labels).delete()
}

void deleteAllPodsAndWait(String ns, Map<String, String> labels) {
log.debug "Will delete all pods in ${ns} with labels ${labels} and wait for deletion"

List<Pod> beforePods = evaluateWithRetry(2, 3) {
client.pods().inNamespace(ns).withLabels(labels).list().getItems()
}
beforePods.each { pod ->
evaluateWithRetry(2, 3) {
client.pods().inNamespace(ns).withName(pod.metadata.name).delete()
}
}

Timer t = new Timer(30, 5)
Boolean allDeleted = false
while (!allDeleted && t.IsValid()) {
allDeleted = true
beforePods.each { deleted ->
Pod pod = evaluateWithRetry(2, 3) {
client.pods().inNamespace(ns).withName(deleted.metadata.name).get()
}
if (pod == null) {
log.debug "${deleted.metadata.name} is deleted"
}
else {
log.debug "${deleted.metadata.name} is not deleted"
allDeleted = false
}
}
}
if (!allDeleted) {
throw new OrchestratorManagerException("Gave up trying to delete all pods")
}
}

Boolean deletePodAndWait(String ns, String name, int retries, int intervalSeconds) {
deletePod(ns, name, null)
log.debug "Deleting pod ${name}"
Expand All @@ -358,15 +323,6 @@ class Kubernetes implements OrchestratorMain {
throw new OrchestratorManagerException("Could not delete pod ${ns}/${name}")
}

Boolean restartPodByLabelWithExecKill(String ns, Map<String, String> labels) {
Pod pod = getPodsByLabel(ns, labels).get(0)
int prevRestartCount = pod.status.containerStatuses.get(0).restartCount
def cmds = ["sh", "-c", "kill -15 1"] as String[]
execInContainerByPodName(pod.metadata.name, pod.metadata.namespace, cmds)
log.debug "Killed pod ${pod.metadata.name}"
return waitForPodRestart(pod.metadata.namespace, pod.metadata.name, prevRestartCount, 25, 5)
}

def restartPodByLabels(String ns, Map<String, String> labels, int retries, int intervalSecond) {
Pod pod = getPodsByLabel(ns, labels).get(0)

Expand Down Expand Up @@ -554,52 +510,6 @@ class Kubernetes implements OrchestratorMain {
.portForward(port)
}

EnvVar getDeploymentEnv(String ns, String name, String key) {
def deployment = client.apps().deployments().inNamespace(ns).withName(name).get()
if (deployment == null) {
throw new OrchestratorManagerException("Did not find deployment ${ns}/${name}")
}

List<EnvVar> envVars = client.apps().deployments().inNamespace(ns).withName(name).get().spec.template
.spec.containers.get(0).env
int index = envVars.findIndexOf { EnvVar it -> it.name == key }
if (index < 0) {
throw new OrchestratorManagerException("Did not find env variable ${key} in ${ns}/${name}")
}
return envVars.get(index)
}

def updateDeploymentEnv(String ns, String name, String key, String value) {
log.debug "Update env var in ${ns}/${name}: ${key} = ${value}"
List<EnvVar> envVars = client.apps().deployments().inNamespace(ns).withName(name).get().spec.template
.spec.containers.get(0).env

int index = envVars.findIndexOf { EnvVar it -> it.name == key }
if (index > -1) {
log.debug "Env var ${key} found on index: ${index}"
envVars.get(index).value = value
}
else {
log.debug "Env var ${key} not found. Adding it now"
envVars.add(new EnvVarBuilder().withName(key).withValue(value).build())
}

withRetry(2, 3) {
client.apps().deployments().inNamespace(ns).withName(name)
.edit { d -> new DeploymentBuilder(d)
.editSpec()
.editTemplate()
.editSpec()
.editContainer(0)
.withEnv(envVars)
.endContainer()
.endSpec()
.endTemplate()
.endSpec()
.build() }
}
}

def scaleDeployment(String ns, String name, Integer replicas) {
Exception mostRecentException
Timer t = new Timer(30, 5)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package orchestratormanager

import io.fabric8.kubernetes.api.model.EnvVar
import io.fabric8.kubernetes.api.model.ObjectMeta
import io.fabric8.kubernetes.api.model.Pod
import io.fabric8.kubernetes.api.model.admissionregistration.v1.ValidatingWebhookConfiguration
Expand All @@ -26,8 +25,6 @@ interface OrchestratorMain {
Boolean deletePod(String ns, String podName, Long gracePeriodSecs)
Boolean deletePodAndWait(String ns, String podName, int retries, int intervalSeconds)
def deleteAllPods(String ns, Map<String, String> labels)
void deleteAllPodsAndWait(String ns, Map<String, String> labels)
Boolean restartPodByLabelWithExecKill(String ns, Map<String, String> labels)
def restartPodByLabels(String ns, Map<String, String> labels, int retries, int intervalSecond)
def waitForAllPodsToBeRemoved(String ns, Map<String, String>labels, int iterations, int intervalSeconds)
def waitForPodsReady(String ns, Map<String, String> labels, int minReady, int iterations, int intervalSeconds)
Expand Down Expand Up @@ -56,8 +53,6 @@ interface OrchestratorMain {
def getDeploymentCount(String ns)
Set<String> getDeploymentSecrets(Deployment deployment)
def createPortForward(int port, Deployment deployment)
def updateDeploymentEnv(String ns, String name, String key, String value)
EnvVar getDeploymentEnv(String ns, String name, String key)
def scaleDeployment(String ns, String name, Integer replicas)
List<String> getDeployments(String ns)
boolean deploymentReady(String ns, String name)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,6 @@ class ApplicationHealth {
this.waitTimeForHealthiness = waitTimeForHealthiness
}

void waitForSensorHealthiness() {
Deployment sensor = new Deployment().setNamespace(Constants.STACKROX_NAMESPACE).setName("sensor")
waitForHealthiness(sensor)
}

void waitForCollectorHealthiness() {
Deployment collector = new DaemonSet().setNamespace(Constants.STACKROX_NAMESPACE).setName("collector")
waitForHealthiness(collector)
Expand Down
Loading