Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix deployment of infrastructure through Terraform #47

Merged
merged 17 commits into from
Dec 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 26 additions & 22 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,64 +1,68 @@
version: 2.1
orbs:
terraform: circleci/[email protected]
jobs:
terraform-cycle:
executor: terraform/default
docker:
- image: "cimg/base:stable"
steps:
- checkout
- setup_remote_docker:
version: 20.10.7
- run:
name: Create .terraformrc file locally
command: >-
echo "credentials \"app.terraform.io\" {token =
\"$TERRAFORM_TOKEN\"}" > $HOME/.terraformrc
- run:
- run:
name: Install Terraform cli
command: |
wget https://releases.hashicorp.com/terraform/1.4.2/terraform_1.4.2_linux_386.zip
unzip terraform_1.4.2_linux_386.zip
sudo mv terraform /usr/local/bin
- run:
name: Terraform cycle
command: |
cd aws/terraform-aws
terraform init -upgrade
terraform validate
terraform init
terraform plan
cd ../../azure/terraform-azure
terraform init -upgrade
terraform validate
terraform init
terraform plan
working_directory: ~/src
working_directory: ~/project

build-publish:
docker:
- image: 'cimg/base:stable'
- image: "cimg/base:stable"
auth:
username: $DOCKER_USERNAME
password: $DOCKER_PASSWORD
environment:
TAG: 0.1.<< pipeline.number >>
steps:
- checkout
- setup_remote_docker:
version: 20.10.7
version: 20.10.7
- run:
name: Build geekzone/infra image
name: Build geekzone/infra image
command: |
docker build -t geekzone/infra .
docker build -t geekzone/infra:$TAG .
- deploy:
name: Push geekzone/infra image to Docker Hub
command: |
docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD
docker push geekzone/infra

docker push geekzone/infra:$TAG

workflows:
main-infra:
jobs:
- terraform-cycle:
filters:
branches:
ignore:
- /junk-.*/
ignore:
- /junk-.*/
- build-publish:
requires:
- terraform-cycle
- terraform-cycle
filters:
branches:
ignore:
- /junk-.*/


ignore:
- /junk-.*/
46 changes: 23 additions & 23 deletions aws/k8s/external-dns/external-dns.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ kind: ClusterRole
metadata:
name: external-dns
rules:
- apiGroups: [""]
resources: ["services","endpoints","pods"]
verbs: ["get","watch","list"]
- apiGroups: ["extensions","networking.k8s.io"]
resources: ["ingresses"]
verbs: ["get","watch","list"]
- apiGroups: [""]
resources: ["nodes"]
verbs: ["list", "watch"]
- apiGroups: [""]
resources: ["services", "endpoints", "pods"]
verbs: ["get", "watch", "list"]
- apiGroups: ["extensions", "networking.k8s.io"]
resources: ["ingresses"]
verbs: ["get", "watch", "list"]
- apiGroups: [""]
resources: ["nodes"]
verbs: ["list", "watch"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
Expand All @@ -28,9 +28,9 @@ roleRef:
kind: ClusterRole
name: external-dns
subjects:
- kind: ServiceAccount
name: external-dns
namespace: external-dns
- kind: ServiceAccount
name: external-dns
namespace: external-dns
---
apiVersion: apps/v1
kind: Deployment
Expand All @@ -50,14 +50,14 @@ spec:
spec:
serviceAccountName: external-dns
containers:
- name: external-dns
image: k8s.gcr.io/external-dns/external-dns:v0.7.6
args:
- --source=ingress # service is also possible
- --domain-filter=geek.zone # (optional) limit to only example.com domains; change to match the zone created above.
- --zone-id-filter=0a6922d1395d374729870d071e623aa0 # (optional) limit to a specific zone.
- --provider=cloudflare
- --cloudflare-proxied # (optional) enable the proxy feature of Cloudflare (DDOS protection, CDN...)
envFrom:
- secretRef:
name: external-dns-secrets
- name: external-dns
image: registry.k8s.io/external-dns/external-dns:v0.13.5
args:
- --source=ingress # service is also possible
- --domain-filter=geek.zone # (optional) limit to only example.com domains; change to match the zone created above.
- --zone-id-filter=0a6922d1395d374729870d071e623aa0 # (optional) limit to a specific zone.
- --provider=cloudflare
- --cloudflare-proxied # (optional) enable the proxy feature of Cloudflare (DDOS protection, CDN...)
envFrom:
- secretRef:
name: external-dns-secrets
46 changes: 23 additions & 23 deletions azure/k8s/external-dns/external-dns.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ kind: ClusterRole
metadata:
name: external-dns
rules:
- apiGroups: [""]
resources: ["services","endpoints","pods"]
verbs: ["get","watch","list"]
- apiGroups: ["extensions","networking.k8s.io"]
resources: ["ingresses"]
verbs: ["get","watch","list"]
- apiGroups: [""]
resources: ["nodes"]
verbs: ["list", "watch"]
- apiGroups: [""]
resources: ["services", "endpoints", "pods"]
verbs: ["get", "watch", "list"]
- apiGroups: ["extensions", "networking.k8s.io"]
resources: ["ingresses"]
verbs: ["get", "watch", "list"]
- apiGroups: [""]
resources: ["nodes"]
verbs: ["list", "watch"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
Expand All @@ -28,9 +28,9 @@ roleRef:
kind: ClusterRole
name: external-dns
subjects:
- kind: ServiceAccount
name: external-dns
namespace: external-dns
- kind: ServiceAccount
name: external-dns
namespace: external-dns
---
apiVersion: apps/v1
kind: Deployment
Expand All @@ -50,14 +50,14 @@ spec:
spec:
serviceAccountName: external-dns
containers:
- name: external-dns
image: k8s.gcr.io/external-dns/external-dns:v0.7.6
args:
- --source=ingress # service is also possible
- --domain-filter=geek.zone # (optional) limit to only example.com domains; change to match the zone created above.
- --zone-id-filter=0a6922d1395d374729870d071e623aa0 # (optional) limit to a specific zone.
- --provider=cloudflare
- --cloudflare-proxied # (optional) enable the proxy feature of Cloudflare (DDOS protection, CDN...)
envFrom:
- secretRef:
name: external-dns-secrets
- name: external-dns
image: registry.k8s.io/external-dns/external-dns:v0.13.5
args:
- --source=ingress # service is also possible
- --domain-filter=geek.zone # (optional) limit to only example.com domains; change to match the zone created above.
- --zone-id-filter=0a6922d1395d374729870d071e623aa0 # (optional) limit to a specific zone.
- --provider=cloudflare
- --cloudflare-proxied # (optional) enable the proxy feature of Cloudflare (DDOS protection, CDN...)
envFrom:
- secretRef:
name: external-dns-secrets
Loading