Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[test] Add additional test helpers for pod and NAD #588

Merged
merged 2 commits into from
Dec 12, 2024

Conversation

stuggi
Copy link
Contributor

@stuggi stuggi commented Dec 11, 2024

GetNAD - retrieves a NetworkAttachmentDefinition resource.
Example usage:

th.GetNAD(types.NamespacedName{Name: "test-nad", Namespace: "test-namespace"})

CreateNAD creates a new NetworkAttachmentDefinition resource with the provided spec.
Example usage:

spec := map[string]interface{}{"key": "value"}
p := th.CreateNAD(types.NamespacedName{Namespace: "default", Name: "example"}, spec)

CreatePod creates a new Pod resource with the provided annotations and spec.
Example usage:

annotations := map[string]string{}{"key": "value"}
spec := map[string]interface{}{"key": "value"}
p := th.CreatePod(types.NamespacedName{Namespace: "default", Name: "example"}, annotations, spec)

CreatePod creates a new Pod resource with the provided annotations and spec.

Example usage:

~~~
annotations := map[string]string{}{"key": "value"}
spec := map[string]interface{}{"key": "value"}
p := th.CreatePod(types.NamespacedName{Namespace: "default", Name: "example"}, annotations, spec)
~~~

Signed-off-by: Martin Schuppert <[email protected]>
stuggi added a commit to stuggi/infra-operator that referenced this pull request Dec 11, 2024
Secondary network interfaces on pods need be announced in a BGP
environment. This can be done by creating FRRConfiguration, per
default in the metallb namespace.

This PR introduce a new CRD which, if an instance got created,
the controller watches pods
* which have the NAD annotation on it
* the NAD has an IPAM configured

For each of them a FRRConfiguration gets created. The metallbs
k8s service FRRConfiguration of that worker node is taken as the
base to create this configuration.

Known issue:
Since there are then two FRRConfiguration, which hold same configs,
like timeouts. It is not possible to update thise. The FRRConfiguration
webhook will block those. A possible way to change it, would be
stop the infra-operator controller-manager, delete the pod
FRRConfigurations, do the change that it gets reflected in the
metallb LB FRRConfiguration, then enable the controller that the
pod FRRConfiguration get re-created.

Depends-On: openstack-k8s-operators/lib-common#588

Jira: OSPRH-12384

Signed-off-by: Martin Schuppert <[email protected]>
@stuggi stuggi requested a review from abays December 11, 2024 15:21
GetNAD - retrieves a NetworkAttachmentDefinition resource.
Example usage:

~~~
th.GetNAD(types.NamespacedName{Name: "test-nad", Namespace: "test-namespace"})
~~~

CreateNAD creates a new NetworkAttachmentDefinition resource with the provided spec.
Example usage:

~~~
spec := map[string]interface{}{"key": "value"}
p := th.CreateNAD(types.NamespacedName{Namespace: "default", Name: "example"}, spec)
~~~

Signed-off-by: Martin Schuppert <[email protected]>
Copy link
Contributor

@abays abays left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@stuggi stuggi merged commit 9796f77 into openstack-k8s-operators:main Dec 12, 2024
2 checks passed
stuggi added a commit to stuggi/infra-operator that referenced this pull request Dec 12, 2024
Secondary network interfaces on pods need be announced in a BGP
environment. This can be done by creating FRRConfiguration, per
default in the metallb namespace.

This PR introduce a new CRD which, if an instance got created,
the controller watches pods
* which have the NAD annotation on it
* the NAD has an IPAM configured

For each of them a FRRConfiguration gets created. The metallbs
k8s service FRRConfiguration of that worker node is taken as the
base to create this configuration.

Known issue:
Since there are then two FRRConfiguration, which hold same configs,
like timeouts. It is not possible to update thise. The FRRConfiguration
webhook will block those. A possible way to change it, would be
stop the infra-operator controller-manager, delete the pod
FRRConfigurations, do the change that it gets reflected in the
metallb LB FRRConfiguration, then enable the controller that the
pod FRRConfiguration get re-created.

Depends-On: openstack-k8s-operators/lib-common#588

Jira: OSPRH-12384

Signed-off-by: Martin Schuppert <[email protected]>
stuggi added a commit to stuggi/infra-operator that referenced this pull request Dec 12, 2024
Secondary network interfaces on pods need be announced in a BGP
environment. This can be done by creating FRRConfiguration, per
default in the metallb namespace.

This PR introduce a new CRD which, if an instance got created,
the controller watches pods
* which have the NAD annotation on it
* the NAD has an IPAM configured

For each of them a FRRConfiguration gets created. The metallbs
k8s service FRRConfiguration of that worker node is taken as the
base to create this configuration.

Known issue:
Since there are then two FRRConfiguration, which hold same configs,
like timeouts. It is not possible to update thise. The FRRConfiguration
webhook will block those. A possible way to change it, would be
stop the infra-operator controller-manager, delete the pod
FRRConfigurations, do the change that it gets reflected in the
metallb LB FRRConfiguration, then enable the controller that the
pod FRRConfiguration get re-created.

Depends-On: openstack-k8s-operators/lib-common#588

Jira: OSPRH-12384

Signed-off-by: Martin Schuppert <[email protected]>
stuggi added a commit to stuggi/infra-operator that referenced this pull request Dec 12, 2024
Secondary network interfaces on pods need be announced in a BGP
environment. This can be done by creating FRRConfiguration, per
default in the metallb namespace.

This PR introduce a new CRD which, if an instance got created,
the controller watches pods
* which have the NAD annotation on it
* the NAD has an IPAM configured

For each of them a FRRConfiguration gets created. The metallbs
k8s service FRRConfiguration of that worker node is taken as the
base to create this configuration.

Known issue:
Since there are then two FRRConfiguration, which hold same configs,
like timeouts. It is not possible to update thise. The FRRConfiguration
webhook will block those. A possible way to change it, would be
stop the infra-operator controller-manager, delete the pod
FRRConfigurations, do the change that it gets reflected in the
metallb LB FRRConfiguration, then enable the controller that the
pod FRRConfiguration get re-created.

Depends-On: openstack-k8s-operators/lib-common#588

Jira: OSPRH-12384

Signed-off-by: Martin Schuppert <[email protected]>
stuggi added a commit to stuggi/infra-operator that referenced this pull request Dec 12, 2024
Secondary network interfaces on pods need be announced in a BGP
environment. This can be done by creating FRRConfiguration, per
default in the metallb namespace.

This PR introduce a new CRD which, if an instance got created,
the controller watches pods
* which have the NAD annotation on it
* the NAD has an IPAM configured

For each of them a FRRConfiguration gets created. The metallbs
k8s service FRRConfiguration of that worker node is taken as the
base to create this configuration.

Known issue:
Since there are then two FRRConfiguration, which hold same configs,
like timeouts. It is not possible to update thise. The FRRConfiguration
webhook will block those. A possible way to change it, would be
stop the infra-operator controller-manager, delete the pod
FRRConfigurations, do the change that it gets reflected in the
metallb LB FRRConfiguration, then enable the controller that the
pod FRRConfiguration get re-created.

Depends-On: openstack-k8s-operators/lib-common#588

Jira: OSPRH-12384

Signed-off-by: Martin Schuppert <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants