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

ci: Update helm chart and e2e #433

Merged
merged 1 commit into from
Jan 26, 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
4 changes: 3 additions & 1 deletion .github/workflows/e2e-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@ concurrency:
cancel-in-progress: true

on:
workflow_dispatch:
pull_request_target:
branches:
- master
- release-**
types: [opened]
paths:
- '.github/workflows/chart.yml'
- 'charts/**'
Expand All @@ -24,6 +25,7 @@ env:

jobs:
export-registry:
if: contains(github.event.pull_request.title, 'update manifest and helm charts') || (contains(github.event.pull_request.title, 'helm'))
runs-on: ubuntu-20.04
outputs:
registry: ${{ steps.export.outputs.registry }}
Expand Down
127 changes: 89 additions & 38 deletions charts/virtual-kubelet/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,50 +19,99 @@ spec:
labels:
app: {{ template "vk.fullname" . }}
spec:
{{- if .Values.useVKVersion2}}
{{- if .Values.useVKVersion2 }}
initContainers:
- name: init-validation
image: "{{ .Values.initImage.repository }}/{{ .Values.initImage.name }}:{{ .Values.initImage.tag }}"
imagePullPolicy: {{ .Values.initImage.pullPolicy }}
env:
- name: VIRTUALNODE_USER_IDENTITY_CLIENTID
value: {{ .managedIdentityID }}
- name: AZURE_CLIENT_ID
value: {{ .clientId }}
- name: AZURE_CLIENT_SECRET
valueFrom:
secretKeyRef:
name: {{ template "vk.fullname" $ }}
key: clientSecret
- name: AKS_CREDENTIAL_LOCATION
value: /etc/aks/azure.json

{{- if .Values.providers.azure.vnet.enabled }}
- name: ACI_SUBNET_NAME
value: {{ required "subnetName is required" .vnet.subnetName }}
- name: KUBE_DNS_IP
value:{{ .vnet.kubeDnsIp }}
{{- end }}
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: USE_VK_VERSION_2
value: "true"
- name: USE_VK_VERSION_2
value: "true"
- name: KUBELET_PORT
value: "10250"
- name: APISERVER_CERT_LOCATION
value: /etc/virtual-kubelet/cert.pem
- name: APISERVER_KEY_LOCATION
value: /etc/virtual-kubelet/key.pem
- name: VKUBELET_POD_IP
valueFrom:
fieldRef:
fieldPath: status.podIP
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
{{- with .Values.providers.azure }}
{{- if .managedIdentityID }}
- name: VIRTUALNODE_USER_IDENTITY_CLIENTID
value: {{ .managedIdentityID }}
{{- end }}
{{- if .targetAKS }}
- name: AKS_CREDENTIAL_LOCATION
value: /etc/aks/azure.json
- name: AZURE_TENANT_ID
value: {{ .tenantId }}
- name: AZURE_SUBSCRIPTION_ID
value: {{ .subscriptionId }}
- name: AZURE_CLIENT_ID
value: {{ .clientId }}
- name: AZURE_CLIENT_SECRET
valueFrom:
secretKeyRef:
name: {{ template "vk.fullname" $ }}
key: clientSecret
- name: ACI_RESOURCE_GROUP
value: {{ .aciResourceGroup }}
- name: ACI_REGION
value: {{ .aciRegion }}
- name: ACI_EXTRA_USER_AGENT
value: {{ printf "helm-chart/aks/%s/%s" $.Chart.Name $.Chart.Version }}
{{- else }}
- name: AZURE_AUTH_LOCATION
value: /etc/virtual-kubelet/credentials.json
- name: ACI_RESOURCE_GROUP
value: {{ required "aciResourceGroup is required" .aciResourceGroup }}
- name: ACI_REGION
value: {{ required "aciRegion is required" .aciRegion }}
- name: ACI_EXTRA_USER_AGENT
value: {{ printf "helm-chart/other/%s/%s" $.Chart.Name $.Chart.Version }}
{{- end }}
{{- if .vnet.enabled }}
- name: ACI_VNET_SUBSCRIPTION_ID
value: {{ .vnet.vnetSubscriptionID}}
- name: ACI_VNET_RESOURCE_GROUP
value: {{ .vnet.vnetResourceGroup}}
- name: ACI_VNET_NAME
value: {{ .vnet.vnetName}}
- name: ACI_SUBNET_NAME
value: {{ required "subnetName is required" .vnet.subnetName }}
- name: ACI_SUBNET_CIDR
value: {{ .vnet.subnetCidr }}
- name: MASTER_URI
value: {{ required "masterUri is required" .masterUri | quote }}
- name: CLUSTER_CIDR
value: {{ .vnet.clusterCidr }}
- name: KUBE_DNS_IP
value: {{ .vnet.kubeDnsIp }}
{{- else }}
- name: MASTER_URI
value: {{ .masterUri | quote }}
{{- end }}
{{- end }}
volumeMounts:
- name: credentials
mountPath: "/etc/virtual-kubelet"
- name: certificates
mountPath: /etc/kubernetes/certs
readOnly: true
{{- if .Values.providers.azure.targetAKS }}
- name: aks-credential
mountPath: "/etc/aks/azure.json"
{{- end }}
- name: credentials
mountPath: "/etc/virtual-kubelet"
- name: certificates
mountPath: /etc/kubernetes/certs
readOnly: true
{{- if .Values.providers.azure.targetAKS }}
- name: aks-credential
mountPath: "/etc/aks/azure.json"
{{- end }}
{{- end }}
containers:
- name: {{ template "vk.fullname" . }}
Expand Down Expand Up @@ -148,10 +197,12 @@ spec:
- name: MASTER_URI
value: {{ .masterUri | quote }}
{{- end }}
{{- if .enableRealTimeMetrics }}
- name: ENABLE_REAL_TIME_METRICS
value: "true"
{{- end }}
{{- end }}
{{- end }}
{{- if .Values.useVKVersion2 }}
- name: USE_VK_VERSION_2
value: "true"
Expand Down
5 changes: 3 additions & 2 deletions charts/virtual-kubelet/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ image:

initImage:
repository: mcr.microsoft.com
name: init-validation
tag: 1.4.10
name: oss/virtual-kubelet/init-validation
tag: 0.1.0
pullPolicy: Always

namespace: vk-azure-aci
Expand Down Expand Up @@ -38,6 +38,7 @@ trace:

providers:
azure:
enableRealTimeMetrics: true
## Set to true if deploying to Azure Kubernetes Service (AKS), otherwise false
targetAKS: true
clientId:
Expand Down
9 changes: 4 additions & 5 deletions hack/e2e/aks-addon.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ fi
: "${WIN_CHART_NAME:=vk-aci-test-win-aks}"
: "${TEST_NODE_NAME:=vk-aci-test-aks}"
: "${TEST_WINDOWS_NODE_NAME:=vk-aci-test-win-aks}"
: "${INIT_IMG_REPO:=oss/virtual-kubelet/init-validation}"
: "${IMG_REPO:=oss/virtual-kubelet/virtual-kubelet}"
: "${IMG_URL:=mcr.microsoft.com}"
: "${INIT_IMG_TAG:=0.1.0}"
Expand Down Expand Up @@ -81,10 +82,8 @@ if [ "$E2E_TARGET" = "pr" ]; then

az acr login --name "$ACR_NAME"
IMG_URL=$ACR_NAME.azurecr.io
IMG_REPO="virtual-kubelet"
INIT_IMG_REPO="init-validation"
OUTPUT_TYPE=type=registry IMG_TAG=$IMG_TAG IMAGE=$ACR_NAME.azurecr.io/$IMG_REPO make docker-build-image
OUTPUT_TYPE=type=registry INIT_IMG_TAG=$INIT_IMG_TAG INIT_IMAGE=$ACR_NAME.azurecr.io/$INIT_IMG_REPO make docker-build-init-image
OUTPUT_TYPE=type=registry IMG_TAG=$IMG_TAG IMAGE=$IMG_URL/$IMG_REPO make docker-build-image
OUTPUT_TYPE=type=registry INIT_IMG_TAG=$INIT_IMG_TAG INIT_IMAGE=$IMG_URL/$INIT_IMG_REPO make docker-build-init-image

fi

Expand Down Expand Up @@ -159,7 +158,7 @@ kubectl create configmap test-vars -n kube-system \
--from-literal=cluster_subnet_cidr="$CLUSTER_SUBNET_CIDR" \
--from-literal=aci_subnet_name="$ACI_SUBNET_NAME"

sed -e "s|TEST_INIT_IMAGE|$ACR_NAME.azurecr.io/$INIT_IMG_REPO:$INIT_IMG_TAG|g" -e "s|TEST_IMAGE|$ACR_NAME.azurecr.io/$IMG_REPO:$IMG_TAG|g" deploy/deployment.yaml | kubectl apply -n kube-system -f -
sed -e "s|TEST_INIT_IMAGE|$IMG_URL/$INIT_IMG_REPO:$INIT_IMG_TAG|g" -e "s|TEST_IMAGE|$IMG_URL/$IMG_REPO:$IMG_TAG|g" deploy/deployment.yaml | kubectl apply -n kube-system -f -

kubectl wait --for=condition=available deploy "virtual-kubelet-azure-aci" -n kube-system --timeout=300s

Expand Down
7 changes: 3 additions & 4 deletions hack/e2e/aks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ fi
: "${WIN_CHART_NAME:=vk-aci-test-win-aks}"
: "${TEST_NODE_NAME:=vk-aci-test-aks}"
: "${TEST_WINDOWS_NODE_NAME:=vk-aci-test-win-aks}"
: "${INIT_IMG_REPO:=oss/virtual-kubelet/init-validation}"
: "${IMG_REPO:=oss/virtual-kubelet/virtual-kubelet}"
: "${IMG_URL:=mcr.microsoft.com}"
: "${INIT_IMG_TAG:=0.1.0}"
Expand Down Expand Up @@ -81,10 +82,8 @@ if [ "$E2E_TARGET" = "pr" ]; then

az acr login --name "$ACR_NAME"
IMG_URL=$ACR_NAME.azurecr.io
IMG_REPO="virtual-kubelet"
INIT_IMG_REPO="init-validation"
OUTPUT_TYPE=type=registry IMG_TAG=$IMG_TAG IMAGE=$ACR_NAME.azurecr.io/$IMG_REPO make docker-build-image
OUTPUT_TYPE=type=registry INIT_IMG_TAG=$INIT_IMG_TAG INIT_IMAGE=$ACR_NAME.azurecr.io/$INIT_IMG_REPO make docker-build-init-image
OUTPUT_TYPE=type=registry IMG_TAG=$IMG_TAG IMAGE=$IMG_URL/$IMG_REPO make docker-build-image
OUTPUT_TYPE=type=registry INIT_IMG_TAG=$INIT_IMG_TAG INIT_IMAGE=$IMG_URL/$INIT_IMG_REPO make docker-build-init-image

fi

Expand Down