Commit Graph

281 Commits

Author SHA1 Message Date
Itzik Brown 9db5ded1e7 Setting security context for kuryr demo pod
Otherwise for k8s >= 1.26 it fails with:
kuryr-pod-1568568478 is forbidden: violates PodSecurity

Change-Id: I5593c78b6809b945fa690c723525bc8b6473c58f
Depends-On: I7a51b3553a17c21160f76e527a61ef829610a888
2023-03-20 08:13:19 +00:00
Itzik Brown 3acaa0062a Fix get subnet name in get_port_pool
Subnet name in the form of ns/{ns_name}-subnet was added
This is the form in 3.11

Change-Id: I1d1e1a5fbc0cfe4de404089110b31c4eebd95e7b
2023-01-12 10:21:42 +02:00
Itzik Brown 76f0c5ac74 Fix get subnet name in get_port_pool
Subnet name in the form of ns_uid/ns_name was added

Change-Id: Ibbca8bf7ddc1550eb6e0c3f0fcebbc31c9b77e4c
2023-01-02 10:55:18 +00:00
Sunday Mgbogu 1569ccfd69 Fix scenraio when LB or Pool is not ready
The patch is to fix a scenario when LB or Pool ID
is not available while attempting to reconcile members.

Change-Id: I3d6e09f0a17228994032eba2fecf9f7663e6cf14
2022-09-07 10:34:53 +00:00
Sunday Mgbogu e5a94aef46 Extend loadbalancer reconciliation test to cover listeners
This commit extends the loadbalancer reconcilation tempest
test to cover for when the listeners are deleted on OpenStack

Implements: blueprint reconcile-openstack-resources-with-k8s
Change-Id: If14b468e9a5f7d2c1492881d5a75ac8807030c4e
2022-09-06 22:32:37 +01:00
yangjianfeng 4b0fceea70 Add annotation project driver scenario test cases
Depends-on: https://review.opendev.org/832768
Depends-On: https://review.opendev.org/c/openstack/neutron/+/853261
Implements: blueprint specify-project-by-annotation
Change-Id: Ia4591ef96ce642f53ead6147ff4b56960746e510
2022-08-16 16:46:08 +02:00
Zuul d0840287fa Merge "Change naming (again) for networks and subnets." 2022-06-20 18:18:09 +00:00
Roman Dobosz 0cc8ae0fae Change naming (again) for networks and subnets.
There is a need for changing names again, since namespace id is no
longer stored in description and name for net/subnet is a compound of
name and uid.

Depends-On: https://review.opendev.org/c/openstack/kuryr-tempest-plugin/+/845745
Change-Id: Ib97a597f8afb47316e77154a9bf3ced41ce48468
2022-06-14 18:16:52 +00:00
Michał Dulko 28da7f63d3 Use proper ApiException from kubernetes client
Seems like folks developing Python kubernetes client had move the
ApiException around. So the backward-compatible way of using it is
kubernetes.client.rest.ApiException and trying to use it by
kubernetes.client.excetpions.ApiException will not work in older library
versions. As this client is supposed to still be compatible with
stable/victoria and kubernetes==11.0.0, this commit changes the
exception module to `rest` where needed.

Change-Id: If056529d49a053970891f89d12007174f544a551
2022-06-14 14:56:12 +02:00
Roman Dobosz 61bfb58898 Fix the crd_lb_ip not being defined.
During execution it may happen, that there will be UnboundLocalError
exception thrown for crd_lb_ip variable, due to unmet condition for
service ip not being set in the KuryrLoadbalancerCRD. Fixed by simply
defining variable.

Change-Id: Ie879ba0b9b85111ec1b906d66ec48127ce8dd1f9
2022-05-10 09:32:36 +02:00
Zuul 962594cc7b Merge "Adapt to new OS resource names." 2022-04-18 22:34:07 +00:00
Roman Dobosz 331547d50a Adapt to new OS resource names.
Change-Id: Id04ef0217a14fb8c3430c10d581b520e0afdb566
2022-04-12 15:01:31 +02:00
Zuul 65f6cef16b Merge "Check that pod is deleted in delete_pod" 2022-03-28 14:37:04 +00:00
Itzik Brown 5835cc46c9 Check that pod is deleted in delete_pod
Instead of sleeping after deletion - check that the pod is deleted for
a period of 30 seconds

Change-Id: Iaa88f8d851430b19e09b3fbe2b4bc070a93a3a93
2022-03-28 13:18:39 +03:00
Zuul 19da1d2fce Merge "Use one pod to check connectivity in kuryr_restart" 2022-03-23 12:21:01 +00:00
Itzik Brown f6f77354b1 Use one pod to check connectivity in kuryr_restart
In test_kuryr_restart use one pod to check connectivity to the
created pods from this pod instead of assigning a fip for each created
pod. This can solve problems when there is shortage of floating ips.

Also, Don't fail on deletion of a pod in cleanup if it's not found

Change-Id: I55a33f88356ff3d1ef6ed0ce83bb102172e46023
2022-03-21 15:55:30 +02:00
Jon Uriarte 113be9ebf5 Initialize kns_crd variable in create_namespace()
Set kns_crd dictionary initial value in order to avoid the
unhandled error `UnboundLocalError: local variable 'kns_crd'
referenced before assignment` when the timeout_period is
reached.

Change-Id: I20f9c2400dd0ecf0171f02d7cfd3fc10923f4d18
2022-03-18 11:43:40 +00:00
Michał Dulko b667a5c6bc Bump pod exec timeout in Service connectivity tests
When testing UDP connectivity to a Service we're using ncat with `-w 5`
option. This sets the connectivity timeout to that value. However our
`exec_command_in_pod()` method is run in async mode and defaults timeout
to wait for completion to just 2 seconds. This is in conflict and if for
some reason UDP server on the pod is slow, will terminate the request
before it's completed, leaving empty stdout but also stderr, so that we
won't even log the error response.

This commit bumps that timeout to 10 seconds to give the pod time to
actually response. I decided to bump it for all the checks as we've seen
this happening with SCTP tests as well and I expect this might have the
same cause.

Change-Id: I303b87d01496cf7353b2b8b699e0dce598e032ab
2022-03-04 15:03:10 +01:00
Zuul 79917999e9 Merge "Limit number of K8s API requests" 2022-03-03 19:11:20 +00:00
Michał Dulko d7dd6b2eb6 Remove support for OCP Routes
That support is long gone from kuryr-kubernetes and this commit removes
the tests that are no longer needed.

Change-Id: I3593285d09ecde0c2bdc14805adc39630a592a49
2022-03-02 10:03:17 +01:00
Michał Dulko 86423cc26c Limit number of K8s API requests
As the K8s client is logging every response to every request, we're
starting to hit limits of tox' or Zuul's log side limit. This commit
attempts to limit number of requests by making sure that in case of
status checks we're iterating a list of pods instead of calling API for
every pod. Moreover many `time.sleep()` occurences are modified to
reduce the number of the requests made.

Change-Id: Ifc2dfce2405429bbcae8c01f13f06d4e9fae9c8a
2022-03-01 13:17:52 +01:00
Michał Dulko 5368b60c5f Improve test_egress_np_to_service_wo_selectors
Seems like the test in question was only waiting for the NP to get the
podSelector written into the status and not for the expected and
existing SG rules to match. This commit fixes that.

Change-Id: I04c3906225877caafe26487696991e9e3dbaf082
2022-02-23 14:25:34 +01:00
Jon Uriarte 68b3f43b25 Amend NP CRD pod selector check loop
Add namespace parameter to get_np_crd_info() method call
and timeout condition to_egress_np_to_service_wo_selectors
test.

Change-Id: I10fe58d3e008817c882435f085a943e54eb9a2de
2022-01-24 16:57:29 +00:00
Zuul 49088c155a Merge "Add test_service_with_not_ready_endpoints test" 2022-01-24 11:06:37 +00:00
Zuul fd9ced52b3 Merge "Define new test_endpoints_object_removal config option" 2022-01-24 11:06:35 +00:00
Zuul 8f9da81d3b Merge "Fix lb_reconcile_timeout exception formatting" 2022-01-24 11:06:33 +00:00
Zuul 4d7bf141fa Merge "Amend check_sg_rules_for_np() method" 2022-01-24 11:06:31 +00:00
Jon Uriarte 635cf80fc5 Define new test_endpoints_object_removal config option
There are some old kuryr-kubernetes versions that don't
support LB pool members removal upon endpoint deletion.
For such cases, and in order to be able to run the test
test_service_without_selector for all the versions, a
new configuration option test_endpoints_object_removal
is defined.

It's expected to set test_endpoints_object_removal to
False in those environments where the removal is not
supported, and keep it to the default True value in
the rest of them.

Change-Id: I8c2d6e8e66d707fcf22311456c0584a6167acea1
2022-01-19 22:24:24 +00:00
Jon Uriarte fca8e58141 Fix lb_reconcile_timeout exception formatting
It was complaining about string formatting when the timeouts
were being reached:
TypeError: not all arguments converted during string formatting

Change-Id: Ia926be7d43c0f06b775a35092fe644c0c7b78b1d
2022-01-18 23:09:39 +00:00
Zuul 871fe9ece6 Merge "Fix test_port_pool when namespace is created" 2022-01-17 14:09:43 +00:00
Jon Uriarte 2ffdd2f475 Add test_service_with_not_ready_endpoints test
This test case automates the issue described in
BZ https://bugzilla.redhat.com/show_bug.cgi?id=1980957.

The new test case:
 - creates a deployment with a failing readiness probe so all
   the pods are not ready
 - creates a service for the deployment (where the endpoints
   are not ready)
 - it checks Kuryr pods are not restarted

Change-Id: Id19f85625901b35900f9441aace8fe8938cb1d68
2022-01-14 18:24:17 +00:00
Jon Uriarte d9a93bcba9 Amend check_sg_rules_for_np() method
Move ingress_cidrs_found and egress_cidrs_initialization to
inside the while loop so they're cleared in each iteration.
Move rule match comprobation outside the rules for loop.

Change-Id: I1acba9f407de084f19d9ee12fb6e95de03d578df
2022-01-14 18:13:01 +00:00
Zuul 5fd8c32c31 Merge "Add wait until active LB in NP test" 2022-01-14 02:26:36 +00:00
Zuul 3a8ccf5b4f Merge "Tune curl repetitions value" 2022-01-13 08:02:15 +00:00
Zuul cbc0e8f326 Merge "Ensure lb is active before checking connectivity" 2022-01-13 08:02:13 +00:00
Jon Uriarte 7a63c928e7 Add wait until active LB in NP test
The test test_egress_np_to_service_wo_selector is failing in some
environments when checking the connectivity to services (before
the NP is applied). The endpoints are defined in kuryrloadbalancers
objects but the connectivity is not working.

This change adds the method wait_until_service_LB_is_active() and
calls it in that test before checking the connectivity to the
services.

Change-Id: I41cec1ea1db43e2fbeb0bf6d5fafb84c87e77d1c
2022-01-11 12:36:58 +00:00
Jon Uriarte 3408ab72d7 Tune curl repetitions value
For svc and route endpoint connectivity checks there is a repetition
parameter that can be tuned to be proportional to the expected number
of different endpoint responses.

For each expected different backend 10 repetitions seems to be enough
and it will save significant tests execution time.

Change-Id: Id9e6389bfafc89a4d407952ee0625a932b51ef38
2022-01-07 12:50:52 +00:00
Maysa Macedo 46ddd75cf7 Ensure lb is active before checking connectivity
This commit ensures the load-balancer is active before checking
connectivity to it for the scenario of test_pod_service_curl.

Change-Id: I935cc510d8d96ca031f30c4a3dbdfec6a6238e92
2022-01-07 12:36:44 +00:00
Jon Uriarte f79bb312b9 Fix check_controller_pod_status_for_time_period()
The method has the status parameter but then it's not being used
to compare with the obtained status, as 'Running' is always used.

This change replaces the hardcoded status with the status parameter.

Change-Id: I7c716dd11f4ed14a31fd5d5aa4706db136cbbeed
2022-01-05 16:28:59 +00:00
Zuul 804a54584e Merge "Remove LB_TIMEOUT in favor of lb_build_timeout" 2022-01-03 16:46:53 +00:00
Itzik Brown 97af3a8d2e Fix test_port_pool when namespace is created
A pod is needed to be created also for the case where trigger_namespace_upon_pod=False

Change-Id: I2af9e1d2be84ace03ccb7224a0c9357500123a20
2021-12-27 09:50:31 +02:00
Zuul 13e740911c Merge "Change get_readiness_state() return type" 2021-12-24 14:25:18 +00:00
Zuul 011dfaf62f Merge "Fix Namespace handling in port pool" 2021-12-24 13:49:39 +00:00
Jon Uriarte 8501f18e61 Remove LB_TIMEOUT in favor of lb_build_timeout
Using the CONF.kuryr_kubernetes.lb_build_timeout config option instead
of the LB_TIMEOUT constant allows modifing the LB creation timeout for
different environments where the LB creation time can vary
significantly.

Remove LB_RECONCILE_TIMEOUT as well in favor of a new config option
CONF.kuryr_kubernetes.lb_reconcile_timeout.

Change-Id: Id1eb72c294abd6a2e5111bd0c7f97e311969b698
2021-12-23 12:29:31 +00:00
Jon Uriarte 8dbe6be09c Change get_readiness_state() return type
Remove the usage of the bool() method as it wasn't behaving as expected
- bool("False") returns True instead of False.

The get_readiness_state() method was returning a string when
container_name wasn't None and it's been changed to return a boolean
instead.
container.ready param is already a Boolean but condition.status is a
string.

Increase the timeout waiting for pods to be ready after scaling in the
scale_deployment() method.

Change-Id: Ie64f868b877ca4c9f1ff8916360638f013fc2926
2021-12-22 22:52:37 +00:00
Zuul c62a4a8be4 Merge "Small improvement in method definition and reference" 2021-12-22 09:46:43 +00:00
Michał Dulko 34378686c7 Fallback from V1EndpointPort to CoreV1EndpointPort
For some unknown reason kubernetes==21.7.0 renamed V1EndpointPort to
CoreV1EndpointPort while other V1Endpoint* haven't got the prefix. This
seems like a bug, but in order to deal with it, this patch adds a
fallback to the new name.

Change-Id: I4c38c09faba99c8ca56abc0a32bc421011f9b2dd
2021-12-20 10:52:31 +01:00
Jon Uriarte 38f9d65574 Small improvement in method definition and reference
Clean-up in get_pod_readiness() method definition and change a reference to
get_pod_readiness() by get_container_readiness().

Change-Id: Icf2b7b99d5142298bd9a11d79ae05e83932d270a
2021-12-17 12:45:04 +00:00
Itzik Brown 81a6468d6f Fix Namespace handling in port pool
With the handling of Namespaces now being
dependent on Pods creation, tempests tests
need to get updated to account for that.

Updated port_pool test

Change-Id: Icd96eeb0594d43d82d72fa5f065f0c89021b935b
Depends-on: I0a69e0963aaef186238c0e1bd0bdc4430e3e197c
2021-12-14 10:04:43 +02:00
Itzik Brown e1fdcc0a5b Update scale deployment
- Move scale deployment to base
- Check pods are ready after scaling the deployment

Change-Id: I56da873e5a3e1a0e32909fdbdd65a5888c054be8
2021-11-07 12:20:32 +02:00