This repository creates an AKS cluster with tekton pipelines to deploy a sample repository.
The pipeline can be triggered using a kubectl command or using an HTTP trigger.
az login
terraform init
terraform apply --var=subscription_id="" -auto-approve
To access the dashboard, run:
kubectl --kubeconfig kubeconfig -n tekton-pipelines port-forward svc/tekton-dashboard 9097:9097
Then, browse http://localhost:9097/.
REPO_URL="https://github.com/arnaud-tincelin/sampleapp.git"
NAME="ati01"
SUBSCRIPTION_ID=""
kubectl --kubeconfig kubeconfig create -f <(
cat <<EOF
apiVersion: tekton.dev/v1beta1
kind: PipelineRun
metadata:
generateName: kubectl-run-
namespace: tekton-pipelines
spec:
serviceAccountName: tekton-workload-identity
pipelineRef:
name: deploy-func-app
podTemplate:
securityContext:
fsGroup: 65532
workspaces:
- name: shared-data
volumeClaimTemplate:
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
params:
- name: repo-url
value: ${REPO_URL}
- name: name
value: ${NAME}
- name: subscription_id
value: ${SUBSCRIPTION_ID}
EOF
)
REPO_URL="https://github.com/arnaud-tincelin/sampleapp.git"
NAME="ati02"
SUBSCRIPTION_ID=""
CLUSTER_ADDRESS="http://$(kubectl --kubeconfig kubeconfig -n tekton-pipelines get ing func-app-listener-ingress -o=jsonpath='{.status.loadBalancer.ingress[0].ip}')"
data=$(
cat <<EOF
{
"name": "${NAME}",
"repo_url": "${REPO_URL}",
"subscription_id": "${SUBSCRIPTION_ID}"
}
EOF
)
curl -v \
-H 'content-Type: application/json' \
-d "${data}" \
${CLUSTER_ADDRESS}