-
Notifications
You must be signed in to change notification settings - Fork 431
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
Added support for Azure Bastion. #1300
Conversation
Hi @whites11. Thanks for your PR. I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. 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. |
/ok-to-test |
@whites11 can you add the copyright info to any new files you created? I think |
Fixed, thx |
Not sure how to fix the apidiff job. Any hints? |
It doesn't have to be fixed. They are just warnings when there are changes in api. |
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 think the conversion code can be slimmed up a bit. I don't think the extra bastion annotation is needed as the entire converted structure should be available via the utilconversion
annotation.
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.
One small nit, but overall the PR looks great!
I do have a concern about not having an e2e test to ensure the functionality doesn't regress. Would you consider adding a bastion to the existing e2e cluster deployment (perhaps, ./templates/test/ci/prow
) and a test verifying successful deployment of the bastion?
I wonder if the bastion shouldn't be part of the default template... @CecileRobertMichon wdyt?
@@ -58,6 +58,8 @@ func (src *AzureCluster) ConvertTo(dstRaw conversion.Hub) error { // nolint | |||
dst.Spec.NetworkSpec.APIServerLB.FrontendIPsCount = restored.Spec.NetworkSpec.APIServerLB.FrontendIPsCount | |||
dst.Spec.NetworkSpec.NodeOutboundLB = restored.Spec.NetworkSpec.NodeOutboundLB | |||
|
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.
nit: please remove the space between line 59 and 61.
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.
Blank line removed.
Regarding the e2e test, I will work on that.
I promise to take a closer look tomorrow but in the meantime, would love to see some user-facing docs as part of this PR. re: testing/flavors, I'm worried we're adding too many different flavors / test for each feature, we should start combining some. In what use case does it make the most sense for a user to turn this on? a private API server w/ no ssh maybe? or is it useful even when ssh access is possible? I wouldn't add it to the "default" flavor template if it's going to incur some extra cost for every user (especially quick start users), but it might make sense to add it to the default-prow template (or just the private cluster template if that makes more sense in terms of use case). |
During office hours earlier today we agreed enabling the azure bastion feature in the "internal networking" e2e test and adding additional checks into that test rather than having a dedicated e2e test just for this feature. |
Can anybody please help me a little bit with the e2e tests? |
@whites11 I don't think we are checking the Azure resources are created, but rather the functionality is working. For example, if we apply a machine deployment, we would then check if we can run workloads on those nodes. Perhaps, the same strategy could be used in the bastion. One example that comes to mind is: "Can you ssh into the bastion and then tunnel to one of the private nodes?". wdyt? |
Thanks for the reply. Azure bastion is a web based feature so I doubt I can test it works via a command line tool. I mean, I could use something like cypress, login to azure portal and find my way through the azure bastion feature but I feel like this is overkill. WDYT? |
Hmm... here's an example of setting up an Azure client and calling out to Azure Resource Manager (ARM) to get event logs. Perhaps, use a similar pattern where you create a client, request the bastion resource from ARM, and verify the properties you expect are set. cluster-api-provider-azure/test/e2e/e2e_suite_test.go Lines 181 to 232 in e6edff7
I was thinking about a VM bastion scenario, not the Azure Bastion. My fault. |
/retest |
I don't get why |
@whites11 perhaps, wipe out your |
Didn't work unluckily.
|
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.
A couple of nits and clarifications. I'm fine with opening up a followup pr for the nits as this has been around for a while, and don't want to get lgtm removed. Just want to make sure about the subnet and reconcileDelete clarifications before approving.
c.Spec.BastionSpec.AzureBastion.Name = generateAzureBastionName(c.ObjectMeta.Name) | ||
} | ||
// Ensure defaults for the Subnet settings. | ||
{ |
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.
should we default security group and role here?
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.
default is no security group and no role.
The fields are there because they belong to the SubnetSpec
type.
@@ -254,6 +254,20 @@ func (s *ClusterScope) SubnetSpecs() []azure.SubnetSpec { | |||
Role: s.NodeSubnet().Role, | |||
}, | |||
} | |||
|
|||
if s.AzureCluster.Spec.BastionSpec.AzureBastion != nil { | |||
azureBastionSubnet := s.AzureCluster.Spec.BastionSpec.AzureBastion.Subnet |
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.
IIUC this means azureBastionSubnet will be reconciled in subnetsSvc
as well as in bastionSvc
. Is this intentional?
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.
This is actually a very good point! Not sure how the PR ended up managing subnet and public IP that way, but I removed my handlers and let the other services reconcile the subnet and public IP.
It feels much better now, thanks @shysank
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.
Can we leave bastion subnets and bastion public ip reconciliation to subnteSvc
and publicIpSvc
respectively and have bastionSvc
only reconcile bastion host? Since we reconcile subnets and publicIps are reconciled before bastion, you should not have to check for their existence, and it will make the code much simpler as well. wdyt?
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.
@whites11 Just checking to see if you need any help or is this something you feel is not needed?
cc: @CecileRobertMichon for 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.
makes sense to reconcile bastion subnets and bastion public ip by the subnteSvc and publicIpSvc
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.
/hold
/hold cancel |
/retest |
tested the flow manually and confirmed the e2e tests works as expected, I don't see any outstanding comments /lgtm |
@whites11 you are going to have to generate again to get the verify to pass after the update to capi PR |
can you also add something to the docs about the bastion and how to use it? |
Sure, mind suggesting where I should put those docs? |
you can either add a section in the private cluster section https://github.com/kubernetes-sigs/cluster-api-provider-azure/blob/master/docs/book/src/topics/api-server-endpoint.md , or add a new topic https://github.com/kubernetes-sigs/cluster-api-provider-azure/tree/master/docs/book/src/topics |
@whites11: The following test failed, say
Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR. 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. I understand the commands that are listed here. |
ok Added a new topic here https://github.com/whites11/cluster-api-provider-azure/blob/azure-bastion/docs/book/src/topics/ssh-access.md |
thanks for adding the docs @whites11 /lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: nader-ziada The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/kind feature
What this PR does / why we need it:
Towards: #165
This PR adds support for the first of 3 bastion host implementations for CAPZ: the one using Azure Bastion.
The PR adds a new field to the
AzureCluster
CR that looks like this:by default the
bastionSpec
field is empty and theazureBastion
field is therefore null (that means the feature is disabled by default).User can simply set a value of the
azureBastion
field to enable the feature (other fields are optional and defaulted).Once the feature is enabled, removing it from a cluster is unsupported (see slack thread).
It is possible to enable the azureBastion feature on an existing v1alpha4 cluster though.
Special notes for your reviewer:
Not sure where to put documentation about the feature, guidance would be appreciated.
Please confirm that if this PR changes any image versions, then that's the sole change this PR makes.
No image version changes.
TODOs:
Release note: