summaryrefslogtreecommitdiff
path: root/qa/qa/service/kubernetes_cluster.rb
diff options
context:
space:
mode:
Diffstat (limited to 'qa/qa/service/kubernetes_cluster.rb')
-rw-r--r--qa/qa/service/kubernetes_cluster.rb24
1 files changed, 24 insertions, 0 deletions
diff --git a/qa/qa/service/kubernetes_cluster.rb b/qa/qa/service/kubernetes_cluster.rb
index ddf97046fb0..adef1b46af2 100644
--- a/qa/qa/service/kubernetes_cluster.rb
+++ b/qa/qa/service/kubernetes_cluster.rb
@@ -51,6 +51,30 @@ module QA
shell('kubectl apply -f -', stdin_data: manifest)
end
+ def add_sample_policy(project, policy_name: 'sample-policy')
+ namespace = "#{project.name}-#{project.id}-production"
+ network_policy = <<~YAML
+ apiVersion: "cilium.io/v2"
+ kind: CiliumNetworkPolicy
+ metadata:
+ name: #{policy_name}
+ namespace: #{namespace}
+ spec:
+ endpointSelector:
+ matchLabels:
+ role: backend
+ ingress:
+ - fromEndpoints:
+ - matchLabels:
+ role: frontend
+ YAML
+ shell('kubectl apply -f -', stdin_data: network_policy)
+ end
+
+ def fetch_external_ip_for_ingress
+ `kubectl get svc --all-namespaces --no-headers=true -l app.kubernetes.io/name=ingress-nginx -o custom-columns=:'status.loadBalancer.ingress[0].ip' | grep -v 'none'`
+ end
+
private
def fetch_api_url