Skip to content

Commit 9dea811

Browse files
authored
Revert "Refactored chart implementation for readability (#141)" (#146)
This reverts commit 6f13993.
1 parent 3faecdc commit 9dea811

File tree

3 files changed

+22
-55
lines changed

3 files changed

+22
-55
lines changed

substrate/demo/apply.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ clusterctl init --infrastructure aws --kubeconfig bootstrap.kubeconfig
1212
# Create Cluster
1313
kubectl apply --kubeconfig bootstrap.kubeconfig -f ./substrate.yaml
1414
kubectl get cluster substrate -w --kubeconfig bootstrap.kubeconfig
15-
clusterctl get kubeconfig substrate --kubeconfig bootstrap.kubeconfig >substrate.kubeconfig
16-
kubectl apply -f https://docs.projectcalico.org/v3.21/manifests/calico.yaml --kubeconfig substrate.kubeconfig
1715

1816
# Pivot Cluster
17+
clusterctl get kubeconfig substrate --kubeconfig bootstrap.kubeconfig >substrate.kubeconfig
18+
kubectl apply -f https://docs.projectcalico.org/v3.21/manifests/calico.yaml --kubeconfig substrate.kubeconfig
1919
clusterctl init --infrastructure aws --kubeconfig substrate.kubeconfig
2020
clusterctl move --kubeconfig bootstrap.kubeconfig --to-kubeconfig substrate.kubeconfig

substrate/demo/delete.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22

33
# Delete Cluster
44
clusterctl move --kubeconfig ./substrate.kubeconfig --to-kubeconfig ./bootstrap.kubeconfig
5-
kubectl delete --kubeconfig bootstrap.kubeconfig -f ./substrate.yaml || true
5+
kubectl delete --kubeconfig bootstrap.kubeconfig -f ./substrate.yaml
66
kind delete cluster --name bootstrap

substrate/pkg/controller/substrate/cluster/addons/operators.go

+19-52
Original file line numberDiff line numberDiff line change
@@ -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 (
3534
type 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+
3845
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{}
4348
}
4449

4550
func (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

Comments
 (0)