-
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -549,16 +549,21 @@ func (s *Reconciler) createNetworkInterface(ctx context.Context, nicName string) | |
| Name: nicName, | ||
| VnetName: azure.GenerateVnetName(s.scope.Cluster.Name), | ||
| } | ||
| switch set := s.scope.Machine.ObjectMeta.Labels[v1alpha1.MachineRoleLabel]; set { | ||
| case v1alpha1.Node: | ||
| 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 commentThe 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 That way control plane is decoupled from load balancers.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 commentThe 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 commentThe 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 |
||
| networkInterfaceSpec.InternalLoadBalancerName = azure.GenerateInternalLBName(s.scope.Cluster.Name) | ||
| networkInterfaceSpec.NatRule = 0 | ||
| default: | ||
| 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("MachineConfig subnet is missing on machine %s, skipping machine creation", s.scope.Machine.Name) | ||
| } | ||
|
|
||
| networkInterfaceSpec.SubnetName = s.scope.MachineConfig.Subnet | ||
|
|
||
| if s.scope.MachineConfig.PublicLoadBalancer != "" { | ||
| networkInterfaceSpec.PublicLoadBalancerName = s.scope.MachineConfig.PublicLoadBalancer | ||
| if s.scope.MachineConfig.NatRule != nil { | ||
| networkInterfaceSpec.NatRule = s.scope.MachineConfig.NatRule | ||
| } | ||
| } | ||
| if s.scope.MachineConfig.InternalLoadBalancer != "" { | ||
| networkInterfaceSpec.InternalLoadBalancerName = s.scope.MachineConfig.InternalLoadBalancer | ||
| } | ||
|
|
||
| if s.scope.MachineConfig.PublicIP { | ||
|
|
||
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