Skip to content

Commit

Permalink
update operator naemspace for not plural
Browse files Browse the repository at this point in the history
  • Loading branch information
morga471 committed Feb 27, 2025
1 parent 255c177 commit c0f2741
Show file tree
Hide file tree
Showing 5 changed files with 112 additions and 81 deletions.
70 changes: 0 additions & 70 deletions .github/workflows/release.yml

This file was deleted.

101 changes: 101 additions & 0 deletions .github/workflows/terragrunt-cicd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
name: 'Terraform Module CI'

on:
push:
branches:
- main
paths:
- '**/*.hcl'
- '**/*.tf'
pull_request:
branches:
- main
paths:
- '**/*.hcl'
- '**/*.tf'

permissions:
contents: read
pull-requests: write

jobs:
validate:
name: 'Validate Module'
runs-on: self-hosted

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup Terraform
uses: hashicorp/setup-terraform@v2
with:
terraform_version: 1.5.0

- name: Terraform Init
run: |
terraform init -backend=false
- name: Terraform Format
run: |
terraform fmt -check
- name: Terraform Validate
run: |
terraform validate
- name: Run tflint
uses: terraform-linters/setup-tflint@v3
if: github.event_name == 'pull_request'

- name: Lint Terraform
if: github.event_name == 'pull_request'
run: |
tflint --format compact
release:
name: 'Create Release'
needs: validate
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
runs-on: self-hosted
permissions:
contents: write

steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}

- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.9'

- name: Install Commitizen
run: |
pip install commitizen
- name: Configure Git
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
- name: Bump Version and Generate Changelog
id: cz
run: |
cz bump --yes
echo "new_version=$(cz version --project)" >> $GITHUB_OUTPUT
echo "changelog=$(cz changelog --dry-run)" >> $GITHUB_OUTPUT
- name: Create Release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ steps.cz.outputs.new_version }}
release_name: Release v${{ steps.cz.outputs.new_version }}
draft: false
prerelease: false
body: ${{ steps.cz.outputs.changelog }}
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,9 @@ EOF

| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | 5.87.0 |
| <a name="provider_aws"></a> [aws](#provider\_aws) | 5.88.0 |
| <a name="provider_helm"></a> [helm](#provider\_helm) | 2.17.0 |
| <a name="provider_kubernetes"></a> [kubernetes](#provider\_kubernetes) | 2.35.1 |
| <a name="provider_kubernetes"></a> [kubernetes](#provider\_kubernetes) | 2.36.0 |

## Modules

Expand All @@ -138,7 +138,7 @@ EOF
| Name | Type |
|------|------|
| [helm_release.console_access](https://registry.terraform.io/providers/hashicorp/helm/latest/docs/resources/release) | resource |
| [kubernetes_namespace.operators](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/namespace) | resource |
| [kubernetes_namespace.operator](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/namespace) | resource |
| [kubernetes_network_policy.operators_default](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/network_policy) | resource |
| [kubernetes_storage_class.ebs_encrypted](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/storage_class) | resource |
| [kubernetes_storage_class.efs_sc](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/storage_class) | resource |
Expand Down Expand Up @@ -170,8 +170,8 @@ EOF
| <a name="output_module_name"></a> [module\_name](#output\_module\_name) | The name of this module. |
| <a name="output_module_version"></a> [module\_version](#output\_module\_version) | The version of this module. |
| <a name="output_network_policies"></a> [network\_policies](#output\_network\_policies) | Map of network policies applied to namespaces |
| <a name="output_operators_namespace"></a> [operators\_namespace](#output\_operators\_namespace) | The namespace for the operators. |
| <a name="output_operators_namespace_labels"></a> [operators\_namespace\_labels](#output\_operators\_namespace\_labels) | Labels applied to the operators namespace |
| <a name="output_operator_namespace"></a> [operator\_namespace](#output\_operator\_namespace) | The namespace for the operators. |
| <a name="output_operator_namespace_labels"></a> [operator\_namespace\_labels](#output\_operator\_namespace\_labels) | Labels applied to the operators namespace |
| <a name="output_rwo_storage_class"></a> [rwo\_storage\_class](#output\_rwo\_storage\_class) | Kubernetes storage class that supports read/write once. |
| <a name="output_rwx_storage_class"></a> [rwx\_storage\_class](#output\_rwx\_storage\_class) | Kubernetes storage class that supports read/write many. |
| <a name="output_storage_classes"></a> [storage\_classes](#output\_storage\_classes) | Map of all storage class names and their configurations |
Expand Down
4 changes: 2 additions & 2 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ resource "kubernetes_storage_class" "efs_sc" {
mount_options = ["tls"]
}

resource "kubernetes_namespace" "operators" {
resource "kubernetes_namespace" "operator" {
metadata {
name = var.operators_ns
labels = {
Expand All @@ -96,7 +96,7 @@ resource "kubernetes_namespace" "operators" {
resource "kubernetes_network_policy" "operators_default" {
metadata {
name = "default-deny"
namespace = kubernetes_namespace.operators.metadata[0].name
namespace = kubernetes_namespace.operator.metadata[0].name
}

spec {
Expand Down
8 changes: 4 additions & 4 deletions outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,14 @@ output "efs_dns_name" {
# Operators
################################################################################

output "operators_namespace" {
output "operator_namespace" {
description = "The namespace for the operators."
value = kubernetes_namespace.operators.metadata[0].name
value = kubernetes_namespace.operator.metadata[0].name
}

output "operators_namespace_labels" {
output "operator_namespace_labels" {
description = "Labels applied to the operators namespace"
value = kubernetes_namespace.operators.metadata[0].labels
value = kubernetes_namespace.operator.metadata[0].labels
}

################################################################################
Expand Down

0 comments on commit c0f2741

Please sign in to comment.