Skip to content

Commit

Permalink
Add AzureClusterIdentity to private cluster and self-hosted tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Cecile Robert-Michon committed Aug 5, 2021
1 parent 23927f9 commit 5521768
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 63 deletions.
7 changes: 0 additions & 7 deletions scripts/ci-e2e.sh
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,6 @@ defaultTag=$(date -u '+%Y%m%d%H%M%S')
export TAG="${defaultTag:-dev}"
export GINKGO_NODES=3

# TODO: remove these variables once Calico 3.20 fixes https://github.com/kubernetes-sigs/cluster-api-provider-azure/issues/1448
AZURE_SUBSCRIPTION_ID_B64="$(echo -n "$AZURE_SUBSCRIPTION_ID" | base64 | tr -d '\n')"
AZURE_TENANT_ID_B64="$(echo -n "$AZURE_TENANT_ID" | base64 | tr -d '\n')"
AZURE_CLIENT_ID_B64="$(echo -n "$AZURE_CLIENT_ID" | base64 | tr -d '\n')"
AZURE_CLIENT_SECRET_B64="$(echo -n "$AZURE_CLIENT_SECRET" | base64 | tr -d '\n')"
export AZURE_SUBSCRIPTION_ID_B64 AZURE_TENANT_ID_B64 AZURE_CLIENT_ID_B64 AZURE_CLIENT_SECRET_B64

export AZURE_LOCATION="${AZURE_LOCATION:-$(get_random_region)}"
export AZURE_CONTROL_PLANE_MACHINE_TYPE="${AZURE_CONTROL_PLANE_MACHINE_TYPE:-"Standard_D2s_v3"}"
export AZURE_NODE_MACHINE_TYPE="${AZURE_NODE_MACHINE_TYPE:-"Standard_D2s_v3"}"
Expand Down
20 changes: 20 additions & 0 deletions templates/cluster-template-private.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ metadata:
spec:
bastionSpec:
azureBastion: {}
identityRef:
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha4
kind: AzureClusterIdentity
name: ${CLUSTER_IDENTITY_NAME}
location: ${AZURE_LOCATION}
networkSpec:
apiServerLB:
Expand Down Expand Up @@ -209,3 +213,19 @@ spec:
cloud-config: /etc/kubernetes/azure.json
cloud-provider: azure
name: '{{ ds.meta_data["local_hostname"] }}'
---
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha4
kind: AzureClusterIdentity
metadata:
labels:
clusterctl.cluster.x-k8s.io/move-hierarchy: "true"
name: ${CLUSTER_IDENTITY_NAME}
namespace: default
spec:
allowedNamespaces: {}
clientID: ${AZURE_CLIENT_ID}
clientSecret:
name: ${AZURE_CLUSTER_IDENTITY_SECRET_NAME}
namespace: ${AZURE_CLUSTER_IDENTITY_SECRET_NAMESPACE}
tenantID: ${AZURE_TENANT_ID}
type: ServicePrincipal
3 changes: 3 additions & 0 deletions templates/flavors/private/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@ namespace: default
resources:
- ../base
- ../default/machine-deployment.yaml
- ../../azure-cluster-identity

patchesStrategicMerge:
- ../../azure-cluster-identity/azurecluster-identity-ref.yaml
- patches/private-lb.yaml
- patches/apiserver-host-dns.yaml
- patches/azure-bastion.yaml
Expand Down
14 changes: 0 additions & 14 deletions templates/test/ci/prow-identity-from-env/cni-resource-set.yaml

This file was deleted.

23 changes: 0 additions & 23 deletions templates/test/ci/prow-identity-from-env/kustomization.yaml

This file was deleted.

15 changes: 0 additions & 15 deletions templates/test/ci/prow-identity-from-env/mhc.yaml

This file was deleted.

2 changes: 1 addition & 1 deletion test/e2e/azure_selfhosted.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ func SelfHostedSpec(ctx context.Context, inputGetter func() SelfHostedSpecInput)
ClusterctlConfigPath: input.ClusterctlConfigPath,
KubeconfigPath: input.BootstrapClusterProxy.GetKubeconfigPath(),
InfrastructureProvider: clusterctl.DefaultInfrastructureProvider,
Flavor: "identity-from-env",
Flavor: clusterctl.DefaultFlavor,
Namespace: namespace.Name,
ClusterName: fmt.Sprintf("%s-%s", specName, util.RandomString(6)),
KubernetesVersion: input.E2EConfig.GetVariable(capi_e2e.KubernetesVersion),
Expand Down
4 changes: 1 addition & 3 deletions test/e2e/config/azure-dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,7 @@ providers:
- sourcePath: "${PWD}/templates/test/ci/cluster-template-prow-aks-multi-tenancy.yaml"
targetName: "cluster-template-aks-multi-tenancy.yaml"
- sourcePath: "${PWD}/templates/test/ci/cluster-template-prow-custom-vnet.yaml"
targetName: "cluster-template-custom-vnet.yaml"
- sourcePath: "${PWD}/templates/test/ci/cluster-template-prow-identity-from-env.yaml"
targetName: "cluster-template-identity-from-env.yaml"
targetName: "cluster-template-custom-vnet.yaml"

variables:
KUBERNETES_VERSION: "${KUBERNETES_VERSION:-v1.21.2}"
Expand Down

0 comments on commit 5521768

Please sign in to comment.