@@ -21,7 +21,6 @@ import (
21
21
"github.com/awslabs/kit/substrate/pkg/apis/v1alpha1"
22
22
"github.com/awslabs/kit/substrate/pkg/controller/substrate/cluster"
23
23
"github.com/awslabs/kit/substrate/pkg/utils/discovery"
24
- "github.com/awslabs/kit/substrate/pkg/utils/json"
25
24
"go.uber.org/multierr"
26
25
"helm.sh/helm/v3/pkg/action"
27
26
"helm.sh/helm/v3/pkg/chart/loader"
@@ -35,65 +34,33 @@ import (
35
34
type HelmCharts struct {
36
35
}
37
36
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
+
38
45
type 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 {}
43
48
}
44
49
45
50
func (h * HelmCharts ) Create (ctx context.Context , substrate * v1alpha1.Substrate ) (reconcile.Result , error ) {
46
51
if ! substrate .IsReady () {
47
52
return reconcile.Result {Requeue : true }, nil
48
53
}
49
54
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" }},
97
64
}
98
65
errs := make ([]error , len (charts ))
99
66
workqueue .ParallelizeUntil (ctx , len (charts ), len (charts ), func (i int ) {
0 commit comments