This commit is contained in:
Hong Ooi 2020-02-07 05:11:01 +11:00
Родитель 796c8af539
Коммит 66759feaf1
17 изменённых файлов: 98 добавлений и 122 удалений

Просмотреть файл

@ -1,6 +1,6 @@
Package: AzureVM
Title: Virtual Machines in 'Azure'
Version: 2.1.0.9000
Version: 2.1.1
Authors@R: c(
person("Hong", "Ooi", , "hongooi@microsoft.com", role = c("aut", "cre")),
person("Microsoft", role="cph")
@ -21,5 +21,5 @@ Suggests:
testthat,
AzureKeyVault,
AzureVMmetadata
Roxygen: list(markdown=TRUE)
RoxygenNote: 6.1.1
Roxygen: list(markdown=TRUE, r6=FALSE, old_usage=TRUE)
RoxygenNote: 7.0.2

Просмотреть файл

@ -1,7 +1,7 @@
# AzureVM 2.1.0.9000
# AzureVM 2.1.1
- Require R6 2.4.1, which is needed to allow cloning of active bindings in R 4.0.
- The `low_priority` argument to `scaleset_options` is now simply `priority`, with a default of "regular" and an alternative of "spot". Spot VMs are the replacement for low-priority VMs; seee [this page](https://azure.microsoft.com/en-us/pricing/spot/) for more details. Note that you can use the same argument to create a single (non-scaleset) spot VM, with `create_vm(*, priority="spot")`.
- The `low_priority` argument to `scaleset_options` is now simply `priority`, with a default of "regular" and an alternative of "spot". Spot VMs are the replacement for low-priority VMs; seee [this page](https://azure.microsoft.com/en-us/pricing/spot/) for more details. Note that you can use the same argument to create a single (non-scaleset) spot VM, with `create_vm(*, properties=list(priority="spot"))`.
# AzureVM 2.1.0

Просмотреть файл

@ -12,11 +12,11 @@
#' @param nic The network interface for the VM. Can be a call to `nic_config` to create a new interface, or an AzureRMR resource object or resource ID to reuse an existing interface.
#' @param other_resources An optional list of other resources to include in the deployment.
#' @param variables An optional named list of variables to add to the template.
#' @param ... For the specific VM configurations, other customisation arguments to be passed to `vm_config`. For `vm_config`, named arguments that will be folded into the VM resource definition in the template.
#' @param ... For the specific VM configurations, other customisation arguments to be passed to `vm_config`. For `vm_config`, named arguments that will be folded into the VM resource definition in the template. In particular use `properties=list(*)` to set additional properties for the VM, beyond those set by the various configuration functions.
#'
#' @details
#' These functions are for specifying the details of a new virtual machine deployment: the VM image and related options, along with the Azure resources that the VM may need. These include the datadisks, network security group, public IP address (if the VM is to be accessible from outside its subnet), virtual network, and network interface. `vm_config` is the base configuration function, and the others call it to create VMs with specific operating systems and other image details.
#' - `ubuntu_dsvm`: Data Science Virtual Machine, based on Ubuntu 16.04
#' - `ubuntu_dsvm`: Data Science Virtual Machine, based on Ubuntu 18.04
#' - `windows_dsvm`: Data Science Virtual Machine, based on Windows Server 2016
#' - `ubuntu_16.04`, `ubuntu_18.04`: Ubuntu LTS
#' - `windows_2016`, `windows_2019`: Windows Server Datacenter edition
@ -81,8 +81,8 @@
#' # RHEL VM exposing ports 80 (HTTP) and 443 (HTTPS)
#' rhel_8(nsg=nsg_config(nsg_rule_allow_http, nsg_rule_allow_https))
#'
#' # exposing no ports externally
#' rhel_8(nsg=nsg_config(list()))
#' # exposing no ports externally, spot (low) priority
#' rhel_8(nsg=nsg_config(list()), properties=list(priority="spot"))
#'
#' # deploying an extra resource: storage account
#' ubuntu_18.04(

Просмотреть файл

@ -8,8 +8,8 @@
autoscaler_config(profiles = list(autoscaler_profile()), ...)
autoscaler_profile(name = "Profile", minsize = 1, maxsize = NA,
default = NA, scale_out = 0.75, scale_in = 0.25,
interval = "PT1M", window = "PT5M")
default = NA, scale_out = 0.75, scale_in = 0.25, interval = "PT1M",
window = "PT5M")
}
\arguments{
\item{profiles}{A list of autoscaling profiles, each obtained via a call to \code{autoscaler_profile}.}

Просмотреть файл

@ -5,9 +5,6 @@
\alias{az_vm_resource}
\title{Virtual machine resource class}
\format{An R6 object of class \code{az_vm_resource}, inheriting from \code{AzureRMR::az_resource}.}
\usage{
az_vm_resource
}
\description{
Class representing a virtual machine resource. In general, the methods in this class should not be called directly, nor should objects be directly instantiated from it. Use the \code{az_vm_template} class for interacting with VMs instead.
}
@ -41,4 +38,3 @@ The following methods are available, in addition to those provided by the \link[
\href{https://docs.microsoft.com/en-us/rest/api/compute/virtualmachines}{VM API reference}
}
\keyword{datasets}

Просмотреть файл

@ -5,9 +5,6 @@
\alias{az_vm_template}
\title{Virtual machine template class}
\format{An R6 object of class \code{az_vm_template}, inheriting from \code{AzureRMR::az_template}.}
\usage{
az_vm_template
}
\description{
Class representing a virtual machine deployment template. This class keeps track of all resources that are created as part of deploying a VM, and exposes methods for managing them.
}
@ -89,4 +86,3 @@ vm$sync_vm_status()
\href{https://docs.microsoft.com/en-us/rest/api/compute/virtualmachines}{VM API reference}
}
\keyword{datasets}

Просмотреть файл

@ -5,9 +5,6 @@
\alias{az_vmss_resource}
\title{Virtual machine scaleset resource class}
\format{An R6 object of class \code{az_vmss_resource}, inheriting from \code{AzureRMR::az_resource}.}
\usage{
az_vmss_resource
}
\description{
Class representing a virtual machine scaleset resource. In general, the methods in this class should not be called directly, nor should objects be directly instantiated from it. Use the \code{az_vmss_template} class for interacting with scalesets instead.
}
@ -61,4 +58,3 @@ The \code{id} argument lets you specify a subset of instances on which to carry
\href{https://docs.microsoft.com/en-us/rest/api/compute/virtualmachinescalesets}{VM scaleset API reference}
}
\keyword{datasets}

Просмотреть файл

@ -5,9 +5,6 @@
\alias{az_vmss_template}
\title{Virtual machine scaleset (cluster) template class}
\format{An R6 object of class \code{az_vmss_template}, inheriting from \code{AzureRMR::az_template}.}
\usage{
az_vmss_template
}
\description{
Class representing a virtual machine scaleset deployment template. This class keeps track of all resources that are created as part of deploying a scaleset, and exposes methods for managing them.
}
@ -101,4 +98,3 @@ vmss$sync_vmss_status()
\href{https://docs.microsoft.com/en-us/rest/api/compute/virtualmachinescalesets}{VM scaleset API reference}
}
\keyword{datasets}

Просмотреть файл

@ -12,11 +12,9 @@
\method{build_template_definition}{vmss_config}(config, ...)
\method{build_template_parameters}{vm_config}(config, name, login_user,
size, ...)
\method{build_template_parameters}{vm_config}(config, name, login_user, size, ...)
\method{build_template_parameters}{vmss_config}(config, name, login_user,
size, instances, ...)
\method{build_template_parameters}{vmss_config}(config, name, login_user, size, instances, ...)
}
\arguments{
\item{config}{An object of class \code{vm_config} or \code{vmss_config} representing a virtual machine or scaleset deployment.}

Просмотреть файл

@ -39,7 +39,7 @@ create_vm_scaleset(name, ..., resource_group = name, location)
\item \code{datadisks}: Any data disks to attach to the VM or scaleset. See 'Details' below.
\item \code{instances}: For \code{create_vm_scaleset}, the initial number of instances in the scaleset.
\item \code{...} For the subscription methods, any of the other arguments listed here, which will be passed to the resource group method. For the resource group method, additional arguments to pass to the VM/scaleset configuration functions \link{vm_config} and \link{vmss_config}. See the examples below.
\item \code{template,parameters}: The template definition and parameters to deploy. By default, these are constructed from the values of the other arguments, but you can supply your own template and/or parameters as well.
\item \verb{template,parameters}: The template definition and parameters to deploy. By default, these are constructed from the values of the other arguments, but you can supply your own template and/or parameters as well.
\item \code{wait}: Whether to wait until the deployment is complete.
\item \code{mode}: The template deployment mode. If "Complete", any existing resources in the resource group will be deleted.
}

Просмотреть файл

@ -10,8 +10,8 @@ lb_config(type = NULL, rules = list(), probes = list(), ...)
lb_probe(name, port, interval = 5, fail_on = 2, protocol = "Tcp")
lb_rule(name, frontend_port, backend_port = frontend_port,
protocol = "Tcp", timeout = 5, floating_ip = FALSE, probe_name)
lb_rule(name, frontend_port, backend_port = frontend_port, protocol = "Tcp",
timeout = 5, floating_ip = FALSE, probe_name)
}
\arguments{
\item{type}{The SKU of the load balancer resource: "basic" or "standard". If NULL (the default), this will be determined based on the VM scaleset's configuration. Note that the load balancer SKU must be the same as that of its public IP address.}

Просмотреть файл

@ -4,12 +4,11 @@
\alias{scaleset_options}
\title{Virtual machine scaleset options}
\usage{
scaleset_options(keylogin = TRUE, managed_identity = TRUE,
public = FALSE, priority = c("regular", "spot"),
delete_on_evict = FALSE, network_accel = FALSE,
large_scaleset = FALSE, overprovision = TRUE,
upgrade_policy = list(mode = "manual"),
os_disk_type = c("Premium_LRS", "StandardSSD_LRS", "Standard_LRS"))
scaleset_options(keylogin = TRUE, managed_identity = TRUE, public = FALSE,
priority = c("regular", "spot"), delete_on_evict = FALSE,
network_accel = FALSE, large_scaleset = FALSE, overprovision = TRUE,
upgrade_policy = list(mode = "manual"), os_disk_type = c("Premium_LRS",
"StandardSSD_LRS", "Standard_LRS"))
}
\arguments{
\item{keylogin}{Whether to use an SSH public key to login (TRUE) or a password (FALSE). Note that Windows does not support SSH key logins.}

Просмотреть файл

@ -29,48 +29,37 @@ ubuntu_dsvm(keylogin = TRUE, managed_identity = TRUE,
nsg_rule_allow_rstudio)), ...)
windows_dsvm(keylogin = FALSE, managed_identity = TRUE,
datadisks = numeric(0), nsg = nsg_config(list(nsg_rule_allow_rdp)),
...)
datadisks = numeric(0), nsg = nsg_config(list(nsg_rule_allow_rdp)), ...)
ubuntu_16.04(keylogin = TRUE, managed_identity = TRUE,
datadisks = numeric(0), nsg = nsg_config(list(nsg_rule_allow_ssh)),
...)
datadisks = numeric(0), nsg = nsg_config(list(nsg_rule_allow_ssh)), ...)
ubuntu_18.04(keylogin = TRUE, managed_identity = TRUE,
datadisks = numeric(0), nsg = nsg_config(list(nsg_rule_allow_ssh)),
...)
datadisks = numeric(0), nsg = nsg_config(list(nsg_rule_allow_ssh)), ...)
windows_2016(keylogin = FALSE, managed_identity = TRUE,
datadisks = numeric(0), nsg = nsg_config(list(nsg_rule_allow_rdp)),
...)
datadisks = numeric(0), nsg = nsg_config(list(nsg_rule_allow_rdp)), ...)
windows_2019(keylogin = FALSE, managed_identity = TRUE,
datadisks = numeric(0), nsg = nsg_config(list(nsg_rule_allow_rdp)),
...)
datadisks = numeric(0), nsg = nsg_config(list(nsg_rule_allow_rdp)), ...)
rhel_7.6(keylogin = TRUE, managed_identity = TRUE,
datadisks = numeric(0), nsg = nsg_config(list(nsg_rule_allow_ssh)),
...)
rhel_7.6(keylogin = TRUE, managed_identity = TRUE, datadisks = numeric(0),
nsg = nsg_config(list(nsg_rule_allow_ssh)), ...)
rhel_8(keylogin = TRUE, managed_identity = TRUE,
datadisks = numeric(0), nsg = nsg_config(list(nsg_rule_allow_ssh)),
...)
rhel_8(keylogin = TRUE, managed_identity = TRUE, datadisks = numeric(0),
nsg = nsg_config(list(nsg_rule_allow_ssh)), ...)
centos_7.5(keylogin = TRUE, managed_identity = TRUE,
datadisks = numeric(0), nsg = nsg_config(list(nsg_rule_allow_ssh)),
...)
datadisks = numeric(0), nsg = nsg_config(list(nsg_rule_allow_ssh)), ...)
centos_7.6(keylogin = TRUE, managed_identity = TRUE,
datadisks = numeric(0), nsg = nsg_config(list(nsg_rule_allow_ssh)),
...)
datadisks = numeric(0), nsg = nsg_config(list(nsg_rule_allow_ssh)), ...)
debian_8_backports(keylogin = TRUE, managed_identity = TRUE,
datadisks = numeric(0), nsg = nsg_config(list(nsg_rule_allow_ssh)),
...)
datadisks = numeric(0), nsg = nsg_config(list(nsg_rule_allow_ssh)), ...)
debian_9_backports(keylogin = TRUE, managed_identity = TRUE,
datadisks = numeric(0), nsg = nsg_config(list(nsg_rule_allow_ssh)),
...)
datadisks = numeric(0), nsg = nsg_config(list(nsg_rule_allow_ssh)), ...)
}
\arguments{
\item{image}{For \code{vm_config}, the VM image to deploy. This should be an object of class \code{image_config}, created by the function of the same name.}
@ -95,7 +84,7 @@ debian_9_backports(keylogin = TRUE, managed_identity = TRUE,
\item{variables}{An optional named list of variables to add to the template.}
\item{...}{For the specific VM configurations, other customisation arguments to be passed to \code{vm_config}. For \code{vm_config}, named arguments that will be folded into the VM resource definition in the template.}
\item{...}{For the specific VM configurations, other customisation arguments to be passed to \code{vm_config}. For \code{vm_config}, named arguments that will be folded into the VM resource definition in the template. In particular use \verb{properties=list(*)} to set additional properties for the VM, beyond those set by the various configuration functions.}
\item{dsvm_disk_type}{The Ubuntu DSVM image comes with one additional datadisk that holds some installed tools. This argument sets what type of disk is used. Change this to "StandardSSD_LRS" or "Standard_LRS" if the VM size doesn't support premium storage.}
}
@ -108,7 +97,7 @@ VM configuration functions
\details{
These functions are for specifying the details of a new virtual machine deployment: the VM image and related options, along with the Azure resources that the VM may need. These include the datadisks, network security group, public IP address (if the VM is to be accessible from outside its subnet), virtual network, and network interface. \code{vm_config} is the base configuration function, and the others call it to create VMs with specific operating systems and other image details.
\itemize{
\item \code{ubuntu_dsvm}: Data Science Virtual Machine, based on Ubuntu 16.04
\item \code{ubuntu_dsvm}: Data Science Virtual Machine, based on Ubuntu 18.04
\item \code{windows_dsvm}: Data Science Virtual Machine, based on Windows Server 2016
\item \code{ubuntu_16.04}, \code{ubuntu_18.04}: Ubuntu LTS
\item \code{windows_2016}, \code{windows_2019}: Windows Server Datacenter edition
@ -119,33 +108,33 @@ These functions are for specifying the details of a new virtual machine deployme
Each resource can be specified in a number of ways:
\itemize{
\item To \emph{create} a new resource as part of the deployment, call the corresponding \code{*_config} function.
\item To \emph{create} a new resource as part of the deployment, call the corresponding \verb{*_config} function.
\item To use an \emph{existing} resource, supply either an \code{AzureRMR::az_resource} object (recommended) or a string containing the resource ID.
\item If the resource is not needed, specify it as NULL.
\item For the \code{other_resources} argument, supply a list of resources, each of which should be a list of resource fields (name, type, properties, sku, etc).
}
A VM configuration defines the following template variables by default, depending on its resources. If a particular resource is created, the corresponding \code{*Name}, \code{*Id} and \code{*Ref} variables will be available. If a resource is referred to but not created, the \code{*Name*} and \code{*Id} variables will be available. Other variables can be defined via the \code{variables} argument.
A VM configuration defines the following template variables by default, depending on its resources. If a particular resource is created, the corresponding \verb{*Name}, \verb{*Id} and \verb{*Ref} variables will be available. If a resource is referred to but not created, the \verb{*Name*} and \verb{*Id} variables will be available. Other variables can be defined via the \code{variables} argument.
\tabular{lll}{
\strong{Variable name} \tab \strong{Contents} \tab \strong{Description} \cr
\code{location} \tab \code{[resourceGroup().location]} \tab Region to deploy resources \cr
\code{vmId} \tab \code{[resourceId('Microsoft.Compute/virtualMachines', parameters('vmName'))]} \tab VM resource ID \cr
\code{vmRef} \tab \code{[concat('Microsoft.Compute/virtualMachines/', parameters('vmName'))]} \tab VM template reference \cr
\code{nsgName} \tab \code{[concat(parameters('vmName'), '-nsg')]} \tab Network security group resource name \cr
\code{nsgId} \tab \code{[resourceId('Microsoft.Network/networkSecurityGroups', variables('nsgName'))]} \tab NSG resource ID \cr
\code{nsgRef} \tab \code{[concat('Microsoft.Network/networkSecurityGroups/', variables('nsgName'))]} \tab NSG template reference \cr
\code{ipName} \tab \code{[concat(parameters('vmName'), '-ip')]} \tab Public IP address resource name \cr
\code{ipId} \tab \code{[resourceId('Microsoft.Network/publicIPAddresses', variables('ipName'))]} \tab IP resource ID \cr
\code{ipRef} \tab \code{[concat('Microsoft.Network/publicIPAddresses/', variables('ipName'))]} \tab IP template reference \cr
\code{vnetName} \tab \code{[concat(parameters('vmName'), '-vnet')]} \tab Virtual network resource name \cr
\code{vnetId} \tab \code{[resourceId('Microsoft.Network/virtualNetworks', variables('vnetName'))]} \tab Vnet resource ID \cr
\code{vnetRef} \tab \code{[concat('Microsoft.Network/virtualNetworks/', variables('vnetName'))]} \tab Vnet template reference \cr
\code{location} \tab \verb{[resourceGroup().location]} \tab Region to deploy resources \cr
\code{vmId} \tab \verb{[resourceId('Microsoft.Compute/virtualMachines', parameters('vmName'))]} \tab VM resource ID \cr
\code{vmRef} \tab \verb{[concat('Microsoft.Compute/virtualMachines/', parameters('vmName'))]} \tab VM template reference \cr
\code{nsgName} \tab \verb{[concat(parameters('vmName'), '-nsg')]} \tab Network security group resource name \cr
\code{nsgId} \tab \verb{[resourceId('Microsoft.Network/networkSecurityGroups', variables('nsgName'))]} \tab NSG resource ID \cr
\code{nsgRef} \tab \verb{[concat('Microsoft.Network/networkSecurityGroups/', variables('nsgName'))]} \tab NSG template reference \cr
\code{ipName} \tab \verb{[concat(parameters('vmName'), '-ip')]} \tab Public IP address resource name \cr
\code{ipId} \tab \verb{[resourceId('Microsoft.Network/publicIPAddresses', variables('ipName'))]} \tab IP resource ID \cr
\code{ipRef} \tab \verb{[concat('Microsoft.Network/publicIPAddresses/', variables('ipName'))]} \tab IP template reference \cr
\code{vnetName} \tab \verb{[concat(parameters('vmName'), '-vnet')]} \tab Virtual network resource name \cr
\code{vnetId} \tab \verb{[resourceId('Microsoft.Network/virtualNetworks', variables('vnetName'))]} \tab Vnet resource ID \cr
\code{vnetRef} \tab \verb{[concat('Microsoft.Network/virtualNetworks/', variables('vnetName'))]} \tab Vnet template reference \cr
\code{subnet} \tab \code{subnet} \tab Subnet name. Only defined if a Vnet was created or supplied as an \code{az_resource} object. \cr
\code{subnetId} \tab \code{[concat(variables('vnetId'), '/subnets/', variables('subnet'))]} \tab Subnet resource ID. Only defined if a Vnet was created or supplied as an \code{az_resource} object. \cr
\code{nicName} \tab \code{[concat(parameters('vmName'), '-nic')]} \tab Network interface resource name \cr
\code{nicId} \tab \code{[resourceId('Microsoft.Network/networkInterfaces', variables('nicName'))]} \tab NIC resource ID \cr
\code{nicRef} \tab \code{[concat('Microsoft.Network/networkInterfaces/', variables('nicName'))]} \tab NIC template reference
\code{subnetId} \tab \verb{[concat(variables('vnetId'), '/subnets/', variables('subnet'))]} \tab Subnet resource ID. Only defined if a Vnet was created or supplied as an \code{az_resource} object. \cr
\code{nicName} \tab \verb{[concat(parameters('vmName'), '-nic')]} \tab Network interface resource name \cr
\code{nicId} \tab \verb{[resourceId('Microsoft.Network/networkInterfaces', variables('nicName'))]} \tab NIC resource ID \cr
\code{nicRef} \tab \verb{[concat('Microsoft.Network/networkInterfaces/', variables('nicName'))]} \tab NIC template reference
}
Thus, for example, if you are creating a VM named "myvm" along with all its associated resources, the NSG is named "myvm-nsg", the public IP address is "myvm-ip", the virtual network is "myvm-vnet", and the network interface is "myvm-nic".
@ -162,8 +151,8 @@ windows_dsvm(datadisks=500, ip=NULL)
# RHEL VM exposing ports 80 (HTTP) and 443 (HTTPS)
rhel_8(nsg=nsg_config(nsg_rule_allow_http, nsg_rule_allow_https))
# exposing no ports externally
rhel_8(nsg=nsg_config(list()))
# exposing no ports externally, spot (low) priority
rhel_8(nsg=nsg_config(list()), properties=list(priority="spot"))
# deploying an extra resource: storage account
ubuntu_18.04(

Просмотреть файл

@ -9,8 +9,8 @@
user_config(username, sshkey = NULL, password = NULL)
datadisk_config(size, name = "datadisk", create = "empty",
type = c("StandardSSD_LRS", "Premium_LRS", "Standard_LRS",
"UltraSSD_LRS"), write_accelerator = FALSE)
type = c("StandardSSD_LRS", "Premium_LRS", "Standard_LRS", "UltraSSD_LRS"),
write_accelerator = FALSE)
image_config(publisher = NULL, offer = NULL, sku = NULL,
version = "latest", id = NULL)

Просмотреть файл

@ -16,14 +16,13 @@
\alias{debian_9_backports_ss}
\title{Virtual machine scaleset configuration functions}
\usage{
vmss_config(image, options = scaleset_options(),
datadisks = numeric(0), nsg = nsg_config(), vnet = vnet_config(),
load_balancer = lb_config(), load_balancer_address = ip_config(),
autoscaler = autoscaler_config(), other_resources = list(),
variables = list(), ...)
vmss_config(image, options = scaleset_options(), datadisks = numeric(0),
nsg = nsg_config(), vnet = vnet_config(), load_balancer = lb_config(),
load_balancer_address = ip_config(), autoscaler = autoscaler_config(),
other_resources = list(), variables = list(), ...)
ubuntu_dsvm_ss(datadisks = numeric(0),
dsvm_disk_type = c("Premium_LRS", "StandardSSD_LRS", "Standard_LRS"),
ubuntu_dsvm_ss(datadisks = numeric(0), dsvm_disk_type = c("Premium_LRS",
"StandardSSD_LRS", "Standard_LRS"),
nsg = nsg_config(list(nsg_rule_allow_ssh, nsg_rule_allow_jupyter,
nsg_rule_allow_rstudio)), load_balancer = lb_config(rules =
list(lb_rule_ssh, lb_rule_jupyter, lb_rule_rstudio), probes =
@ -120,7 +119,7 @@ These functions are for specifying the details of a new virtual machine scaleset
Each resource can be specified in a number of ways:
\itemize{
\item To \emph{create} a new resource as part of the deployment, call the corresponding \code{*_config} function.
\item To \emph{create} a new resource as part of the deployment, call the corresponding \verb{*_config} function.
\item To use an \emph{existing} resource, supply either an \code{AzureRMR::az_resource} object (recommended) or a string containing the resource ID.
\item If the resource is not needed, specify it as NULL.
\item For the \code{other_resources} argument, supply a list of resources, each of which should be a list of resource fields (name, type, properties, sku, etc).
@ -137,36 +136,36 @@ The \code{vmss_config} function is the base configuration function, and the othe
\item \code{debian_8_backports_ss}, \code{debian_9_backports_ss}: Debian with backports
}
A VM scaleset configuration defines the following template variables by default, depending on its resources. If a particular resource is created, the corresponding \code{*Name}, \code{*Id} and \code{*Ref} variables will be available. If a resource is referred to but not created, the \code{*Name*} and \code{*Id} variables will be available. Other variables can be defined via the \code{variables} argument.
A VM scaleset configuration defines the following template variables by default, depending on its resources. If a particular resource is created, the corresponding \verb{*Name}, \verb{*Id} and \verb{*Ref} variables will be available. If a resource is referred to but not created, the \verb{*Name*} and \verb{*Id} variables will be available. Other variables can be defined via the \code{variables} argument.
\tabular{lll}{
\strong{Variable name} \tab \strong{Contents} \tab \strong{Description} \cr
\code{location} \tab \code{[resourceGroup().location]} \tab Region to deploy resources \cr
\code{vmId} \tab \code{[resourceId('Microsoft.Compute/virtualMachines', parameters('vmName'))]} \tab VM scaleset resource ID \cr
\code{vmRef} \tab \code{[concat('Microsoft.Compute/virtualMachines/', parameters('vmName'))]} \tab Scaleset template reference \cr
\code{nsgName} \tab \code{[concat(parameters('vmName'), '-nsg')]} \tab Network security group resource name \cr
\code{nsgId} \tab \code{[resourceId('Microsoft.Network/networkSecurityGroups', variables('nsgName'))]} \tab NSG resource ID \cr
\code{nsgRef} \tab \code{[concat('Microsoft.Network/networkSecurityGroups/', variables('nsgName'))]} \tab NSG template reference \cr
\code{vnetName} \tab \code{[concat(parameters('vmName'), '-vnet')]} \tab Virtual network resource name \cr
\code{vnetId} \tab \code{[resourceId('Microsoft.Network/virtualNetworks', variables('vnetName'))]} \tab Vnet resource ID \cr
\code{vnetRef} \tab \code{[concat('Microsoft.Network/virtualNetworks/', variables('vnetName'))]} \tab Vnet template reference \cr
\code{location} \tab \verb{[resourceGroup().location]} \tab Region to deploy resources \cr
\code{vmId} \tab \verb{[resourceId('Microsoft.Compute/virtualMachines', parameters('vmName'))]} \tab VM scaleset resource ID \cr
\code{vmRef} \tab \verb{[concat('Microsoft.Compute/virtualMachines/', parameters('vmName'))]} \tab Scaleset template reference \cr
\code{nsgName} \tab \verb{[concat(parameters('vmName'), '-nsg')]} \tab Network security group resource name \cr
\code{nsgId} \tab \verb{[resourceId('Microsoft.Network/networkSecurityGroups', variables('nsgName'))]} \tab NSG resource ID \cr
\code{nsgRef} \tab \verb{[concat('Microsoft.Network/networkSecurityGroups/', variables('nsgName'))]} \tab NSG template reference \cr
\code{vnetName} \tab \verb{[concat(parameters('vmName'), '-vnet')]} \tab Virtual network resource name \cr
\code{vnetId} \tab \verb{[resourceId('Microsoft.Network/virtualNetworks', variables('vnetName'))]} \tab Vnet resource ID \cr
\code{vnetRef} \tab \verb{[concat('Microsoft.Network/virtualNetworks/', variables('vnetName'))]} \tab Vnet template reference \cr
\code{subnet} \tab \code{subnet} \tab Subnet name. Only defined if a Vnet was created or supplied as an \code{az_resource} object. \cr
\code{subnetId} \tab \code{[concat(variables('vnetId'), '/subnets/', variables('subnet'))]} \tab Subnet resource ID. Only defined if a Vnet was created or supplied as an \code{az_resource} object. \cr
\code{lbName} \tab \code{[concat(parameters('vmName'), '-lb')]} \tab Load balancer resource name \cr
\code{lbId} \tab \code{[resourceId('Microsoft.Network/loadBalancers', variables('lbName'))]} \tab Load balancer resource ID \cr
\code{lbRef} \tab \code{[concat('Microsoft.Network/loadBalancers/', variables('lbName'))]} \tab Load balancer template reference \cr
\code{subnetId} \tab \verb{[concat(variables('vnetId'), '/subnets/', variables('subnet'))]} \tab Subnet resource ID. Only defined if a Vnet was created or supplied as an \code{az_resource} object. \cr
\code{lbName} \tab \verb{[concat(parameters('vmName'), '-lb')]} \tab Load balancer resource name \cr
\code{lbId} \tab \verb{[resourceId('Microsoft.Network/loadBalancers', variables('lbName'))]} \tab Load balancer resource ID \cr
\code{lbRef} \tab \verb{[concat('Microsoft.Network/loadBalancers/', variables('lbName'))]} \tab Load balancer template reference \cr
\code{lbFrontendName} \tab \code{frontend} \tab Load balancer frontend IP configuration name. Only defined if a load balancer was created or supplied as an \code{az_resource} object. \cr
\code{lbBackendName} \tab \code{backend} \tab Load balancer backend address pool name. Only defined if a load balancer was created or supplied as an \code{az_resource} object. \cr
\code{lbFrontendId} \tab \code{[concat(variables('lbId'), '/frontendIPConfigurations/', variables('lbFrontendName'))]} \tab Load balancer frontend resource ID. Only defined if a load balancer was created or supplied as an \code{az_resource} object. \cr
\code{lbBackendId} \tab \code{[concat(variables('lbId'), '/backendAddressPools/', variables('lbBackendName'))]} \tab Load balancer backend resource ID. Only defined if a load balancer was created or supplied as an \code{az_resource} object. \cr
\code{ipName} \tab \code{[concat(parameters('vmName'), '-ip')]} \tab Public IP address resource name \cr
\code{ipId} \tab \code{[resourceId('Microsoft.Network/publicIPAddresses', variables('ipName'))]} \tab IP resource ID \cr
\code{ipRef} \tab \code{[concat('Microsoft.Network/publicIPAddresses/', variables('ipName'))]} \tab IP template reference \cr
\code{asName} \tab \code{[concat(parameters('vmName'), '-as')]} \tab Autoscaler resource name \cr
\code{asId} \tab \code{[resourceId('Microsoft.Insights/autoscaleSettings', variables('asName'))]} \tab Autoscaler resource ID \cr
\code{asRef} \tab \code{[concat('Microsoft.Insights/autoscaleSettings/', variables('asName'))]} \tab Autoscaler template reference \cr
\code{asMaxCapacity} \tab \code{[mul(int(parameters('instanceCount')), 10)]} \tab Maximum capacity for the autoscaler. Only defined if an autoscaler was created. \cr
\code{asScaleValue} \tab \code{[max(div(int(parameters('instanceCount')), 5), 1)]} \tab Default capacity for the autoscaler. Only defined if an autoscaler was created.
\code{lbFrontendId} \tab \verb{[concat(variables('lbId'), '/frontendIPConfigurations/', variables('lbFrontendName'))]} \tab Load balancer frontend resource ID. Only defined if a load balancer was created or supplied as an \code{az_resource} object. \cr
\code{lbBackendId} \tab \verb{[concat(variables('lbId'), '/backendAddressPools/', variables('lbBackendName'))]} \tab Load balancer backend resource ID. Only defined if a load balancer was created or supplied as an \code{az_resource} object. \cr
\code{ipName} \tab \verb{[concat(parameters('vmName'), '-ip')]} \tab Public IP address resource name \cr
\code{ipId} \tab \verb{[resourceId('Microsoft.Network/publicIPAddresses', variables('ipName'))]} \tab IP resource ID \cr
\code{ipRef} \tab \verb{[concat('Microsoft.Network/publicIPAddresses/', variables('ipName'))]} \tab IP template reference \cr
\code{asName} \tab \verb{[concat(parameters('vmName'), '-as')]} \tab Autoscaler resource name \cr
\code{asId} \tab \verb{[resourceId('Microsoft.Insights/autoscaleSettings', variables('asName'))]} \tab Autoscaler resource ID \cr
\code{asRef} \tab \verb{[concat('Microsoft.Insights/autoscaleSettings/', variables('asName'))]} \tab Autoscaler template reference \cr
\code{asMaxCapacity} \tab \verb{[mul(int(parameters('instanceCount')), 10)]} \tab Maximum capacity for the autoscaler. Only defined if an autoscaler was created. \cr
\code{asScaleValue} \tab \verb{[max(div(int(parameters('instanceCount')), 5), 1)]} \tab Default capacity for the autoscaler. Only defined if an autoscaler was created.
}
Thus, for example, if you are creating a VM scaleset named "myvmss" along with all its associated resources, the NSG is named "myvmss-nsg", the virtual network is "myvmss-vnet", the load balancer is "myvmss-lb", the public IP address is "myvmss-ip", and the autoscaler is "myvm-as".

Просмотреть файл

@ -5,8 +5,8 @@
\alias{subnet_config}
\title{Virtual network configuration}
\usage{
vnet_config(address_space = "10.0.0.0/16",
subnets = list(subnet_config()), ...)
vnet_config(address_space = "10.0.0.0/16", subnets = list(subnet_config()),
...)
subnet_config(name = "subnet", addresses = "10.0.0.0/16",
nsg = "[variables('nsgId')]", ...)

Просмотреть файл

@ -18,6 +18,13 @@ rg <- AzureRMR::az_rm$
get_subscription(subscription)$
create_resource_group(rgname, location)
test_that("Spot VM works",
{
vmname <- paste0(sample(letters, 10, TRUE), collapse="")
vm <- rg$create_vm(vmname, user, size, properties=list(priority="spot"))
expect_is(vm, "az_vm_template")
})
test_that("Custom vnet works",
{
vmname <- paste0(sample(letters, 10, TRUE), collapse="")