Skip to content
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

Private networking fixes #588

Merged
merged 17 commits into from
Apr 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions src/deploy-cromwell-on-azure/Deployer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,11 @@ await Task.Run(async () =>
await AssignVmAsContributorToStorageAccountAsync(managedIdentity, storageAccount);
await AssignVmAsDataReaderToStorageAccountAsync(managedIdentity, storageAccount);
await AssignManagedIdOperatorToResourceAsync(managedIdentity, resourceGroup);

if (!string.IsNullOrWhiteSpace(configuration.BatchNodesSubnetId))
{
await AssignMIAsNetworkContributorToResourceAsync(managedIdentity, resourceGroup);
}
});

if (configuration.CrossSubscriptionAKSDeployment.GetValueOrDefault())
Expand Down Expand Up @@ -1003,6 +1008,21 @@ private Task AssignManagedIdOperatorToResourceAsync(IIdentity managedIdentity, I
.CreateAsync(cts.Token)));
}

private Task AssignMIAsNetworkContributorToResourceAsync(IIdentity managedIdentity, IResource resource)
{
// https://learn.microsoft.com/en-us/azure/role-based-access-control/built-in-roles#network-contributor
var roleDefinitionId = $"/subscriptions/{configuration.SubscriptionId}/providers/Microsoft.Authorization/roleDefinitions/4d97b98b-1d4f-4787-a291-c67834d212e7";
return Execute(
$"Assigning Network Contributor role for the managed id to resource group scope...",
() => roleAssignmentHashConflictRetryPolicy.ExecuteAsync(
() => azureSubscriptionClient.AccessManagement.RoleAssignments
.Define(Guid.NewGuid().ToString())
.ForObjectId(managedIdentity.PrincipalId)
.WithRoleDefinition(roleDefinitionId)
.WithResourceScope(resource)
.CreateAsync(cts.Token)));
}

private Task AssignVmAsDataReaderToStorageAccountAsync(IIdentity managedIdentity, IStorageAccount storageAccount)
{
// https://docs.microsoft.com/en-us/azure/role-based-access-control/built-in-roles#storage-blob-data-reader
Expand Down
5 changes: 5 additions & 0 deletions src/deploy-cromwell-on-azure/samples/docker-dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM docker.io/library/docker:latest

ENV DEBIAN_FRONTEND=noninteractive
RUN apk add grep
RUN apk add bash