Skip to content

Commit

Permalink
fix ingress
Browse files Browse the repository at this point in the history
Signed-off-by: Carlos Santana <[email protected]>
  • Loading branch information
csantanapr committed Oct 27, 2023
1 parent cdf1ebf commit 02d63f8
Show file tree
Hide file tree
Showing 7 changed files with 62 additions and 15 deletions.
45 changes: 42 additions & 3 deletions patterns/gitops/getting-started-argocd/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,52 @@ terraform init
terraform apply
```

Access Terraform output to configure `kubectl` and `argocd`
Get `kubectl` config, and run the output
```shell
terraform output
terraform output -raw configure_kubectl
```

Deploy Addons using ArgoCD
```shell
kubectl apply -f bootstrap/addons.yaml
```
Verify Addons are ready
```shell
kubectl get applications -n argocd \
addon-getting-started-gitops-aws-load-balancer-controller \
addon-getting-started-gitops-metrics-server
kubectl get deployment -n kube-system \
aws-load-balancer-controller \
metrics-server
```

Get ArgoCD UI and CLI access configuration, and run the output in a new terminal window
```shell
terraform output -raw configure_argocd
```

Deploy Sample Application
```shell
kubectl apply -f bootstrap/workloads.yaml
```
Verify Application is ready
```shell
kubectl get -n argocd applications workloads
kubectl get -n game-2048 deployments
kubectl get -n game-2048 deployments
kubectl get -n game-2048 ingress
```

Get the Ingress URL for the Application
```shell
kubectl get ingress
```
Verify Application on the Browser or Terminal
```shell
curl ...
```

Destroy EKS Cluster
```shell
cd hub
./destroy.sh
```
2 changes: 2 additions & 0 deletions patterns/gitops/getting-started-argocd/bootstrap/addons.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ spec:
repoURL: '{{metadata.annotations.addons_repo_url}}'
path: '{{metadata.annotations.addons_repo_basepath}}{{metadata.annotations.addons_repo_path}}'
targetRevision: '{{metadata.annotations.addons_repo_revision}}'
directory:
recurse: true
destination:
namespace: argocd
name: '{{name}}'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ spec:
- clusters: {}
template:
metadata:
name: workload
name: workloads
finalizers:
# This finalizer is for demo purposes, in production remove apps using argocd CLI "argocd app delete workload --cascade"
# When you invoke argocd app delete with --cascade, the finalizer is added automatically.
Expand Down
19 changes: 14 additions & 5 deletions patterns/gitops/getting-started-argocd/destroy.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,22 @@
#!/bin/bash

set -x
set -euo pipefail

SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
ROOTDIR="$(cd ${SCRIPTDIR}/../..; pwd )"
[[ -n "${DEBUG:-}" ]] && set -x

# Delete the Ingress/SVC before removing the addons
TMPFILE=$(mktemp)
terraform output -raw configure_kubectl > "$TMPFILE"
source "$TMPFILE"

kubectl delete svc -n argocd argo-cd-argocd-server
terraform -chdir=$SCRIPTDIR output -raw configure_kubectl > "$TMPFILE"
# check if TMPFILE contains the string "No outputs found"
if [[ ! $(cat $TMPFILE) == *"No outputs found"* ]]; then
source "$TMPFILE"
kubectl delete -n argocd applicationset workloads
kubectl delete -n argocd applicationset cluster-addons
kubectl delete -n argocd application addon-dev-argo-cd
kubectl delete -n argocd svc argo-cd-argocd-server
fi

terraform destroy -target="module.gitops_bridge_bootstrap" -auto-approve
terraform destroy -target="module.eks_blueprints_addons" -auto-approve
Expand Down
6 changes: 1 addition & 5 deletions patterns/gitops/getting-started-argocd/k8s/game-2048.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,7 @@ metadata:
namespace: game-2048
name: ingress-2048
annotations:
alb.ingress.kubernetes.io/listen-ports: '[{"HTTP": 80}, {"HTTPS":443}]'
alb.ingress.kubernetes.io/scheme: internet-facing
alb.ingress.kubernetes.io/ssl-redirect: '443'
alb.ingress.kubernetes.io/target-type: ip
spec:
ingressClassName: alb
Expand All @@ -61,6 +59,4 @@ spec:
service:
name: service-2048
port:
number: 80
tls:
- hosts: []
name: http
2 changes: 1 addition & 1 deletion patterns/gitops/getting-started-argocd/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ locals {
enable_ack_eventbridge = try(var.addons.enable_ack_eventbridge, false)
}
oss_addons = {
enable_argocd = try(var.addons.enable_argocd, false)
enable_argocd = try(var.addons.enable_argocd, true)
enable_argo_rollouts = try(var.addons.enable_argo_rollouts, false)
enable_argo_events = try(var.addons.enable_argo_events, false)
enable_argo_workflows = try(var.addons.enable_argo_workflows, false)
Expand Down
1 change: 1 addition & 0 deletions patterns/gitops/getting-started-argocd/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ variable "region" {
variable "kubernetes_version" {
description = "Kubernetes version"
type = string
default = "1.28"
}
variable "environment" {
description = "Kubernetes environment"
Expand Down

0 comments on commit 02d63f8

Please sign in to comment.