Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
c8470f7
add backstage template to create a ephemeral cluster
arunvthangaraj Apr 19, 2025
d498c19
Merge branch 'dev' of https://github.com/arunvthangaraj/appmod-bluepr…
arunvthangaraj Apr 21, 2025
207f947
updates catalog-info.yaml
arunvthangaraj Apr 21, 2025
2315f48
updates HOSTNAME
arunvthangaraj Apr 21, 2025
668d145
updates hostname for testing
arunvthangaraj Apr 24, 2025
28af2cd
updates hostname for testing
arunvthangaraj Apr 25, 2025
5144b01
adds kyverno policy exception for ephemeral cluster
arunvthangaraj Apr 25, 2025
d7a3733
updates hostname for testing
arunvthangaraj May 1, 2025
dce573a
updates hostname for testing
arunvthangaraj May 2, 2025
e75cabe
updates HOSTNAME for testing
arunvthangaraj May 6, 2025
58f5f94
sets storage class as gp3
arunvthangaraj May 9, 2025
ecc906b
updates hostname for testing
arunvthangaraj May 10, 2025
c54ab75
updates PolicyException for eppemeral cluster
arunvthangaraj May 10, 2025
113f69c
removes gitea URL param
arunvthangaraj May 20, 2025
948de4a
updates hostname for testing
arunvthangaraj May 20, 2025
c042a3c
updates catalog info
arunvthangaraj May 20, 2025
cd7233d
uses dynamic namespace in argo app for ephemeral cluster
arunvthangaraj May 21, 2025
a001052
Merge branch 'aws-samples:main' into feat-ephemeral-cluster
arunvthangaraj Jun 25, 2025
cdb556f
Merge branch 'dev' of https://github.com/arunvthangaraj/appmod-bluepr…
arunvthangaraj Jul 25, 2025
bccbced
Merge branch 'feat-ephemeral-cluster' of https://github.com/arunvthan…
arunvthangaraj Jul 25, 2025
3b162a8
removes repo URL as required param
arunvthangaraj Jul 25, 2025
d668ddc
updates hostname for testing
arunvthangaraj Jul 25, 2025
e6c30b2
adds fetch system step
arunvthangaraj Jul 25, 2025
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
35 changes: 35 additions & 0 deletions packages/kyverno/enforce/exceptions/ephemeral-cluster.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
apiVersion: kyverno.io/v2beta1
kind: PolicyException
metadata:
name: ephemeral-cluster-operation
namespace: kyverno
spec:
exceptions:
- policyName: disallow-privilege-escalation
ruleNames:
- privilege-escalation
- autogen-privilege-escalation
- policyName: disallow-capabilities-strict
ruleNames:
- require-drop-all
- autogen-require-drop-all
- policyName: require-run-as-nonroot
ruleNames:
- run-as-non-root
- autogen-run-as-non-root
- policyName: restrict-seccomp-strict
ruleNames:
- check-seccomp-strict
- autogen-check-seccomp-strict
match:
any:
- resources:
kinds:
- Pod
- Deployment
- ReplicaSet
- StatefulSet
namespaces:
- ephemeral-cluster
names:
- "*"
4 changes: 3 additions & 1 deletion platform/backstage/templates/catalog-info.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ spec:
- ./stepfunctions-bedrock-terraform/template-stepfunctions-bedrock-terraform.yaml
- ./apigw-sqs-terraform/template-apigw-sqs-terraform.yaml
- ./eventbridge-to-lambda-terraform/template-eventbridge-to-lambda-terraform.yaml
- ./ephemeral-cluster/template-ephemeral-cluster.yaml

---
apiVersion: backstage.io/v1alpha1
kind: System
Expand All @@ -34,4 +36,4 @@ metadata:
description: Holds system information i.e, hostname, IP, OS, etc
spec:
owner: guest
hostname: HOSTNAME
hostname: modern-engg-591204cb6d7471ff.elb.us-west-2.amazonaws.com #HOSTNAME
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
apiVersion: scaffolder.backstage.io/v1beta3
kind: Template
metadata:
description: Create a ephemeral kubernetes cluster
name: ephemeral-cluster
title: Ephemeral Kubernetes Cluster
spec:
owner: guest
type: service
parameters:
- properties:
tfVars:
title: Terraform variables
properties:
name:
title: Name of the ephemeral cluster
type: string
aws_region:
description: AWS Region
type: string
required:
- name
- aws_region
type: object
adminRoleName:
description: Name of the role to give the administrative rights
title: Admin role name
type: string
namespace:
default: flux-system
title: Existing namespace to create this resource
type: string
title: Configuration options
steps:
- id: fetchSystem
name: Fetch System
action: catalog:fetch
input:
entityRef: system:default/system-info
- action: fetch:template
id: fetch-base
input:
url: ./template-ephemeral-cluster/
values:
adminRoleName: ${{parameters.adminRoleName}}
name: ${{parameters.tfVars.name}}
namespace: ${{parameters.namespace}}
tfVars: ${{parameters.tfVars}}
name: Fetch Base
- id: publish
name: Publishing to a gitea git repository
action: publish:gitea
input:
description: Example of ephemeral cluster
repoUrl: ${{ steps['fetchSystem'].output.entity.spec.hostname }}/gitea?repo=${{parameters.tfVars.name}}
defaultBranch: main
- id: create-argocd-app
name: Create ArgoCD App
action: cnoe:create-argocd-app
input:
appName: ${{parameters.tfVars.name}}
appNamespace: ${{parameters.namespace}}
argoInstance: in-cluster
projectName: default
# necessary until we generate our own cert
repoUrl: http://my-gitea-http.gitea.svc.cluster.local:3000/giteaAdmin/${{parameters.tfVars.name}}
path: "manifests"
- id: register
name: Register
action: catalog:register
input:
repoContentsUrl: ${{ steps['publish'].output.repoContentsUrl }}
catalogInfoPath: 'catalog-info.yaml'
output:
links:
- title: Open in catalog
icon: catalog
entityRef: ${{ steps['register'].output.entityRef }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: backstage.io/v1alpha1
kind: Component
metadata:
name: ephemeral-cluster-${{values.name}}
annotations:
backstage.io/kubernetes-namespace: ${{values.namespace}}
backstage.io/kubernetes-id: ephemeral-cluster-${{values.name}}
argocd/app-name: ${{values.name | dump}}
spec:
type: service
lifecycle: experimental
owner: guest
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: ${{values.name}}-ephemeral-cluster
namespace: argocd
labels:
cnoe.io/stackName: ${{values.name}}-ephemeral-cluster
cnoe.io/applicationName: ${{values.name}}-ephemeral-cluster-helm
spec:
project: default
source:
chart: vcluster
repoURL: https://charts.loft.sh
targetRevision: 0.24.0
helm:
valuesObject:
sync:
fromHost:
nodes:
enabled: true
storageClasses:
enabled: true
controlPlane:
advanced:
virtualScheduler:
enabled: true
statefulSet:
persistence:
volumeClaim:
storageClass: "gp3"
scheduling:
podManagementPolicy: OrderedReady
destination:
server: https://kubernetes.default.svc
namespace: ${{values.name}}-ephemeral-cluster
syncPolicy:
automated: {}
syncOptions:
- CreateNamespace=true
4 changes: 2 additions & 2 deletions platform/infra/terraform/argo-examples/dev-argoconnect.tf
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 5.0.0"
version = "~> 5.0"
}
kubectl = {
source = "alekc/kubectl"
version = ">= 2.0.0"
version = "~> 2.0"
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions platform/infra/terraform/bootstrap/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 5.0.0"
version = "~> 5.0"
}
}
}
Expand Down Expand Up @@ -100,4 +100,4 @@ module "managed_grafana" {
saml_idp_metadata_url = var.grafana_keycloak_idp_url

tags = local.tags
}
}
9 changes: 7 additions & 2 deletions platform/infra/terraform/dev/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,17 @@ terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 5.0.0"
version = "~> 5.0"
}
kubectl = {
source = "alekc/kubectl"
version = ">= 2.0.0"
version = "~> 2.0"
}
helm = {
source = "hashicorp/helm"
version = "~> 2.9"
}

}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,23 @@ terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 5.17"
version = "~> 5.17"
}
kubernetes = {
source = "hashicorp/kubernetes"
version = ">= 2.23"
version = "~> 2.23"
}
random = {
source = "hashicorp/random"
version = ">= 3.5.1"
version = "~> 3.5"
}
kubectl = {
source = "alekc/kubectl"
version = ">= 2.0.0"
version = "~> 2.0"
}
http = {
source = "hashicorp/http"
version = ">= 3.4.4"
version = "~> 3.4"
}
}
}
6 changes: 3 additions & 3 deletions platform/infra/terraform/mgmt/terraform/mgmt-cluster/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 5.34"
version = "~> 5.34"
}
helm = {
source = "hashicorp/helm"
version = ">= 2.9"
version = "~> 2.9"
}
}
}
Expand Down Expand Up @@ -81,4 +81,4 @@ resource "aws_cloudformation_stack" "usage_tracking" {
}
}
})
}
}
10 changes: 5 additions & 5 deletions platform/infra/terraform/mgmt/terraform/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,23 @@ terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 5.17"
version = "~> 5.17"
}
kubernetes = {
source = "hashicorp/kubernetes"
version = ">= 2.23"
version = "~> 2.23"
}
random = {
source = "hashicorp/random"
version = ">= 3.5.1"
version = "~> 3.5"
}
kubectl = {
source = "alekc/kubectl"
version = ">= 2.0.0"
version = "~> 2.0"
}
http = {
source = "hashicorp/http"
version = ">= 3.4.4"
version = "~> 3.4"
}
}
}
4 changes: 2 additions & 2 deletions platform/infra/terraform/post-deploy/dev-argoconnect.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 5.0.0"
version = "~> 5.0"
}
kubectl = {
source = "alekc/kubectl"
version = ">= 2.0.0"
version = "~> 2.0"
}
}
}
Expand Down
8 changes: 6 additions & 2 deletions platform/infra/terraform/prod/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,15 @@ terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 5.0.0"
version = "~> 5.0"
}
kubectl = {
source = "alekc/kubectl"
version = ">= 2.0.0"
version = "~> 2.0"
}
helm = {
source = "hashicorp/helm"
version = "~> 2.9"
}
}
}
Expand Down