-
Notifications
You must be signed in to change notification settings - Fork 38
UPSTREAM: <carry>: openshift: Set instance subnet and load balancers explicitly #35
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
UPSTREAM: <carry>: openshift: Set instance subnet and load balancers explicitly #35
Conversation
| return errors.Errorf("unknown value %s for label `set` on machine %s, skipping machine creation", set, s.scope.Machine.Name) | ||
|
|
||
| if s.scope.MachineConfig.Subnet == "" { | ||
| return errors.Errorf("unable to create network interface: mising subnet in %q machine provider config", s.scope.Machine.Name) |
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.
typo: missing.
b8911b6 to
80ee1bc
Compare
| Name: nicName, | ||
| VnetName: azure.GenerateVnetName(s.scope.Cluster.Name), | ||
| } | ||
| switch set := s.scope.Machine.ObjectMeta.Labels[v1alpha1.MachineRoleLabel]; set { |
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.
If the Subnet is empty you could populate the hardcoded ones above just for backward compat.
Something like
if subnet == "" {
} else {
//fallback
}
Eventually the fallback code can be removed
| networkInterfaceSpec.SubnetName = azure.GenerateNodeSubnetName(s.scope.Cluster.Name) | ||
| case v1alpha1.ControlPlane: | ||
| networkInterfaceSpec.SubnetName = azure.GenerateControlPlaneSubnetName(s.scope.Cluster.Name) | ||
| networkInterfaceSpec.PublicLoadBalancerName = azure.GeneratePublicLBName(s.scope.Cluster.Name) |
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.
These names are must have, since control plane requires public and internal load balancer for access into the cluster.
its an unfortunate design hope to change it in future. The way it works now is
CreateControlPlaneVM -> CreateNetworkInterface -> AttachInterfacetoloadblancer
Instead hope to work this way
CreateControlPlaneVM -> CreateNetworkInterface
UpdateLoadBalancerRules with NetworkInterface
That way control plane is decoupled from load balancers.
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.
So you still have a use for the control plane code? How does the installer reuses the azure actuator these days? E.g. what resources are create by the azure actuator and which by the installer?
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.
azure actuator only creates vm and sets up configuration of the base infra (example registering network interface with the load balancers)
as for worker nodes it just creates it on the base infra (right now all the names are hardcoded between installer and actuator hence little fragile), aim was to get it decoupled if we had time.
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.
Also azure will never have name conflicts so its ok to hardcode since all the resources are restricted to a certain resource group for each sub/tenantid
|
/hold |
80ee1bc to
32161e7
Compare
32161e7 to
0a79259
Compare
| if s.scope.MachineConfig.InternalLoadBalancer != "" { | ||
| networkInterfaceSpec.InternalLoadBalancerName = s.scope.MachineConfig.InternalLoadBalancer | ||
| } | ||
| } else { |
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.
why do we this fallback? I'd like to remove v1alpha1.MachineRoleLabel dependency
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.
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.
so @awesomenix if this only for backward compatibility? I don't think we care much at this dev stage, there's no e2e yet. @ingvagabund can we drop all no necessary labels code and putting the counter part PR on installer?
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.
@enxebre Control plane nodes needs to be behind public and internal load balancer, not sure how to determine that without labels. If there is some other method @ingvagabund feel free to change this logic
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.
ah! i see that the master spec would contain the public load balancer and internal load balancer fields. In that case @ingvagabund i support @enxebre comments and drop this as he mentions its more of dev stage.
it would be better if Natrule is dropped as well
| networkInterfaceSpec.SubnetName = azure.GenerateControlPlaneSubnetName(s.scope.Cluster.Name) | ||
| networkInterfaceSpec.PublicLoadBalancerName = azure.GeneratePublicLBName(s.scope.Cluster.Name) | ||
| networkInterfaceSpec.InternalLoadBalancerName = azure.GenerateInternalLBName(s.scope.Cluster.Name) | ||
| networkInterfaceSpec.NatRule = 0 |
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.
ah! been wanting to get rid of this Natrules as well, since ssh for masters are not enabled by default on openshift. Probably better to provide the natrule as an input
0a79259 to
89dd156
Compare
|
@awesomenix added new |
|
/hold cancel |
I meant you need to remove this part of the code if NatRule is not set cluster-api-provider-azure/pkg/cloud/azure/services/networkinterfaces/networkinterfaces.go Line 117 in ede8126
I think openshift doesnt want to enable ssh access by default to masters, in this case, the input Natrule would decide whether to set it on the network interface or not. So making this input optional (hence setting it to nil) would get around the problem |
…explicitly Do not rely on machine.openshift.io/cluster-api-machine-role label to determine subnet name and/or load balancer(s) name. Instead, allow to set explicit names for resources so different worker machine groups can have different resources.
89dd156 to
1350002
Compare
|
@awesomenix done, PTAL |
|
/lgtm |
|
@awesomenix: changing LGTM is restricted to assignees, and only openshift/cluster-api-provider-azure repo collaborators may be assigned issues. DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
|
[APPROVALNOTIFIER] This PR is APPROVED Approval requirements bypassed by manually added approval. This pull-request has been approved by: The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
cluster-api-provider-azure PR [1], allows installer to set the subnets for machines explicitly rather than the implicit names. The new subnet name for control plane VMs is `<cluster-id>-master-subnet`, while the subnet name for compute VMs is `<cluster-id>-worker-subnet` based on the `role` for these MachinePools [1]: openshift/cluster-api-provider-azure#35
Bump to being in changes from openshift/cluster-api-provider-azure#35
Do not rely on machine.openshift.io/cluster-api-machine-role label to determine
subnet name. Instead, use specific subnet so different worker machine groups
can have different subnet.
What this PR does / why we need it:
Which issue(s) this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)format, will close the issue(s) when PR gets merged):Fixes #
Special notes for your reviewer:
Please confirm that if this PR changes any image versions, then that's the sole change this PR makes.
Release note: