-
Notifications
You must be signed in to change notification settings - Fork 244
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
(Part 3)Fix diffs in compute forwarding rule: remove networkTier
field from global forwarding rule
#2724
Conversation
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
// It will always use GCP's default value, which is "PREMIUM." Any value set by the user will be ignored and not sent to GCP. | ||
// To align with the TF controller, I remove this field. | ||
// Ideally, direct controller should support this field and validate that the value. | ||
forwardingRule.NetworkTier = nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't quite get this (but I like this comment). Could you describe what the Compute GCP service does for this field? I guess I'm confused because from your description it looks like TF sets the default "PREMIUM", in which case this code shall use "PREMIUM" as well to keep the behavior, but it sets 'nil'? Or, is the "PREMIUM" set by the GCP service if nil is passed in? If it is the latter, does the GCP return any errors/warnings?
Regarding the previous TF behavior, I guess it could relate to the spec "auto-correct" in state-into-spec:merge
mode.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The latter one.
TF for global forwarding rule does not have "networkTier" field(see their documentation), that means whatever value provided by user, will be ignored in the request. If the field is unspecified, GCP will default it to "PREMIUM", no errors/warnings. I hope below example can explain that clearly:
Configuration yaml:
metadata:
name: globalforwardingrule
spec:
networkTier: "anything"
(other fields)
request body with TF controller:
POST ...globalforwardingrule...
{
(other fields)
}
200 ok
{
operationType: insert,
progress: 0,
status: RUNNING,
}
response body with TF controller:
GET ...gloablforwardingrule...
200 ok
{
networkTier: "PREMIUM"
(other fields)
}
Quote the field description: For regional ForwardingRule, the valid values are 'PREMIUM' and 'STANDARD'. For GlobalForwardingRule, the valid value is 'PREMIUM'. If this field is not specified, it is assumed to be 'PREMIUM'.
I think that explains why TF does not support this field for global forwarding rule and uses GCP default value.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the explanation. I think
- we want to include the
networkTier
field instatus.observedState
. - I think we don't need this line
forwardingRule.NetworkTier = nil
, with the previous TF-basedstate-into-spec: merge
default, this guarantees backward compatibility for existing forwarding rules.
9e831e6
to
91374c9
Compare
As discussed, we do not want to drop "networkTier" field in direct controller. The diff is acceptable. |
Change description
Based on #2723. To review the change, check the last commit in this PR.
TF does not support networkTier field for global forwarding rule, It will always use GCP's default value "PREMIUM". Any value set by the user will be ignored and not sent to GCP.
Not sure if that's an ideal behavior, but let's try to match TF controller at this point.
Tests you have done
make ready-pr
to ensure this PR is ready for review.