Skip to content

Commit

Permalink
Merge pull request #13 from debenstack/dev
Browse files Browse the repository at this point in the history
Operator backups setup. Added basic projects and apps to Argo
  • Loading branch information
bensoer authored Jun 22, 2024
2 parents e6c14aa + e318fb5 commit c54b8a1
Show file tree
Hide file tree
Showing 25 changed files with 1,503 additions and 71 deletions.
9 changes: 7 additions & 2 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ module "k8infra" {

domain = var.domain
sub_domain = var.sub_domain

object_storage_region = var.object_storage_region
}

resource "time_sleep" "wait_60_seconds" {
Expand All @@ -60,8 +62,11 @@ module "k8config" {
cf_token = var.cf_token
domain = var.sub_domain != "" ? format("%s.%s", var.sub_domain, var.domain) : var.domain

s3_access_key_id = var.do_spaces_access_key_id
s3_secret_access_key = var.do_spaces_secret_access_key
object_storage_access_key_id = var.object_storage_access_key_id
object_storage_secret_access_key = var.object_storage_secret_access_key
object_storage_bucket_name = module.k8infra.object_storage_bucket_name
object_storage_endpoint = module.k8infra.object_storage_bucket_endpoint
object_storage_region = module.k8infra.object_storage_bucket_region

providers = {
kubernetes = kubernetes
Expand Down
26 changes: 24 additions & 2 deletions modules/k8config/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,8 @@ module "kyverno" {
module "loki" {
source = "./modules/loki"

s3_access_key_id = var.s3_access_key_id
s3_secret_access_key = var.s3_secret_access_key
s3_access_key_id = var.object_storage_access_key_id
s3_secret_access_key = var.object_storage_secret_access_key

providers = {
helm = helm
Expand Down Expand Up @@ -163,6 +163,28 @@ module "prometheus-adapter" {
module "postgres-operator" {
source = "./modules/postgres"

domain = var.domain
object_storage_access_key_id = var.object_storage_access_key_id
object_storage_secret_access_key = var.object_storage_secret_access_key
object_storage_endpoint = var.object_storage_endpoint
object_storage_region = var.object_storage_region
object_storage_bucket_name = var.object_storage_bucket_name
providers = {
helm = helm
kubectl = kubectl
kubernetes = kubernetes
}

depends_on = [
time_sleep.wait_60_seconds,
module.certmanager,
module.traefik
]
}

module "mysql-operator" {
source = "./modules/mysql-operator"

domain = var.domain

providers = {
Expand Down
16 changes: 16 additions & 0 deletions modules/k8config/modules/argocd/apps.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@

resource "kubectl_manifest" "adventurewiki_app" {
yaml_body = file("${abspath(path.module)}/res/apps/adventurewiki-app.yaml")

depends_on = [
kubectl_manifest.projectterris_project
]
}

resource "kubectl_manifest" "profile_app" {
yaml_body = file("${abspath(path.module)}/res/apps/profile-app.yaml")

depends_on = [
kubectl_manifest.debenstack_project
]
}
3 changes: 2 additions & 1 deletion modules/k8config/modules/argocd/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,5 @@ resource "kubectl_manifest" "argocd_ingress" {
helm_release.argocd,
kubectl_manifest.argocd_ingress_certificate
]
}
}

24 changes: 24 additions & 0 deletions modules/k8config/modules/argocd/projects.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@


resource "time_sleep" "wait_after_argo" {
create_duration = "30s"
depends_on = [helm_release.argocd]
}

resource "kubectl_manifest" "debenstack_project" {
yaml_body = file("${abspath(path.module)}/res/projects/debenstack-app-project.yaml")

depends_on = [
time_sleep.wait_after_argo
]
}

resource "kubectl_manifest" "projectterris_project" {
yaml_body = file("${abspath(path.module)}/res/projects/projectterris-app-project.yaml")

depends_on = [
time_sleep.wait_after_argo
]
}


17 changes: 17 additions & 0 deletions modules/k8config/modules/argocd/res/apps/adventurewiki-app.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: adventurewiki
namespace: argocd
spec:
destination:
name: in-cluster
namespace: adventurewiki
project: projectterris
source:
path: helm
repoURL: https://github.com/debenstack/debenstack-adventurewiki.git
targetRevision: main
syncPolicy:
syncOptions:
- CreateNamespace=true
17 changes: 17 additions & 0 deletions modules/k8config/modules/argocd/res/apps/profile-app.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: profile
namespace: argocd
spec:
destination:
name: in-cluster
namespace: profile
project: debenstack
source:
path: helm
repoURL: https://github.com/debenstack/debenstack-profile.git
targetRevision: master
syncPolicy:
syncOptions:
- CreateNamespace=true
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
apiVersion: argoproj.io/v1alpha1
kind: AppProject
metadata:
name: debenstack
namespace: argocd
finalizers:
- resources-finalizer.argocd.argoproj.io
spec:
description: Projects Relevent to Ben and Personal Items
destinations:
- name: in-cluster
namespace: '*'
server: https://kubernetes.default.svc
sourceRepos:
- https://github.com/debenstack/debenstack-profile.git
- https://github.com/debenstack/debenstack-techblog.git
- https://github.com/debenstack/debenstack-personalblog.git
- https://github.com/debenstack/debenstack-wiki.git
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
apiVersion: argoproj.io/v1alpha1
kind: AppProject
metadata:
name: projectterris
namespace: argocd
finalizers:
- resources-finalizer.argocd.argoproj.io
spec:
description: Projects with Business Potential
destinations:
- name: in-cluster
namespace: '*'
server: https://kubernetes.default.svc
sourceRepos:
- https://github.com/debenstack/debenstack-adventurewiki.git

30 changes: 6 additions & 24 deletions modules/k8config/modules/crds/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -35,27 +35,9 @@ resource "kubectl_manifest" "kyverno-crds" {
server_side_apply = true
}


/* Elasticsearch */
/*
resource "helm_release" "elasticsearch-crds" {
name = "eck-operator"
repository = "https://helm.elastic.co"
chart = "eck-operator-crds"
atomic = true
create_namespace = true
namespace = "elasticsearch"
version = "2.12.1"
recreate_pods = true
reuse_values = true
force_update = true
cleanup_on_fail = true
dependency_update = true
#values = [
# file("${abspath(path.module)}/res/elasticsearch-crd-values.yaml")
#]
}*/
/* MySQL Operator */
resource "kubectl_manifest" "mysql-operator-crds" {
for_each = toset(split("---", file("${abspath(path.module)}/res/mysql-operator-8.4.0-2.1.3/crd.yaml")))
yaml_body = each.value
server_side_apply = true
}
Loading

0 comments on commit c54b8a1

Please sign in to comment.