Refactor services heirarchically, add logging
This commit is contained in:
parent
ec5b2ab5f1
commit
419bb286d4
11 changed files with 221 additions and 13 deletions
24
Makefile
24
Makefile
|
|
@ -1,6 +1,6 @@
|
|||
.PHONY: init plan apply destroy kubeconfig talosconfig argocd-password bootstrap decrypt post-apply
|
||||
.PHONY: init plan apply destroy kubeconfig talosconfig argocd-password bootstrap decrypt post-apply fluentbit-secret
|
||||
|
||||
SECRET=dumpnet/cluster
|
||||
SECRET=dumpnet
|
||||
TF_DIR=terraform
|
||||
SOPS_FILES=controlplane.yaml worker.yaml talosconfig
|
||||
|
||||
|
|
@ -25,7 +25,7 @@ bootstrap:
|
|||
talosconfig:
|
||||
aws secretsmanager get-secret-value --secret-id $(SECRET) \
|
||||
--query SecretString --output text | python3 -c \
|
||||
"import sys,json; print(json.load(sys.stdin)['talosconfig'])" \
|
||||
"import sys,json; print(json.load(sys.stdin)['cluster']['talosconfig'])" \
|
||||
> /tmp/talosconfig-dumpnet
|
||||
talosctl config merge /tmp/talosconfig-dumpnet
|
||||
rm /tmp/talosconfig-dumpnet
|
||||
|
|
@ -34,7 +34,7 @@ talosconfig:
|
|||
kubeconfig:
|
||||
aws secretsmanager get-secret-value --secret-id $(SECRET) \
|
||||
--query SecretString --output text | python3 -c \
|
||||
"import sys,json; print(json.load(sys.stdin)['kubeconfig'])" \
|
||||
"import sys,json; print(json.load(sys.stdin)['cluster']['kubeconfig'])" \
|
||||
> /tmp/kubeconfig-dumpnet
|
||||
KUBECONFIG=~/.kube/config:/tmp/kubeconfig-dumpnet kubectl config view --flatten > /tmp/merged
|
||||
mv /tmp/merged ~/.kube/config
|
||||
|
|
@ -44,7 +44,7 @@ kubeconfig:
|
|||
argocd-password:
|
||||
@aws secretsmanager get-secret-value --secret-id $(SECRET) \
|
||||
--query SecretString --output text | python3 -c \
|
||||
"import sys,json; print(json.load(sys.stdin)['argocd_admin_password'])"
|
||||
"import sys,json; print(json.load(sys.stdin)['cluster']['argocd_admin_password'])"
|
||||
|
||||
# Decrypt sensitive files to /tmp for one-off talosctl use
|
||||
# Files are never decrypted in the repo directory
|
||||
|
|
@ -57,6 +57,20 @@ decrypt:
|
|||
done
|
||||
@echo "Decrypted files are in /tmp/ - they will not persist after reboot"
|
||||
|
||||
# Create fluent-bit AWS credentials secret in cluster
|
||||
fluentbit-secret:
|
||||
@KEY_ID=$$(aws secretsmanager get-secret-value --secret-id $(SECRET) \
|
||||
--query SecretString --output text | python3 -c \
|
||||
"import sys,json; print(json.load(sys.stdin)['fluentbit']['aws_access_key_id'])") && \
|
||||
SECRET_KEY=$$(aws secretsmanager get-secret-value --secret-id $(SECRET) \
|
||||
--query SecretString --output text | python3 -c \
|
||||
"import sys,json; print(json.load(sys.stdin)['fluentbit']['aws_secret_access_key'])") && \
|
||||
kubectl create secret generic fluentbit-aws-credentials \
|
||||
--namespace fluent-bit \
|
||||
--from-literal=AWS_ACCESS_KEY_ID=$$KEY_ID \
|
||||
--from-literal=AWS_SECRET_ACCESS_KEY=$$SECRET_KEY \
|
||||
--dry-run=client -o yaml | kubectl apply -f -
|
||||
|
||||
# Run all post-apply steps (run once after fresh cluster creation)
|
||||
post-apply:
|
||||
scripts/post-apply.sh
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue