Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add CiliumEniModeClusterBuilder #12

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Added

- Add `CiliumEniModeClusterBuilder`

## [1.0.2] - 2024-04-29

### Added
Expand Down
47 changes: 47 additions & 0 deletions pkg/clusterbuilder/providers/capa/eni_mode_cluster.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
package capa

import (
_ "embed"

"github.com/giantswarm/clustertest/pkg/application"
"github.com/giantswarm/clustertest/pkg/organization"
"github.com/giantswarm/clustertest/pkg/utils"

"github.com/giantswarm/cluster-standup-teardown/pkg/values"
)

var (
//go:embed values/cilium-eni-mode-cluster_values.yaml
baseCiliumEniModeClusterValues string
//go:embed values/cilium-eni-mode-default-apps_values.yaml
baseCiliumEniModeDefaultAppsValues string
)

// CiliumEniModeClusterBuilder is the CAPA ClusterBuilder for Cilium ENI mode
type CiliumEniModeClusterBuilder struct{}

// NewClusterApp builds a new CAPA cluster App for Cilium ENI mode
func (c *CiliumEniModeClusterBuilder) NewClusterApp(clusterName string, orgName string, clusterValuesOverrides []string, defaultAppsValuesOverrides []string) *application.Cluster {
if clusterName == "" {
clusterName = utils.GenerateRandomName("t")
}
if orgName == "" {
orgName = utils.GenerateRandomName("t")
}

return application.NewClusterApp(clusterName, application.ProviderAWS).
WithOrg(organization.New(orgName)).
WithAppValues(
values.MustMergeValues(append([]string{baseCiliumEniModeClusterValues}, clusterValuesOverrides...)...),
values.MustMergeValues(append([]string{baseCiliumEniModeDefaultAppsValues}, defaultAppsValuesOverrides...)...),
&application.TemplateValues{
ClusterName: clusterName,
Organization: orgName,
},
)
}

// KubeContext returns the known KubeConfig context that this builder expects
func (c *CiliumEniModeClusterBuilder) KubeContext() string {
return "capa"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
global:
metadata:
name: "{{ .ClusterName }}"
description: "E2E Test cluster"
organization: "{{ .Organization }}"

connectivity:
# These two settings enable Cilium ENI mode
network:
pods:
cidrBlocks:
- 10.1.0.0/16
cilium:
ipamMode: eni

controlPlane:
containerdVolumeSizeGB: 15
etcdVolumeSizeGB: 50
kubeletVolumeSizeGB: 10
rootVolumeSizeGB: 10

# We need to pass the node pools otherwise the test called "has all the worker nodes running" will fail because it
# expects to find the number of worker nodes in the helm values, but the value is not there if don't pass it, as it's
# defaulted in the chart template.
# @TODO: https://github.com/giantswarm/giantswarm/issues/28063
nodePools:
# We are using a name with 10 chars which is the max number of characters allowed by our kyverno policies.
nodepool-0:
maxSize: 5
minSize: 2
rootVolumeSizeGB: 25
spotInstances:
enabled: true
maxPrice: 0.2960
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
clusterName: "{{ .ClusterName }}"
organization: "{{ .Organization }}"

userConfig:
# We want to have external-dns watch for new ingress resources to speed up the DNS creation
externalDns:
configMap:
values:
triggerLoopOnEvent: true