@@ -21,7 +21,6 @@ import (
2121 "github.com/awslabs/kit/substrate/pkg/apis/v1alpha1"
2222 "github.com/awslabs/kit/substrate/pkg/controller/substrate/cluster"
2323 "github.com/awslabs/kit/substrate/pkg/utils/discovery"
24- "github.com/awslabs/kit/substrate/pkg/utils/json"
2524 "go.uber.org/multierr"
2625 "helm.sh/helm/v3/pkg/action"
2726 "helm.sh/helm/v3/pkg/chart/loader"
@@ -35,65 +34,33 @@ import (
3534type HelmCharts struct {
3635}
3736
37+ const (
38+ kitOperatorChart = "https://github.com/awslabs/kubernetes-iteration-toolkit/releases/download/kit-operator-0.0.5/kit-operator-0.0.5.tgz"
39+ karpenterChart = "https://charts.karpenter.sh/karpenter-0.5.5.tgz"
40+ awsVPCCNIChart = "https://aws.github.io/eks-charts/aws-vpc-cni-1.1.13.tgz"
41+ awsEBSCSIDriverChart = "https://github.com/kubernetes-sigs/aws-ebs-csi-driver/releases/download/helm-chart-aws-ebs-csi-driver-2.6.3/aws-ebs-csi-driver-2.6.3.tgz"
42+ awsLBControllerChart = "https://aws.github.io/eks-charts/aws-load-balancer-controller-1.4.0.tgz"
43+ )
44+
3845type chart struct {
39- namespace string
40- name string
41- location string
42- values json.Value
46+ location , namespace , name string
47+ values map [string ]interface {}
4348}
4449
4550func (h * HelmCharts ) Create (ctx context.Context , substrate * v1alpha1.Substrate ) (reconcile.Result , error ) {
4651 if ! substrate .IsReady () {
4752 return reconcile.Result {Requeue : true }, nil
4853 }
4954 charts := []* chart {
50- {
51- namespace : "kube-system" ,
52- name : "aws-vpc-cni" ,
53- location : "https://aws.github.io/eks-charts/aws-vpc-cni-1.1.13.tgz" ,
54- },
55- {
56- namespace : "kit" ,
57- name : "kit-operator" ,
58- location : "https://github.com/awslabs/kubernetes-iteration-toolkit/releases/download/kit-operator-0.0.5/kit-operator-0.0.5.tgz" ,
59- },
60- {
61- namespace : "karpenter" ,
62- name : "karpenter" ,
63- location : "https://charts.karpenter.sh/karpenter-0.5.5.tgz" ,
64- values : json.Value {
65- "controller" : json.Value {
66- "clusterName" : substrate .Name , "clusterEndpoint" : fmt .Sprintf ("https://%s:8443" , * substrate .Status .Cluster .Address ),
67- "resources" : json.Value {
68- "requests" : json.Value {
69- "cpu" : "100m" ,
70- },
71- },
72- },
73- "aws" : json.Value {
74- "defaultInstanceProfile" : discovery .Name (substrate , cluster .TenantControlPlaneNodeRole ),
75- },
76- },
77- },
78- {
79- namespace : "kube-system" ,
80- name : "aws-ebs-csi-driver" ,
81- location : "https://github.com/kubernetes-sigs/aws-ebs-csi-driver/releases/download/helm-chart-aws-ebs-csi-driver-2.6.3/aws-ebs-csi-driver-2.6.3.tgz" ,
82- values : json.Value {
83- "controller" : json.Value {
84- "replicaCount" : "1" ,
85- },
86- },
87- },
88- {
89- namespace : "kube-system" ,
90- name : "aws-load-balancer-controller" ,
91- location : "https://aws.github.io/eks-charts/aws-load-balancer-controller-1.4.0.tgz" ,
92- values : json.Value {
93- "clusterName" : substrate .Name ,
94- "replicaCount" : "1" ,
95- },
96- },
55+ {awsVPCCNIChart , "kube-system" , "aws-vpc-cni" , nil },
56+ {kitOperatorChart , "kit" , "kit-operator" , nil },
57+ {karpenterChart , "karpenter" , "karpenter" , map [string ]interface {}{
58+ "controller" : map [string ]interface {}{
59+ "clusterName" : substrate .Name , "clusterEndpoint" : fmt .Sprintf ("https://%s:8443" , * substrate .Status .Cluster .Address ),
60+ "resources" : map [string ]interface {}{"requests" : map [string ]interface {}{"cpu" : "100m" }}},
61+ "aws" : map [string ]interface {}{"defaultInstanceProfile" : discovery .Name (substrate , cluster .TenantControlPlaneNodeRole )}}},
62+ {awsEBSCSIDriverChart , "kube-system" , "aws-ebs-csi-driver" , map [string ]interface {}{"controller" : map [string ]interface {}{"replicaCount" : "1" }}},
63+ {awsLBControllerChart , "kube-system" , "aws-load-balancer-controller" , map [string ]interface {}{"clusterName" : substrate .Name , "replicaCount" : "1" }},
9764 }
9865 errs := make ([]error , len (charts ))
9966 workqueue .ParallelizeUntil (ctx , len (charts ), len (charts ), func (i int ) {
0 commit comments