Skip to content

Commit

Permalink
Add helm values
Browse files Browse the repository at this point in the history
  • Loading branch information
jknipper committed Feb 15, 2024
1 parent 3a502fc commit 514a82a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
8 changes: 4 additions & 4 deletions pkg/controller/ground.go
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ func (op *GroundControl) handler(key string) error {
if err != nil {
return err
}
err = op.reconcileSeed(kluster, projectClient, helmValues)
err = op.reconcileSeed(kluster, projectClient, helmValues, klusterSecret)
if err != nil {
return err
}
Expand Down Expand Up @@ -345,7 +345,7 @@ func (op *GroundControl) handler(key string) error {
if err != nil {
return err
}
if err := op.reconcileSeed(kluster, projectClient, helmValues); err != nil {
if err := op.reconcileSeed(kluster, projectClient, helmValues, klusterSecret); err != nil {
op.Logger.Log(
"msg", "Failed seed reconciliation",
"kluster", kluster.GetName(),
Expand Down Expand Up @@ -475,7 +475,7 @@ func (op *GroundControl) handler(key string) error {
return nil
}

func (op *GroundControl) reconcileSeed(kluster *v1.Kluster, projectClient project.ProjectClient, helmValues map[string]interface{}) error {
func (op *GroundControl) reconcileSeed(kluster *v1.Kluster, projectClient project.ProjectClient, helmValues map[string]interface{}, secret *v1.Secret) error {
isNetErr := func(err error) bool {
current := err
for current != nil {
Expand All @@ -489,7 +489,7 @@ func (op *GroundControl) reconcileSeed(kluster *v1.Kluster, projectClient projec
}

seedReconciler := ground.NewSeedReconciler(&op.Clients, kluster, op.Logger)
if err := seedReconciler.EnrichHelmValuesForSeed(projectClient, helmValues, kluster.Spec.CustomCNI, kluster.Spec.SeedKubeadm); err != nil {
if err := seedReconciler.EnrichHelmValuesForSeed(projectClient, helmValues, kluster, secret); err != nil {
if !isNetErr(err) {
metrics.SeedReconciliationFailuresTotal.With(prometheus.Labels{"kluster_name": kluster.Spec.Name}).Inc()
}
Expand Down
10 changes: 7 additions & 3 deletions pkg/controller/ground/reconciler.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"bytes"
"context"
"fmt"
"strings"
"time"

jsonpatch "github.com/evanphx/json-patch"
Expand Down Expand Up @@ -62,7 +63,7 @@ type SeedReconciler struct {
Logger log.Logger
}

func (sr *SeedReconciler) EnrichHelmValuesForSeed(client project.ProjectClient, values map[string]interface{}, customCNI, seedKubeadm bool) error {
func (sr *SeedReconciler) EnrichHelmValuesForSeed(client project.ProjectClient, values map[string]interface{}, kluster *v1.Kluster, secret *v1.Secret) error {
metadata, err := client.GetMetadata()
if err != nil {
return err
Expand Down Expand Up @@ -95,8 +96,11 @@ func (sr *SeedReconciler) EnrichHelmValuesForSeed(client project.ProjectClient,
"domain": sr.Kluster.Spec.DNSDomain,
"kube": isKubeDns,
}
values["customCNI"] = customCNI
values["seedKubeadm"] = seedKubeadm
values["customCNI"] = kluster.Spec.CustomCNI
values["seedKubeadm"] = kluster.Spec.SeedKubeadm
idx := strings.LastIndex(kluster.Spec.Name, "-")
values["shortName"] = kluster.Spec.Name[:idx]
values["tlsCaCert"] = secret.TLSCACertificate
return nil
}

Expand Down

0 comments on commit 514a82a

Please sign in to comment.