-
Bug
-
Resolution: Unresolved
-
Undefined
-
None
-
4.18, 4.19, 4.20
-
None
-
None
-
False
-
-
rhos-conplat-osasinfra
-
None
-
None
-
None
-
None
-
None
-
None
-
None
-
None
-
None
-
None
-
None
-
None
-
None
-
None
Description of problem:
OpenStack has the optional network extension "tag": https://docs.openstack.org/api-ref/network/v2/index.html#tag-extension-tags Since this is an optional extensions, some OpenStack-based cloud providers may not support it. If this extension is not supported by a cloud provider, the function replaceAllAttributesTags() fails when creating a network port with "tags".
Version-Release number of selected component (if applicable):
main
How reproducible:
On a cloud provider that do not support network extension for tag i.e., the endpoint /v2.0/ports/port-id/tags is not available
Steps to Reproduce:
Create a machine using the machine set api
Actual results:
Network port creation fails in replaceAllAttributesTags() with error:
I1112 15:07:32.662285 1 recorder.go:104] "msg"="Failed to replace all attributestags, 39801849-eb0c-46ea-a0e4-570e838a1c83: Resource not found: [PUT https://<endpoint>/v2.0/ports/39801849-eb0c-46ea-a0e4-570e838a1c83/tags], error message: {\"error_msg\":\"The API does not exist: method PUT not found\",\"error_code\":\"APIGW.0101\",\"request_id\":\"4ef67fed5e7e7b48979ccb287d02c69e\"}\n" "logger"="events" "object"={"kind":"Machine","namespace":"openshift-machine-api","name":"openshift-5mj7s-worker-z46h8","uid":"9b8f91f2-86fe-4c6b-93a8-0bc8f5eed496","apiVersion":"machine.openshift.io/v1beta1","resourceVersion":"7914878"} "reason"="Failedreplaceallattributestags" "type"="Warning"
Expected results:
Network port creation should be successful. Because a failure to set tags should not block machine provisioning when an OpenStack provider does not support this extension.
Additional info:
1. Compare upstream vs MAPO
In the upstream cluster-api-provider-openstack, the server has no default "tags". If we do not set "tags" in the spec of both server and port, by default, the port has no tags (no issues).
https://github.com/kubernetes-sigs/cluster-api-provider-openstack/blob/main/pkg/cloud/services/networking/port.go#L471
But in MAPO, the server always has default "tags" and the port inherits the default tags from the server:
https://github.com/openshift/machine-api-provider-openstack/blob/main/pkg/machine/convert.go#L300
2. Proposed solution
OPTION 1. Remove the default tags of the server in MAPO (same as upstream cluster-api-provider-openstack)
OPTION 2. Check for extension support before use
In the current implementation, "trunk" is also an optional extension and MAPO checks the endpoint GET /v2.0/extensions if it contains the alias "trunk" before using it:
https://github.com/openshift/machine-api-provider-openstack/blob/main/vendor/sigs.k8s.io/cluster-api-provider-openstack/pkg/cloud/services/networking/trunk.go#L39
Therefore, we propose:
Before calling replaceAllAttributesTags(), check if:
GET /v2.0/extensions
contains the alias: "standard-attr-tag"
If not:
log.Info("Tagging not supported by Neutron, skipping")
return nil