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: implicit nic creation + public ip support #2056

Merged
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
29 changes: 20 additions & 9 deletions .github/workflows/azure-e2e-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -206,28 +206,39 @@ jobs:
with:
go-version: ${{ env.GO_VERSION }}

- name: Install cidr calculator
run: |
sudo apt-get update
sudo apt-get install -y sipcalc

- name: Set Provisioner Environment Variables
run: |
echo "TEST_PROVISION_FILE=${{ format(env.TEST_PROVISION_PATH_TEMPLATE, matrix.parameters.id) }}" >> "$GITHUB_ENV"
echo "CLUSTER_NAME=${{ format(env.CLUSTER_NAME_TEMPLATE, matrix.parameters.id) }}" >> "$GITHUB_ENV"

- name: Restore the configuration created before
uses: actions/download-artifact@v3
with:
name: e2e-configuration

- uses: azure/login@v1
name: 'Az CLI login'
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}

- name: Restore the configuration created before
uses: actions/download-artifact@v3
with:
name: e2e-configuration

- name: Add AKS Cluster Subnet ID to test provision file
- name: Create peerpod subnet
run: |
NODE_RESOURCE_GROUP="$(az aks show -g ${{ secrets.AZURE_RESOURCE_GROUP }} -n "$CLUSTER_NAME" --query nodeResourceGroup -o tsv)"
SUBNET_ID="$(az network vnet list -g "$NODE_RESOURCE_GROUP" --query '[0].subnets[0].id' -o tsv)"
test -n "$SUBNET_ID"
NODE_RG="$(az aks show -g ${{ secrets.AZURE_RESOURCE_GROUP }} -n "$CLUSTER_NAME" --query nodeResourceGroup -o tsv)"
VNET_NAME="$(az network vnet list -g "$NODE_RG" --query '[].name' -o tsv)"
NODE_CIDR="$(az network vnet show -n "$VNET_NAME" -g "$NODE_RG" --query "subnets[?name == 'aks-subnet'].addressPrefix" -o tsv)"
MASK="${NODE_CIDR#*/}"
PEERPOD_CIDR="$(sipcalc "$NODE_CIDR" -n 2 | grep ^Network | grep -v current | cut -d' ' -f2)/${MASK}"
az network public-ip create -g "$NODE_RG" -n peerpod
az network nat gateway create -g "$NODE_RG" -l ${{ secrets.AZURE_REGION }} --public-ip-addresses peerpod -n peerpod
az network vnet subnet create -g "$NODE_RG" --vnet-name "$VNET_NAME" --nat-gateway peerpod --address-prefixes "$PEERPOD_CIDR" -n peerpod
SUBNET_ID="$(az network vnet subnet show -g "$NODE_RG" --vnet-name "$VNET_NAME" -n peerpod --query id -o tsv)"
echo "AZURE_SUBNET_ID=\"${SUBNET_ID}\"" >> "$TEST_PROVISION_FILE"

- name: Extract kbs reference
Expand Down
1 change: 1 addition & 0 deletions src/cloud-api-adaptor/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ azure() {
[[ "${AZURE_INSTANCE_SIZES}" ]] && optionals+="-instance-sizes ${AZURE_INSTANCE_SIZES} "
[[ "${TAGS}" ]] && optionals+="-tags ${TAGS} " # Custom tags applied to pod vm
[[ "${ENABLE_SECURE_BOOT}" == "true" ]] && optionals+="-enable-secure-boot "
[[ "${USE_PUBLIC_IP}" == "true" ]] && optionals+="-use-public-ip "

set -x
exec cloud-api-adaptor azure \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ configMapGenerator:
#- AZURE_INSTANCE_SIZES="" # comma separated
#- TAGS="" # Uncomment and add key1=value1,key2=value2 etc if you want to use specific tags for podvm
#- FORWARDER_PORT="" # Uncomment and set if you want to use a specific port for agent-protocol-forwarder. Defaults to 15150
#- USE_PUBLIC_IP="true" # Uncomment if you want to use public ip for podvm
#- PEERPODS_LIMIT_PER_NODE="10" # Max number of peer pods that can be created per node. Default is 10
##TLS_SETTINGS
#- CACERT_FILE="/etc/certificates/ca.crt" # for TLS
Expand Down
3 changes: 2 additions & 1 deletion src/cloud-providers/azure/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,12 @@ func (_ *Manager) ParseCmd(flags *flag.FlagSet) {
flags.StringVar(&azurecfg.SSHKeyPath, "ssh-key-path", "$HOME/.ssh/id_rsa.pub", "Path to SSH public key")
flags.StringVar(&azurecfg.SSHUserName, "ssh-username", "peerpod", "SSH User Name")
flags.BoolVar(&azurecfg.DisableCVM, "disable-cvm", false, "Use non-CVMs for peer pods")
// Add a List parameter to indicate differet type of instance sizes to be used for the Pod VMs
// Add a List parameter to indicate different types of instance sizes to be used for the Pod VMs
flags.Var(&azurecfg.InstanceSizes, "instance-sizes", "Instance sizes to be used for the Pod VMs, comma separated")
// Add a key value list parameter to indicate custom tags to be used for the Pod VMs
flags.Var(&azurecfg.Tags, "tags", "Custom tags (key=value pairs) to be used for the Pod VMs, comma separated")
flags.BoolVar(&azurecfg.EnableSecureBoot, "enable-secure-boot", false, "Enable secure boot for the VMs")
flags.BoolVar(&azurecfg.UsePublicIP, "use-public-ip", false, "Assign public IP to the PoD VM and use to connect to kata-agent")
}

func (_ *Manager) LoadEnv() {
Expand Down
Loading
Loading