Skip to content

Commit

Permalink
m
Browse files Browse the repository at this point in the history
  • Loading branch information
mitalipaygude committed May 28, 2024
1 parent 32b6322 commit eeb3842
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 6 deletions.
8 changes: 4 additions & 4 deletions pkg/providers/tinkerbell/config/template-cp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -253,10 +253,10 @@ spec:
files:
{{- if .kubeletConfiguration }}
- content: |
{{ .kubeletConfiguration | indent 10}}
owner: root:root
permissions: "0644"
path: /etc/kubernetes/patches/kubeletconfiguration0+strategic.yaml
{{ .kubeletConfiguration | indent 10 }}
owner: root:root
permissions: "0644"
path: /etc/kubernetes/patches/kubeletconfiguration0+strategic.yaml
{{- end }}
{{- if not .cpSkipLoadBalancerDeployment }}
- content: |
Expand Down
2 changes: 1 addition & 1 deletion pkg/providers/tinkerbell/config/template-md.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ spec:
files:
{{- end }}
{{- if .kubeletConfiguration }}
- content: |
- content: |
{{ .kubeletConfiguration | indent 10 }}
owner: root:root
permissions: "0644"
Expand Down
38 changes: 37 additions & 1 deletion pkg/providers/tinkerbell/template_test.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
package tinkerbell

import (
"testing"
"time"

. "github.com/onsi/gomega"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"

"github.com/aws/eks-anywhere/internal/test"
"github.com/aws/eks-anywhere/pkg/api/v1alpha1"
Expand Down Expand Up @@ -195,3 +196,38 @@ func TestTemplateBuilder(t *testing.T) {

}
}

func TestTemplateBuilderCPKubeletConfig(t *testing.T) {
for _, tc := range []struct {
Input string
Output string
}{
{
Input: "testdata/cluster_tinkerbell_api_server_cert_san_ip.yaml",
Output: "testdata/expected_cluster_tinkerbell_api_server_cert_san_ip.yaml",
},
} {
g := NewWithT(t)
clusterSpec := test.NewFullClusterSpec(t, tc.Input)

cpMachineCfg, _ := getControlPlaneMachineSpec(clusterSpec)
wngMachineCfgs, _ := getWorkerNodeGroupMachineSpec(clusterSpec)

tinkIPBefore := "0.0.0.0"
bldr := NewTemplateBuilder(&clusterSpec.TinkerbellDatacenter.Spec, cpMachineCfg, nil, wngMachineCfgs, tinkIPBefore, time.Now)

clusterSpec.Cluster.Spec.ControlPlaneConfiguration.KubeletConfiguration = &unstructured.Unstructured{
Object: map[string]interface{}{
"maxPods": 20,
"apiVersion": "kubelet.config.k8s.io/v1beta1",
"kind": "KubeletConfiguration",
},
}

data, err := bldr.GenerateCAPISpecControlPlane(clusterSpec)
g.Expect(err).ToNot(HaveOccurred())

g.Expect(data).To(ContainSubstring("maxPods"))

}
}

0 comments on commit eeb3842

Please sign in to comment.