Skip to content
Merged
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
5 changes: 4 additions & 1 deletion fleetconfig-controller/api/v1alpha1/validation.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,11 @@ import (
// - spec.addOnConfig
// - spec.registrationAuth.*
// - spec.hub.clusterManager.source.*
// - spec.spokes[*].addOns
// - spec.spokes[*].klusterlet.annotations
// - spec.spokes[*].klusterlet.source.*
// - spec.spokes[*].klusterlet.values
// - spec.spokes[*].addOns
// - spec.spokes[*].kubeconfig
func allowFleetConfigUpdate(newObject *FleetConfig, oldObject *FleetConfig) error {

// Hub check
Expand Down Expand Up @@ -65,6 +66,8 @@ func allowFleetConfigUpdate(newObject *FleetConfig, oldObject *FleetConfig) erro
newSpokeCopy.Klusterlet.Source = (OCMSource{})
oldSpokeCopy.Klusterlet.Values = nil
newSpokeCopy.Klusterlet.Values = nil
oldSpokeCopy.Kubeconfig = Kubeconfig{}
newSpokeCopy.Kubeconfig = Kubeconfig{}
newSpokeCopy.AddOns = []AddOn{}
oldSpokeCopy.AddOns = []AddOn{}

Expand Down
4 changes: 2 additions & 2 deletions fleetconfig-controller/config/devspace/manager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ spec:
replicas: 1
selector:
matchLabels:
app.kubernetes.io/instance: fleetconfig-controller-local
app.kubernetes.io/instance: fleetconfig-controller
app.kubernetes.io/name: fleetconfig-controller
template:
metadata:
labels:
app.kubernetes.io/instance: fleetconfig-controller-local
app.kubernetes.io/instance: fleetconfig-controller
app.kubernetes.io/name: fleetconfig-controller
spec:
serviceAccountName: fleetconfig-controller-manager
Expand Down
4 changes: 2 additions & 2 deletions fleetconfig-controller/internal/controller/spoke.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
"errors"
"fmt"
"os/exec"
"reflect"
"regexp"
"slices"
"strings"
Expand Down Expand Up @@ -55,13 +54,14 @@ func handleSpokes(ctx context.Context, kClient client.Client, fc *v1alpha1.Fleet
joinedSpokes := make([]v1alpha1.JoinedSpoke, 0)
for _, js := range fc.Status.JoinedSpokes {
if !slices.ContainsFunc(fc.Spec.Spokes, func(spoke v1alpha1.Spoke) bool {
return spoke.Name == js.Name && reflect.DeepEqual(spoke.Kubeconfig, js.Kubeconfig)
return spoke.Name == js.Name
}) {
err = deregisterSpoke(ctx, kClient, hubKubeconfig, fc, &js)
if err != nil {
fc.SetConditions(true, v1alpha1.NewCondition(
err.Error(), js.UnjoinType(), metav1.ConditionFalse, metav1.ConditionTrue,
))
// if deregistration fails, retain the joined spoke in the status
joinedSpokes = append(joinedSpokes, js)
continue
}
Expand Down
2 changes: 1 addition & 1 deletion fleetconfig-controller/internal/kube/kube.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ func KubeconfigFromSecret(ctx context.Context, kClient client.Client, kubeconfig
}
raw, ok := secret.Data[kubeconfigKey]
if !ok {
return nil, fmt.Errorf("failed to get kubeconfig for ref %s/%s using key %s", secretRef.Namespace, secretRef.Name, kubeconfigKey)
return nil, fmt.Errorf("kubeconfig key '%s' not found in %s/%s secret", kubeconfigKey, secretRef.Namespace, secretRef.Name)
}

return raw, nil
Expand Down
Loading