Skip to content

Instantly share code, notes, and snippets.

@shpwrck
Created March 7, 2022 21:40
Show Gist options
  • Save shpwrck/ccd495a4943e8b677086342ca6060abc to your computer and use it in GitHub Desktop.
Save shpwrck/ccd495a4943e8b677086342ca6060abc to your computer and use it in GitHub Desktop.
Rancher Git Hub Action
name: Build Video
on: push
jobs:
create-cluster:
runs-on: self-hosted
steps:
- name: Checkout Contents
uses: actions/checkout@v2
- name: Create Kind Cluster
uses: helm/[email protected]
with:
config: files/kind-config.yml
- name: Install Ingress
run: |
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/main/deploy/static/provider/kind/deploy.yaml
kubectl wait --for=condition=Available --timeout=500s -n ingress-nginx deployment/ingress-nginx-controller
kubectl rollout status -n ingress-nginx deployment/ingress-nginx-controller -w
kubectl wait --for=condition=Ready --timeout=500s -n ingress-nginx -l app.kubernetes.io/component=controller pod
- name: Install Helm
run: |
curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash
- name: Install Cert-manager
run: |
kubectl apply -f https://github.com/jetstack/cert-manager/releases/download/v1.5.1/cert-manager.crds.yaml
helm repo add jetstack https://charts.jetstack.io
helm repo update
helm install cert-manager jetstack/cert-manager --namespace cert-manager --create-namespace --version v1.5.1
kubectl wait --for=condition=Available --timeout=500s -n cert-manager deployment/cert-manager
- name: Install Rancher
run: |
kubectl create namespace cattle-system
helm repo add rancher-latest https://releases.rancher.com/server-charts/latest
helm repo update
helm install rancher rancher-latest/rancher --namespace cattle-system --set hostname=localhost --set bootstrapPassword=twelvecharacters --set replicas=1
kubectl wait --for=condition=Available --timeout=500s -n cattle-system deployment/rancher
kubectl patch settings first-login --type='json' -p='[{"op": "replace", "path": "/value", "value": "false"}]'
kubectl patch user $(kubectl get user -l authz.management.cattle.io/bootstrapping=admin-user -o jsonpath='{.items[*].metadata.name}') --type='json' -p='[{"op": "replace", "path": "/mustChangePassword", "value": False}]'
kubectl create namespace $(kubectl get user -l authz.management.cattle.io/bootstrapping=admin-user -o jsonpath='{.items[*].metadata.name}')
kubectl apply -f files/userPreferences.yml -n $(kubectl get user -l authz.management.cattle.io/bootstrapping=admin-user -o jsonpath='{.items[*].metadata.name}')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment