Skip to content

Commit c36f69f

Browse files
committed
ci/helm: using provisioning code for azure
same as previous commit Signed-off-by: Beraldo Leal <[email protected]>
1 parent 56f94e2 commit c36f69f

File tree

3 files changed

+90
-4
lines changed

3 files changed

+90
-4
lines changed

.github/workflows/azure-e2e-test.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@ on:
1919
podvm-image-id:
2020
type: string
2121
description: prebuilt podvm image
22+
install_method:
23+
default: 'kustomize'
24+
description: Installation method. Either kustomize or helm.
25+
required: false
26+
type: string
2227
secrets:
2328
AZURE_CLIENT_ID:
2429
required: true
@@ -32,6 +37,11 @@ on:
3237
podvm-image-id:
3338
type: string
3439
description: prebuilt podvm image
40+
install_method:
41+
default: 'kustomize'
42+
description: Installation method. Either kustomize or helm.
43+
required: false
44+
type: string
3545

3646
jobs:
3747
build-caa-container-image:
@@ -211,11 +221,24 @@ jobs:
211221
sudo apt-get install -y sipcalc
212222
213223
- name: Install kustomize
224+
if: ${{ inputs.install_method == 'kustomize' }}
214225
run: |
215226
command -v kustomize >/dev/null || \
216227
curl -s "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh" | \
217228
sudo bash -s /usr/local/bin
218229
230+
- name: Install Helm
231+
if: ${{ inputs.install_method == 'helm' }}
232+
run: |
233+
HELM_VERSION="$(yq -e '.tools.helm.version' versions.yaml)"
234+
HELM_CHECKSUM="$(yq -e '.tools.helm.sha256' versions.yaml)"
235+
curl -fsSL -o helm.tar.gz "https://get.helm.sh/helm-${HELM_VERSION}-linux-amd64.tar.gz"
236+
echo "${HELM_CHECKSUM} helm.tar.gz" | sha256sum --check --strict
237+
tar -xzf helm.tar.gz
238+
sudo mv linux-amd64/helm /usr/local/bin/helm
239+
rm -rf helm.tar.gz linux-amd64
240+
helm version
241+
219242
- name: Restore the configuration created before
220243
uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0
221244
with:
@@ -246,6 +269,48 @@ jobs:
246269
AZURE_SUBNET_ID="$subnet_id"
247270
EOF
248271
272+
# Export for helm values step
273+
echo "AZURE_SUBNET_ID=$subnet_id" >> "$GITHUB_ENV"
274+
275+
- name: Create helm values file
276+
if: ${{ inputs.install_method == 'helm' }}
277+
env:
278+
CAA_IMAGE: "${{ needs.build-caa-container-image.outputs.caa-image }}"
279+
AZURE_IMAGE_ID: "${{ inputs.podvm-image-id }}"
280+
AZURE_INSTANCE_SIZE: "${{ matrix.parameters.machine_type }}"
281+
AZURE_SUBSCRIPTION_ID: "${{ secrets.AZURE_SUBSCRIPTION_ID }}"
282+
AZURE_CLIENT_ID: "${{ secrets.AZURE_CLIENT_ID }}"
283+
run: |
284+
CAA_IMAGE_TAG="${CAA_IMAGE##*:}"
285+
CAA_IMAGE_NAME="${CAA_IMAGE%:*}"
286+
287+
cat <<EOF > helm-values.yaml
288+
image:
289+
name: "${CAA_IMAGE_NAME}"
290+
tag: "${CAA_IMAGE_TAG}"
291+
providerConfigs:
292+
azure:
293+
AZURE_SUBSCRIPTION_ID: "${AZURE_SUBSCRIPTION_ID}"
294+
AZURE_REGION: "${LOCATION}"
295+
AZURE_RESOURCE_GROUP: "${RG_NAME}"
296+
AZURE_IMAGE_ID: "${AZURE_IMAGE_ID}"
297+
AZURE_INSTANCE_SIZE: "${AZURE_INSTANCE_SIZE}"
298+
AZURE_SUBNET_ID: "${AZURE_SUBNET_ID}"
299+
providerSecrets:
300+
azure:
301+
AZURE_CLIENT_ID: "${AZURE_CLIENT_ID}"
302+
EOF
303+
304+
echo "HELM_VALUES_FILES=$PWD/install/charts/peerpods/providers/azure.yaml,$PWD/helm-values.yaml" >> "$GITHUB_ENV"
305+
306+
# For debugging (without secrets)
307+
echo "::group::helm-values.yaml (structure only)"
308+
echo "image.name: ${CAA_IMAGE_NAME}"
309+
echo "image.tag: ${CAA_IMAGE_TAG}"
310+
echo "providerConfigs.azure: (subscription, region, resource group, image, instance size, subnet)"
311+
echo "providerSecrets.azure: (client id)"
312+
echo "::endgroup::"
313+
249314
- name: Checkout KBS Repository
250315
run: test/utils/checkout_kbs.sh
251316

@@ -254,6 +319,7 @@ jobs:
254319
env:
255320
TEST_PROVISION: "no"
256321
DEPLOY_KBS: "yes"
322+
INSTALL_METHOD: "${{ inputs.install_method }}"
257323
CUSTOM_PCCS_URL: "https://global.acccache.azure.net/sgx/certification/v4"
258324
CLUSTER_NAME: "${{ format(env.CLUSTER_NAME_TEMPLATE, matrix.parameters.id) }}"
259325
run: |

src/cloud-api-adaptor/test/provisioner/azure/provision_common.go

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -367,8 +367,18 @@ func getPropertiesImpl() map[string]string {
367367
}
368368

369369
func (p *AzureCloudProvisioner) GetProvisionValues() map[string]interface{} {
370-
// TODO: implement properly
371-
return nil
370+
// SubnetID is discovered from the AKS VNET during CreateCluster.
371+
if AzureProps.SubnetID == "" {
372+
return nil
373+
}
374+
375+
return map[string]interface{}{
376+
"providerConfigs": map[string]interface{}{
377+
"azure": map[string]interface{}{
378+
"AZURE_SUBNET_ID": AzureProps.SubnetID,
379+
},
380+
},
381+
}
372382
}
373383

374384
func (p *AzureCloudProvisioner) GetProperties(ctx context.Context, cfg *envconf.Config) map[string]string {

src/cloud-api-adaptor/test/provisioner/azure/provision_self_mgr.go

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,18 @@ func (p *AzureSelfManagedClusterProvisioner) UploadPodvm(imagePath string, ctx c
3434
}
3535

3636
func (p *AzureSelfManagedClusterProvisioner) GetProvisionValues() map[string]interface{} {
37-
// TODO: implement properly
38-
return nil
37+
// SubnetID is discovered from the AKS VNET during CreateCluster.
38+
if AzureProps.SubnetID == "" {
39+
return nil
40+
}
41+
42+
return map[string]interface{}{
43+
"providerConfigs": map[string]interface{}{
44+
"azure": map[string]interface{}{
45+
"AZURE_SUBNET_ID": AzureProps.SubnetID,
46+
},
47+
},
48+
}
3949
}
4050

4151
func (p *AzureSelfManagedClusterProvisioner) GetProperties(ctx context.Context, cfg *envconf.Config) map[string]string {

0 commit comments

Comments
 (0)