diff --git a/.github/k8s/deployment.yaml b/.github/k8s/deployment.yaml new file mode 100644 index 0000000..d451510 --- /dev/null +++ b/.github/k8s/deployment.yaml @@ -0,0 +1,18 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: web +spec: + selector: + matchLabels: + app: web + template: + metadata: + labels: + app: web + spec: + containers: + - name: web + image: registry.uffizzi.com/quickstart + ports: + - containerPort: 8080 diff --git a/.github/k8s/ingress.yaml b/.github/k8s/ingress.yaml new file mode 100644 index 0000000..5d8bab3 --- /dev/null +++ b/.github/k8s/ingress.yaml @@ -0,0 +1,20 @@ +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: web +spec: + ingressClassName: uffizzi + rules: + - host: web.example.com + http: + paths: + - backend: + service: + name: web + port: + number: 8080 + path: / + pathType: Prefix + tls: + - hosts: + - web.example.com diff --git a/.github/k8s/kustomization.yaml b/.github/k8s/kustomization.yaml new file mode 100644 index 0000000..f77144d --- /dev/null +++ b/.github/k8s/kustomization.yaml @@ -0,0 +1,6 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +resources: + - deployment.yaml + - ingress.yaml + - service.yaml \ No newline at end of file diff --git a/.github/k8s/service.yaml b/.github/k8s/service.yaml new file mode 100644 index 0000000..12d5c21 --- /dev/null +++ b/.github/k8s/service.yaml @@ -0,0 +1,10 @@ +apiVersion: v1 +kind: Service +metadata: + name: web +spec: + ports: + - port: 8080 + type: ClusterIP + selector: + app: web diff --git a/.github/workflows/uffizzi-cluster.yaml b/.github/workflows/uffizzi-cluster.yaml index 7ce2de7..4840a26 100644 --- a/.github/workflows/uffizzi-cluster.yaml +++ b/.github/workflows/uffizzi-cluster.yaml @@ -39,7 +39,7 @@ jobs: push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} - context: ./ + context: ./src cache-from: type=gha cache-to: type=gha,mode=max @@ -88,21 +88,26 @@ jobs: with: cluster-name: pr-${{ github.event.pull_request.number }}-e2e-helm server: https://app.uffizzi.com + k8s-version: 1.28 + kubeconfig: kubeconfig - name: Apply Kustomize to test the new image id: prev run: | - # Change the image name to those just built and pushed. - kustomize edit set image uffizzi/hello-world-k8s=${{ needs.build-image.outputs.tags }} - if [[ ${RUNNER_DEBUG} == 1 ]]; then - cat kustomization.yaml - echo "`pwd`" - echo "`ls`" + pwd + ls -la fi - - # Apply kustomized manifests to virtual cluster. - kubectl apply --kustomize . --kubeconfig ./kubeconfig + ( + cp ./kubeconfig ./.github/k8s + cd .github/k8s + # Change the image name to those just built and pushed. + kustomize edit set image uffizzi/hello-world-k8s=${{ needs.build-image.outputs.tags }} + + + # Apply kustomized manifests to virtual cluster. + kubectl apply --kustomize . --kubeconfig ./kubeconfig + ) # Allow uffizzi to sync the resources sleep 5 diff --git a/.gitignore b/.gitignore index a6f21c9..7ab4242 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ src/node_modules +.idea