Sitelet https://github.com/sharingio/infra
Skip to content
 
 

Latest commit

 

History

564 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

#+title: infra

#+begin_quote
a Flux + Terraform infrastructure repo
#+end_quote

* Todo

- [x] add Flux for cluster repo
- [x] get talosconfig
- [ ] access Kubernetes APIServer
- [ ] verify Ceph disk allocation

* Prerequisites

Install OpenTofu

#+begin_src tmux :session ":tofu "
brew install opentofu
#+end_src

#+RESULTS:

Create a .tfvars file

#+begin_src hcl
tenancy_ocid     = "TENANCY OCID                         : https://cloud.oracle.com/tenancy"
user_ocid        = "YOUR USER OCID                       : https://cloud.oracle.com/identity/domains/my-profile"
private_key_path = "YOUR PRIVATE KEY PATH                : https://cloud.oracle.com/identity/domains/my-profile/api-keys"
fingerprint      = "THE FINGERPRINT FOR YOUR PRIVATE KEY : ^^"
region           = "us-phoenix-1"
compartment_ocid = "YOUR COMPARTMENT OCID                : https://cloud.oracle.com/identity/compartments # cloudnativecoop"
#+end_src

* Usage

You'll need .tfvar files, currently we create those via org files.

#+begin_src tmux :session ":tofu"
cd ~/infra
tofu init -var-file=./.tfvars -var github_token="$(gh auth token)" --upgrade
#+end_src

plan

#+begin_src tmux :session ":tofu"
tofu plan -var-file=./.tfvars -var github_token="$(gh auth token)"
#+end_src

apply

#+begin_src tmux :session ":tofu"
tofu apply -var-file=./.tfvars -var github_token="$(gh auth token)"
#+end_src

get talosconfig

#+begin_src tmux :session ":talos"
tofu output -raw talosconfig > ./talosconfig
#+end_src

get kubeconfig

#+begin_src tmux
tofu output -raw kubeconfig > ./kubeconfig
#+end_src

* Flux usage

force a reconciliation

#+begin_src tmux
flux --kubeconfig ./kubeconfig reconcile source git flux-system
#+end_src

* Force tear down

#+begin_src tmux :session ":tofu"
tofu state list | grep -E 'talos|flux|manifests|kubernetes_manifest' | xargs -I{} tofu state rm {}
tofu destroy -var-file=./.tfvars -var github_token="$(gh auth token)"
#+end_src

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages