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

Azure: Allow to manage machine with identity #395

Merged
merged 1 commit into from
Jan 31, 2020
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions kubernetes/machine_classes/azure-machine-class.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ spec:
publicKeys:
path: "/path/to/public-key/in/machine" # Path to public key
keyData: "public-key-data" # Public key data
identityID: "/subscriptions/subscription-id/resourceGroups/resource-group-name/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity-name" # ID of an user assigned managed identity to attach the machine to
zone: 1 # Zone which the node will be deployed into. Either a zone or an AvailabilitySet can be specified.
availabilitySet: # AvailabilitySet which the node will be assigned to. Either a zone or an AvailabilitySet can be specified.
id: "/subscriptions/subscription-id/resourceGroups/resource-group-name/providers/Microsoft.Compute/availabilitySets/availablity-set-name" # ID of availability set to attach the machine to
1 change: 1 addition & 0 deletions pkg/apis/machine/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -875,6 +875,7 @@ type AzureVirtualMachineProperties struct {
OsProfile AzureOSProfile
NetworkProfile AzureNetworkProfile
AvailabilitySet *AzureSubResource
IdentityID *string
Zone *int
}

Expand Down
1 change: 1 addition & 0 deletions pkg/apis/machine/v1alpha1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -956,6 +956,7 @@ type AzureVirtualMachineProperties struct {
OsProfile AzureOSProfile `json:"osProfile,omitempty"`
NetworkProfile AzureNetworkProfile `json:"networkProfile,omitempty"`
AvailabilitySet *AzureSubResource `json:"availabilitySet,omitempty"`
IdentityID *string `json:"identityID,omitempty"`
Zone *int `json:"zone,omitempty"`
}

Expand Down
2 changes: 2 additions & 0 deletions pkg/apis/machine/v1alpha1/zz_generated.conversion.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions pkg/apis/machine/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions pkg/apis/machine/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions pkg/client/listers/machine/internalversion/machineclass.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions pkg/client/listers/machine/v1alpha1/machineclass.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions pkg/driver/driver_azure.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,15 @@ func (d *AzureDriver) getVMParameters(vmName string, networkInterfaceReferenceID
}
}

if d.AzureMachineClass.Spec.Properties.IdentityID != nil && *d.AzureMachineClass.Spec.Properties.IdentityID != "" {
VMParameters.Identity = &compute.VirtualMachineIdentity{
Type: compute.ResourceIdentityTypeUserAssigned,
UserAssignedIdentities: map[string]*compute.VirtualMachineIdentityUserAssignedIdentitiesValue{
*d.AzureMachineClass.Spec.Properties.IdentityID: &compute.VirtualMachineIdentityUserAssignedIdentitiesValue{},
},
}
}

return VMParameters
}

Expand Down
50 changes: 7 additions & 43 deletions pkg/openapi/openapi_generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.