Skip to content

Conversation

@ingvagabund
Copy link
Member

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:


@openshift-ci-robot openshift-ci-robot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label May 31, 2019
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)

Choose a reason for hiding this comment

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

typo: missing.

@ingvagabund ingvagabund force-pushed the set-instance-subnet-explicitly branch from b8911b6 to 80ee1bc Compare May 31, 2019 15:09
Name: nicName,
VnetName: azure.GenerateVnetName(s.scope.Cluster.Name),
}
switch set := s.scope.Machine.ObjectMeta.Labels[v1alpha1.MachineRoleLabel]; set {

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)

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.

Copy link
Member Author

@ingvagabund ingvagabund May 31, 2019

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?

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.

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

@ingvagabund
Copy link
Member Author

/hold

@openshift-ci-robot openshift-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jun 2, 2019
@ingvagabund ingvagabund force-pushed the set-instance-subnet-explicitly branch from 80ee1bc to 32161e7 Compare June 2, 2019 16:36
@openshift-ci-robot openshift-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Jun 2, 2019
@ingvagabund ingvagabund force-pushed the set-instance-subnet-explicitly branch from 32161e7 to 0a79259 Compare June 2, 2019 16:38
@ingvagabund ingvagabund changed the title UPSTREAM: <carry>: openshift: Set instance subnet explicitly UPSTREAM: <carry>: openshift: Set instance subnet and load balancers explicitly Jun 2, 2019
if s.scope.MachineConfig.InternalLoadBalancer != "" {
networkInterfaceSpec.InternalLoadBalancerName = s.scope.MachineConfig.InternalLoadBalancer
}
} else {
Copy link
Member

@enxebre enxebre Jun 3, 2019

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

Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link
Member

@enxebre enxebre Jun 3, 2019

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?

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

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

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

@ingvagabund
Copy link
Member Author

ingvagabund commented Jun 4, 2019

@awesomenix added new NatRule field and removed the fallback per #35 (comment) and #35 (comment). PTAL.

@ingvagabund
Copy link
Member Author

/hold cancel

@openshift-ci-robot openshift-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jun 5, 2019
@awesomenix
Copy link

@awesomenix added new NatRule field and removed the fallback per #35 (comment) and #35 (comment). PTAL.

I meant you need to remove this part of the code if NatRule is not set

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.
@ingvagabund ingvagabund force-pushed the set-instance-subnet-explicitly branch from 89dd156 to 1350002 Compare June 6, 2019 11:33
@ingvagabund
Copy link
Member Author

@awesomenix done, PTAL

@awesomenix
Copy link

/lgtm

@openshift-ci-robot
Copy link

@awesomenix: changing LGTM is restricted to assignees, and only openshift/cluster-api-provider-azure repo collaborators may be assigned issues.

Details

In response to this:

/lgtm

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.

@ingvagabund ingvagabund added approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. labels Jun 6, 2019
@openshift-ci-robot
Copy link

[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

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-merge-robot openshift-merge-robot merged commit 702ef3a into openshift:master Jun 6, 2019
@ingvagabund ingvagabund deleted the set-instance-subnet-explicitly branch June 6, 2019 16:29
abhinavdahiya added a commit to abhinavdahiya/installer that referenced this pull request Jun 7, 2019
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
abhinavdahiya added a commit to abhinavdahiya/installer that referenced this pull request Jun 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants