Skip to content

Commit

Permalink
Feat: 🚀 README Automation workflow. (#25)
Browse files Browse the repository at this point in the history
* feat: structure new_relic addon

* feat: structure new_relic addon

* feat: tested new-relic its working

* feat: tested new-relic its working

* fix: licence key required notice added in value

* feat: update new relic structure and tested

* fix: update vars and changes for lint warnings

* fix: fix main.tf Interpolation tf lint check

* fix: remove unneccesary vars and lint warnings

* fix: ran tf format command

* fix: use token in provider.tf file

* fix: remove useless data block

* fix: update Interpolation expression warning

* fix: fix lint checks

* fix: remove unnecessary var from main.tf

* fix: remove tf cleaner

* fix: remove cluster name useless var from main.tf

* feat: addon folder readme creation

* fix: update checkout action to lastest

* fix: update checkout action to master

* readme: Update modules readme files

* feat: Finalize automation process

---------

Co-authored-by: nilesh <ianmolnagpal@gmail.com>
Co-authored-by: CloudDrove CI <84795582+clouddrove-ci@users.noreply.github.com>
  • Loading branch information
3 people committed Sep 17, 2023
1 parent f5bfad4 commit 8b9ff0f
Show file tree
Hide file tree
Showing 85 changed files with 1,223 additions and 479 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/readme.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
push:
branches:
- master
workflow_dispatch:

jobs:
readme-create:
Expand Down Expand Up @@ -53,3 +54,26 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # required
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_TERRAFORM }} # required
if: always()

# Create README for each Submodules
readme-create-addon:
name: 'Addon readme-create'
runs-on: ubuntu-latest
steps:
- name: 'Checkout'
uses: actions/checkout@master
with:
ref: "master"

- name: Generate TF Docs
uses: terraform-docs/gh-actions@v1.0.0
with:
working-dir: addons/aws-ebs-csi-driver,addons/aws-efs-csi-driver,addons/aws-load-balancer-controller,addons/aws-node-termination-handler,addons/calico-tigera,addons/cluster-autoscaler,addons/external-secrets,addons/fluent-bit,addons/helm,addons/ingress-nginx,addons/istio-ingress,addons/karpenter,addons/kiali-server,addons/kubeclarity,addons/metrics-server,addons/nri-bundle # config,modules/guardduty,modules/inspector
git-push: true
template: |-
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
{{ .Content }}
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
git-push-user-name: "clouddrove-ci"
git-push-user-email: 84795582+clouddrove-ci@users.noreply.github.com
git-commit-message: "readme: Update add-on's readme"
32 changes: 1 addition & 31 deletions _examples/basic/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,6 @@ module "vpc" {
tags = local.tags
}

################################################################################
# VPC Supporting Resources
################################################################################

data "aws_security_group" "default" {
name = "default"
vpc_id = module.vpc.vpc_id
}

###############################################################################
# AWS EKS
###############################################################################
Expand Down Expand Up @@ -93,7 +84,7 @@ module "eks" {
}
tags = {
"kubernetes.io/cluster/${module.eks.cluster_name}" = "shared"
"karpenter.sh/discovery" = "${module.eks.cluster_name}"
"karpenter.sh/discovery" = module.eks.cluster_name
}
}

Expand Down Expand Up @@ -126,7 +117,6 @@ module "eks" {
################################################################################
# EKS Supporting Resources
################################################################################
data "aws_caller_identity" "current" {}
data "aws_availability_zones" "available" {}

module "vpc_cni_irsa" {
Expand Down Expand Up @@ -167,26 +157,6 @@ resource "aws_iam_policy" "node_additional" {
tags = local.tags
}

data "aws_ami" "eks_default" {
most_recent = true
owners = ["amazon"]

filter {
name = "name"
values = ["amazon-eks-node-${local.cluster_version}-v*"]
}
}

data "aws_ami" "eks_default_arm" {
most_recent = true
owners = ["amazon"]

filter {
name = "name"
values = ["amazon-eks-arm64-node-${local.cluster_version}-v*"]
}
}

module "addons" {
source = "../../"

Expand Down
6 changes: 3 additions & 3 deletions _examples/basic/providers.tf
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,21 @@ provider "aws" {
provider "kubernetes" {
host = module.eks.cluster_endpoint
cluster_ca_certificate = base64decode(module.eks.cluster_certificate_authority_data)
token = join("", data.aws_eks_cluster_auth.eks_cluster.*.token)
token = data.aws_eks_cluster_auth.eks_cluster.token
}

provider "helm" {
kubernetes {
host = module.eks.cluster_endpoint
cluster_ca_certificate = base64decode(module.eks.cluster_certificate_authority_data)
token = join("", data.aws_eks_cluster_auth.eks_cluster.*.token)
token = data.aws_eks_cluster_auth.eks_cluster.token
}
}

provider "kubectl" {
host = module.eks.cluster_endpoint
cluster_ca_certificate = base64decode(module.eks.cluster_certificate_authority_data)
token = join("", data.aws_eks_cluster_auth.eks_cluster.*.token)
token = data.aws_eks_cluster_auth.eks_cluster.token
}

data "aws_eks_cluster_auth" "eks_cluster" {
Expand Down
23 changes: 0 additions & 23 deletions _examples/basic/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,6 @@
# Variables
# ------------------------------------------------------------------------------

variable "region" {
type = string
default = "us-east-1"
description = "Region Code"
}

variable "cluster_endpoint_public_access" {
type = bool
default = true
description = "Indicates whether or not the Amazon EKS public API server endpoint is enabled"
}

variable "cluster_endpoint_private_access" {
type = bool
default = true
description = "Indicates whether or not the Amazon EKS private API server endpoint is enabled"
}

variable "token" {
type = string
default = "test-addon-efs"
}

variable "istio_manifests" {
type = object({
istio_ingress_manifest_file_path = string
Expand Down
10 changes: 10 additions & 0 deletions _examples/complete/config/override-new-relic.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Configuration settings for the newrelic-infrastructure chart
newrelic-infrastructure:
# Any key defined in the values.yml file for the newrelic-infrastructure chart can be configured here:
# https://github.com/newrelic/nri-kubernetes/blob/main/charts/newrelic-infrastructure/values.yaml

verboseLog: false

global:
# Get your free licence key from here by signing in into the new-relic account - https://newrelic.com/signup
licenseKey: YOUR_LICENSE_KEY # The license key for your New Relic Account. This will be preferred configuration option if both licenseKey and customSecret are specified
71 changes: 21 additions & 50 deletions _examples/complete/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,6 @@ module "vpc" {
tags = local.tags
}

################################################################################
# VPC Supporting Resources
################################################################################

data "aws_security_group" "default" {
name = "default"
vpc_id = module.vpc.vpc_id
}

###############################################################################
# AWS EKS
###############################################################################
Expand Down Expand Up @@ -86,7 +77,7 @@ module "eks" {
}
tags = {
"kubernetes.io/cluster/${module.eks.cluster_name}" = "shared"
"karpenter.sh/discovery/${module.eks.cluster_name}" = "${module.eks.cluster_name}"
"karpenter.sh/discovery/${module.eks.cluster_name}" = module.eks.cluster_name
}
}

Expand All @@ -99,7 +90,6 @@ module "eks" {
min_size = 1
max_size = 2
desired_size = 1

}

application = {
Expand All @@ -111,7 +101,6 @@ module "eks" {
max_size = 1
desired_size = 0
}

}
tags = local.tags
}
Expand Down Expand Up @@ -157,26 +146,6 @@ resource "aws_iam_policy" "node_additional" {
tags = local.tags
}

data "aws_ami" "eks_default" {
most_recent = true
owners = ["amazon"]

filter {
name = "name"
values = ["amazon-eks-node-${local.cluster_version}-v*"]
}
}

data "aws_ami" "eks_default_arm" {
most_recent = true
owners = ["amazon"]

filter {
name = "name"
values = ["amazon-eks-arm64-node-${local.cluster_version}-v*"]
}
}

module "addons" {
source = "../../"

Expand All @@ -190,35 +159,36 @@ module "addons" {
aws_node_termination_handler = true
aws_efs_csi_driver = true
aws_ebs_csi_driver = true
karpenter = false
calico_tigera = false
karpenter = true
calico_tigera = true
new_relic = false
kubeclarity = true
ingress_nginx = true
fluent_bit = true

# -- Addons with mandatory variable
istio_ingress = false
istio_ingress = true
istio_manifests = var.istio_manifests
kiali_server = true
kiali_manifests = var.kiali_manifests
external_secrets = true
externalsecrets_manifests = var.externalsecrets_manifests

# -- Path of override-values.yaml file
metrics_server_helm_config = { values = ["${file("./config/override-metrics-server.yaml")}"] }
cluster_autoscaler_helm_config = { values = ["${file("./config/override-cluster-autoscaler.yaml")}"] }
karpenter_helm_config = { values = ["${file("./config/override-karpenter.yaml")}"] }
aws_load_balancer_controller_helm_config = { values = ["${file("./config/override-aws-load-balancer-controller.yaml")}"] }
aws_node_termination_handler_helm_config = { values = ["${file("./config/override-aws-node-termination-handler.yaml")}"] }
aws_efs_csi_driver_helm_config = { values = ["${file("./config/override-aws-efs-csi-driver.yaml")}"] }
aws_ebs_csi_driver_helm_config = { values = ["${file("./config/override-aws-ebs-csi-driver.yaml")}"] }
calico_tigera_helm_config = { values = ["${file("./config/calico-tigera-values.yaml")}"] }
istio_ingress_helm_config = { values = ["${file("./config/istio/override-values.yaml")}"] }
kiali_server_helm_config = { values = ["${file("./config/kiali/override-values.yaml")}"] }
external_secrets_helm_config = { values = ["${file("./config/external-secret/override-values.yaml")}"] }
ingress_nginx_helm_config = { values = ["${file("./config/override-ingress-nginx.yaml")}"] }
kubeclarity_helm_config = { values = ["${file("./config/override-kubeclarity.yaml")}"] }
fluent_bit_helm_config = { values = ["${file("./config/override-fluent-bit.yaml")}"] }
metrics_server_helm_config = { values = [file("./config/override-metrics-server.yaml")] }
cluster_autoscaler_helm_config = { values = [file("./config/override-cluster-autoscaler.yaml")] }
karpenter_helm_config = { values = [file("./config/override-karpenter.yaml")] }
aws_load_balancer_controller_helm_config = { values = [file("./config/override-aws-load-balancer-controller.yaml")] }
aws_node_termination_handler_helm_config = { values = [file("./config/override-aws-node-termination-handler.yaml")] }
aws_efs_csi_driver_helm_config = { values = [file("./config/override-aws-efs-csi-driver.yaml")] }
aws_ebs_csi_driver_helm_config = { values = [file("./config/override-aws-ebs-csi-driver.yaml")] }
calico_tigera_helm_config = { values = [file("./config/calico-tigera-values.yaml")] }
istio_ingress_helm_config = { values = [file("./config/istio/override-values.yaml")] }
kiali_server_helm_config = { values = [file("./config/kiali/override-values.yaml")] }
external_secrets_helm_config = { values = [file("./config/external-secret/override-values.yaml")] }
ingress_nginx_helm_config = { values = [file("./config/override-ingress-nginx.yaml")] }
kubeclarity_helm_config = { values = [file("./config/override-kubeclarity.yaml")] }
fluent_bit_helm_config = { values = [file("./config/override-fluent-bit.yaml")] }
new_relic_helm_config = { values = [file("./config/override-new-relic.yaml")] }

# -- Override Helm Release attributes
metrics_server_extra_configs = var.metrics_server_extra_configs
Expand All @@ -235,6 +205,7 @@ module "addons" {
ingress_nginx_extra_configs = var.ingress_nginx_extra_configs
kubeclarity_extra_configs = var.kubeclarity_extra_configs
fluent_bit_extra_configs = var.fluent_bit_extra_configs
new_relic_extra_configs = var.new_relic_extra_configs

# -- Custom IAM Policy Json Content or Json file path
cluster_autoscaler_iampolicy_json_content = file("./custom-iam-policies/cluster-autoscaler.json")
Expand Down
7 changes: 3 additions & 4 deletions _examples/complete/providers.tf
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,21 @@ provider "aws" {
provider "kubernetes" {
host = module.eks.cluster_endpoint
cluster_ca_certificate = base64decode(module.eks.cluster_certificate_authority_data)
token = join("", data.aws_eks_cluster_auth.eks_cluster.*.token)
token = data.aws_eks_cluster_auth.eks_cluster.token
}

provider "helm" {
kubernetes {
host = module.eks.cluster_endpoint
cluster_ca_certificate = base64decode(module.eks.cluster_certificate_authority_data)
token = join("", data.aws_eks_cluster_auth.eks_cluster.*.token)
token = data.aws_eks_cluster_auth.eks_cluster.token
}
}

provider "kubectl" {
host = module.eks.cluster_endpoint
cluster_ca_certificate = base64decode(module.eks.cluster_certificate_authority_data)
token = join("", data.aws_eks_cluster_auth.eks_cluster.*.token)
token = data.aws_eks_cluster_auth.eks_cluster.token
}

# ------------------------------------------------------------------------------
Expand All @@ -37,5 +37,4 @@ data "aws_eks_cluster" "eks_cluster" {
name = module.eks.cluster_name
depends_on = [module.eks.cluster_id]
}
data "aws_caller_identity" "current" {}
data "aws_availability_zones" "available" {}
37 changes: 5 additions & 32 deletions _examples/complete/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,6 @@
# Variables
# ------------------------------------------------------------------------------

variable "region" {
type = string
default = "us-east-1"
description = "Region Code"
}

variable "cluster_endpoint_public_access" {
type = bool
default = true
}

variable "cluster_endpoint_private_access" {
type = bool
default = true
}

variable "iam_role_use_name_prefix" {
type = string
default = "terraform-helm-eks-addons"
}

variable "token" {
type = string
default = "test-addon-efs"
}

# ------------------ ISTIO INGRESS ---------------------------------------------
variable "istio_manifests" {
type = object({
Expand All @@ -41,12 +15,6 @@ variable "istio_manifests" {
}

#-----------KAILI DASHBOARD-----------------------------------------------------
variable "kiali_server_helm_config" {
description = "Kiali Server Helm Chart config"
type = any
default = null
}

variable "kiali_manifests" {
type = object({
kiali_virtualservice_file_path = string
Expand Down Expand Up @@ -146,4 +114,9 @@ variable "fluent_bit_extra_configs" {
atomic = true
timeout = 300
}
}

variable "new_relic_extra_configs" {
type = any
default = {}
}
Loading

0 comments on commit 8b9ff0f

Please sign in to comment.