From 42278fc0f2a77a1c9f0cfeefde7040b7e791d16c Mon Sep 17 00:00:00 2001
From: Utkarsh Mishra <utkarshmishra@tataelxsi.co.in>
Date: Mon, 18 Dec 2023 05:17:35 +0000
Subject: [PATCH] Pushing modified helm charts for crossplane AWS tested in AWS
 env, please review

---
 .../templates/eks-cluster/eks-cluster.yaml    |  2 +-
 .../templates/eks-cluster/node-group.yaml     |  5 ++---
 .../templates/network/gateways.yaml           | 21 +++++++++----------
 .../templates/network/route-tables.yaml       |  8 +++----
 .../templates/network/subnet.yaml             | 10 ++++-----
 .../crossplane-aws/templates/network/vpc.yaml |  8 +++----
 .../helm-chart-v3s/supercluster/values.yaml   |  9 ++++----
 7 files changed, 30 insertions(+), 33 deletions(-)

diff --git a/poc-osm-ltv/cluster_knf/helm-chart-v3s/supercluster/charts/crossplane-aws/templates/eks-cluster/eks-cluster.yaml b/poc-osm-ltv/cluster_knf/helm-chart-v3s/supercluster/charts/crossplane-aws/templates/eks-cluster/eks-cluster.yaml
index 1991447..f525f56 100644
--- a/poc-osm-ltv/cluster_knf/helm-chart-v3s/supercluster/charts/crossplane-aws/templates/eks-cluster/eks-cluster.yaml
+++ b/poc-osm-ltv/cluster_knf/helm-chart-v3s/supercluster/charts/crossplane-aws/templates/eks-cluster/eks-cluster.yaml
@@ -28,4 +28,4 @@ spec:
           access: private
   writeConnectionSecretToRef:
     name: kubeconfig-{{ .Release.Name }}
-    namespace: managed-resources
+    namespace: crossplane-system
diff --git a/poc-osm-ltv/cluster_knf/helm-chart-v3s/supercluster/charts/crossplane-aws/templates/eks-cluster/node-group.yaml b/poc-osm-ltv/cluster_knf/helm-chart-v3s/supercluster/charts/crossplane-aws/templates/eks-cluster/node-group.yaml
index be2935e..1926586 100644
--- a/poc-osm-ltv/cluster_knf/helm-chart-v3s/supercluster/charts/crossplane-aws/templates/eks-cluster/node-group.yaml
+++ b/poc-osm-ltv/cluster_knf/helm-chart-v3s/supercluster/charts/crossplane-aws/templates/eks-cluster/node-group.yaml
@@ -1,7 +1,8 @@
+---
 apiVersion: eks.aws.crossplane.io/v1alpha1
 kind: NodeGroup
 metadata:
-  name: nodegroup-{{ .Release.Name }}
+  name: nodegroup-{{ .Release.Name }}-{{ .Values.global.resource_group }}
   labels:
     provider: aws
     cluster: eks
@@ -31,7 +32,5 @@ spec:
     diskSize: 30
     instanceTypes:
       - {{ .Values.global.node_size }}
-    # remoteAccess: 
-    #   ec2SSHKey: {{ .Values.sshkey }}
     tags:
       Name: {{ .Chart.Name }}
\ No newline at end of file
diff --git a/poc-osm-ltv/cluster_knf/helm-chart-v3s/supercluster/charts/crossplane-aws/templates/network/gateways.yaml b/poc-osm-ltv/cluster_knf/helm-chart-v3s/supercluster/charts/crossplane-aws/templates/network/gateways.yaml
index 13b24e1..a949a44 100644
--- a/poc-osm-ltv/cluster_knf/helm-chart-v3s/supercluster/charts/crossplane-aws/templates/network/gateways.yaml
+++ b/poc-osm-ltv/cluster_knf/helm-chart-v3s/supercluster/charts/crossplane-aws/templates/network/gateways.yaml
@@ -2,7 +2,7 @@
 apiVersion: ec2.aws.crossplane.io/v1beta1
 kind: InternetGateway
 metadata:
-  name: {{ .Chart.Name }}
+  name: {{ .Release.Name }}-igw
   labels:
     provider: aws
     cluster: eks
@@ -10,7 +10,7 @@ metadata:
     type: igw
 spec:
   forProvider:
-    region: {{ .Values.region }}
+    region: {{ .Values.global.cluster_location }}
     vpcIdSelector:
       matchLabels:
         provider: aws
@@ -18,14 +18,13 @@ spec:
         chart: {{ .Chart.Name }}
     tags:
       - key: Name
-        value: "crossplane-igw"
+        value: {{ .Release.Name }}-igw
 
 ---
-
 apiVersion: ec2.aws.crossplane.io/v1beta1
 kind: Address
 metadata:
-  name: {{ .Chart.Name }}
+  name: {{ .Release.Name }}-eip
   labels:
     provider: aws
     cluster: eks
@@ -33,17 +32,17 @@ metadata:
     type: eip
 spec:
   forProvider:
-    region: {{ .Values.region }}
+    region: {{ .Values.global.cluster_location }}
     domain: vpc
     tags:
     - key: Name
-      value: crossplane-eip
+      value: {{ .Release.Name }}-eip
 
 ---
 apiVersion: ec2.aws.crossplane.io/v1beta1
 kind: NATGateway
 metadata:
-  name: {{ .Chart.Name }}
+  name: {{ .Release.Name }}-natgw
   labels:
     provider: aws
     cluster: eks
@@ -51,7 +50,7 @@ metadata:
     type: natgw
 spec:
   forProvider:
-    region: {{ .Values.region }}
+    region: {{ .Values.global.cluster_location }}
     connectivityType: public
     allocationIdSelector:
         matchLabels:
@@ -65,8 +64,8 @@ spec:
         provider: aws
         cluster: eks
         chart: {{ $root.Chart.Name }}
-        zone: {{ $root.Values.region }}a
+        zone: {{ $root.Values.global.cluster_location }}a
         access: public
     tags:
     - key: Name
-      value: nat-gateway
\ No newline at end of file
+      value: {{ .Release.Name }}-natgw
\ No newline at end of file
diff --git a/poc-osm-ltv/cluster_knf/helm-chart-v3s/supercluster/charts/crossplane-aws/templates/network/route-tables.yaml b/poc-osm-ltv/cluster_knf/helm-chart-v3s/supercluster/charts/crossplane-aws/templates/network/route-tables.yaml
index 5d4bb0f..e35ab4b 100644
--- a/poc-osm-ltv/cluster_knf/helm-chart-v3s/supercluster/charts/crossplane-aws/templates/network/route-tables.yaml
+++ b/poc-osm-ltv/cluster_knf/helm-chart-v3s/supercluster/charts/crossplane-aws/templates/network/route-tables.yaml
@@ -3,14 +3,14 @@
 apiVersion: ec2.aws.crossplane.io/v1beta1
 kind: RouteTable
 metadata:
-  name: {{ .name }}-route-table
+  name: {{ $root.Release.Name }}-{{ .name }}-route-table
   labels:
     provider: aws
     cluster: eks
     chart: {{ $root.Chart.Name }}
 spec:
   forProvider:
-    region: "ap-south-1"
+    region: {{ $root.Values.global.cluster_location }}
     vpcIdSelector:
       matchLabels:
         provider: aws
@@ -44,11 +44,11 @@ spec:
             chart: {{ $root.Chart.Name }}
             type: subnet
             access: {{ $zone.access }}
-            zone: {{ $root.Values.region }}{{ $zone.zone }}
+            zone: {{ $root.Values.global.cluster_location }}{{ $zone.zone }}
       {{- end }}
       {{- end }}
     tags:
       - key: Name
-        value: "crossplane-{{ .name }}route-table"
+        value: "{{ $root.Release.Name }}-{{ .name }}-route-table"
 ---
 {{- end }}
diff --git a/poc-osm-ltv/cluster_knf/helm-chart-v3s/supercluster/charts/crossplane-aws/templates/network/subnet.yaml b/poc-osm-ltv/cluster_knf/helm-chart-v3s/supercluster/charts/crossplane-aws/templates/network/subnet.yaml
index 1ae3e15..06182ba 100644
--- a/poc-osm-ltv/cluster_knf/helm-chart-v3s/supercluster/charts/crossplane-aws/templates/network/subnet.yaml
+++ b/poc-osm-ltv/cluster_knf/helm-chart-v3s/supercluster/charts/crossplane-aws/templates/network/subnet.yaml
@@ -4,18 +4,18 @@
 apiVersion: ec2.aws.crossplane.io/v1beta1
 kind: Subnet
 metadata:
-  name: {{ $root.Chart.Name }}-{{ .access }}-subnet-{{ $root.Values.region }}{{ .zone }}
+  name: {{ $root.Release.Name }}-{{ .access }}-subnet-{{ $root.Values.global.cluster_location }}{{ .zone }}
   labels:
     type: subnet
     provider: aws
     cluster: eks
     chart: {{ $root.Chart.Name }}
-    zone: {{ $root.Values.region }}{{ .zone }}
+    zone: {{ $root.Values.global.cluster_location }}{{ .zone }}
     access: {{ .access }}
 spec:
   forProvider:
-    region: {{ $root.Values.region }}
-    availabilityZone: {{ $root.Values.region }}{{ .zone }}
+    region: {{ $root.Values.global.cluster_location }}
+    availabilityZone: {{ $root.Values.global.cluster_location }}{{ .zone }}
     cidrBlock: {{ .cidr }}
     vpcIdSelector:
       matchLabels:
@@ -27,7 +27,7 @@ spec:
     - key: kubernetes.io/role/elb
       value: "1"
     - key: Name
-      value: "crossplane-{{ .access }}-subnet-{{ $root.Values.region }}{{ .zone }}"
+      value: "{{ $root.Release.Name }}-{{ .access }}-subnet-{{ $root.Values.global.cluster_location }}{{ .zone }}"
     {{- if eq .access "private" }}
     - key: "kubernetes.io/cluster/{{ $root.Chart.Name }}"
       value: "shared"
diff --git a/poc-osm-ltv/cluster_knf/helm-chart-v3s/supercluster/charts/crossplane-aws/templates/network/vpc.yaml b/poc-osm-ltv/cluster_knf/helm-chart-v3s/supercluster/charts/crossplane-aws/templates/network/vpc.yaml
index 4006491..8add019 100644
--- a/poc-osm-ltv/cluster_knf/helm-chart-v3s/supercluster/charts/crossplane-aws/templates/network/vpc.yaml
+++ b/poc-osm-ltv/cluster_knf/helm-chart-v3s/supercluster/charts/crossplane-aws/templates/network/vpc.yaml
@@ -1,19 +1,19 @@
 {{- $root := . -}}
-
+---
 apiVersion: ec2.aws.crossplane.io/v1beta1
 kind: VPC
 metadata:
-  name: {{ $root.Chart.Name }}
+  name: {{ .Release.Name }}-vpc
   labels:
     provider: aws
     cluster: eks
     chart: {{ .Chart.Name }}
 spec:
   forProvider:
-    region: {{ .Values.region }}
+    region: {{ .Values.global.cluster_location }}
     cidrBlock: 10.10.0.0/16
     enableDnsHostNames: true
     enableDnsSupport: true
     tags:
       - key: Name
-        value: crossplane-vpc
+        value: {{ $root.Release.Name }}-vpc
diff --git a/poc-osm-ltv/cluster_knf/helm-chart-v3s/supercluster/values.yaml b/poc-osm-ltv/cluster_knf/helm-chart-v3s/supercluster/values.yaml
index 65a55c9..6172d74 100644
--- a/poc-osm-ltv/cluster_knf/helm-chart-v3s/supercluster/values.yaml
+++ b/poc-osm-ltv/cluster_knf/helm-chart-v3s/supercluster/values.yaml
@@ -4,10 +4,10 @@
 
 global:
   node_count: 1
-  # k8s_version: "1.25" # Optional
-  node_size: Standard_D2_v2
-  cluster_location: West Europe
-  resource_group: CloudNative-InfraMgmt-CTIO
+  k8s_version: "1.28" # Optional
+  node_size: t3.medium
+  cluster_location: ap-south-1
+  resource_group: CloudNative-InfraMgmt
 
 crossplane-aws:
   enabled: false
@@ -20,4 +20,3 @@ crossplane-gcp:
 
 openstack-capi-cluster:
   enabled: false
-
-- 
GitLab