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

Fix Unmarshaling of Target Config #1257

Merged
merged 1 commit into from
Nov 4, 2024
Merged
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: 2 additions & 2 deletions pkg/utils/clusters/shoot_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ package clusters

import (
"context"
"encoding/json"
"fmt"

apierrors "k8s.io/apimachinery/pkg/api/errors"
Expand All @@ -15,6 +14,7 @@ import (
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/client-go/dynamic"
"k8s.io/client-go/tools/clientcmd"
"sigs.k8s.io/yaml"

"github.com/gardener/landscaper/apis/core/v1alpha1"
"github.com/gardener/landscaper/apis/core/v1alpha1/targettypes"
Expand Down Expand Up @@ -56,7 +56,7 @@ func NewShootClientFromTarget(ctx context.Context, gardenTarget *v1alpha1.Target
}

targetConfig := &targettypes.KubernetesClusterTargetConfig{}
err = json.Unmarshal([]byte(resolvedTarget.Content), targetConfig)
err = yaml.Unmarshal([]byte(resolvedTarget.Content), targetConfig)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this is fine, since the yaml parser should also be able to parse json (?).
However, I believe we need to also fix the secret resolving in controller-utils/pkg/landscaper/references.go. The function ResolveSecretReference should return the same format for when a key is specivied vs. there is no key specified. What do you think?

if err != nil {
return nil, fmt.Errorf("shoot client: failed to unmarshal target config: %w", err)
}
Expand Down