Skip to content

Commit 2ecc138

Browse files
authored
Merge pull request #107 from kcp-ci-bot/cherry-pick-103-to-release-0.4
[release-0.4] use strings instead of custom types when passing to templating
2 parents 9513f9e + 43adf78 commit 2ecc138

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

internal/sync/templating/naming.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,16 @@ type localObjectNamingContext struct {
3535
// Object is the full remote object found in a kcp workspace.
3636
Object map[string]any
3737
// ClusterName is the internal cluster identifier (e.g. "34hg2j4gh24jdfgf").
38-
ClusterName logicalcluster.Name
38+
ClusterName string
3939
// ClusterPath is the workspace path (e.g. "root:customer:projectx").
40-
ClusterPath logicalcluster.Path
40+
ClusterPath string
4141
}
4242

4343
func newLocalObjectNamingContext(object *unstructured.Unstructured, clusterName logicalcluster.Name, workspacePath logicalcluster.Path) localObjectNamingContext {
4444
return localObjectNamingContext{
4545
Object: object.Object,
46-
ClusterName: clusterName,
47-
ClusterPath: workspacePath,
46+
ClusterName: clusterName.String(),
47+
ClusterPath: workspacePath.String(),
4848
}
4949
}
5050

internal/sync/templating/related.go

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -38,18 +38,18 @@ type relatedObjectContext struct {
3838
// ClusterName is the internal cluster identifier (e.g. "34hg2j4gh24jdfgf")
3939
// of the kcp workspace that the synchronization is currently processing. This
4040
// value is set for both evaluations, regardless of side.
41-
ClusterName logicalcluster.Name
41+
ClusterName string
4242
// ClusterPath is the workspace path (e.g. "root:customer:projectx"). This
4343
// value is set for both evaluations, regardless of side.
44-
ClusterPath logicalcluster.Path
44+
ClusterPath string
4545
}
4646

4747
func NewRelatedObjectContext(object *unstructured.Unstructured, side syncagentv1alpha1.RelatedResourceOrigin, clusterName logicalcluster.Name, clusterPath logicalcluster.Path) relatedObjectContext {
4848
return relatedObjectContext{
4949
Side: side,
5050
Object: object.Object,
51-
ClusterName: clusterName,
52-
ClusterPath: clusterPath,
51+
ClusterName: clusterName.String(),
52+
ClusterPath: clusterPath.String(),
5353
}
5454
}
5555

@@ -64,17 +64,17 @@ type relatedObjectLabelContext struct {
6464
// ClusterName is the internal cluster identifier (e.g. "34hg2j4gh24jdfgf")
6565
// of the kcp workspace that the synchronization is currently processing
6666
// (where the remote object exists).
67-
ClusterName logicalcluster.Name
67+
ClusterName string
6868
// ClusterPath is the workspace path (e.g. "root:customer:projectx").
69-
ClusterPath logicalcluster.Path
69+
ClusterPath string
7070
}
7171

7272
func NewRelatedObjectLabelContext(localObject, remoteObject *unstructured.Unstructured, clusterName logicalcluster.Name, clusterPath logicalcluster.Path) relatedObjectLabelContext {
7373
return relatedObjectLabelContext{
7474
LocalObject: localObject.Object,
7575
RemoteObject: remoteObject.Object,
76-
ClusterName: clusterName,
77-
ClusterPath: clusterPath,
76+
ClusterName: clusterName.String(),
77+
ClusterPath: clusterPath.String(),
7878
}
7979
}
8080

@@ -103,18 +103,18 @@ type relatedObjectLabelRewriteContext struct {
103103
// ClusterName is the internal cluster identifier (e.g. "34hg2j4gh24jdfgf")
104104
// of the kcp workspace that the synchronization is currently processing
105105
// (where the remote object exists).
106-
ClusterName logicalcluster.Name
106+
ClusterName string
107107
// ClusterPath is the workspace path (e.g. "root:customer:projectx").
108-
ClusterPath logicalcluster.Path
108+
ClusterPath string
109109
}
110110

111111
func NewRelatedObjectLabelRewriteContext(value string, localObject, remoteObject, relatedObject *unstructured.Unstructured, clusterName logicalcluster.Name, clusterPath logicalcluster.Path) relatedObjectLabelRewriteContext {
112112
ctx := relatedObjectLabelRewriteContext{
113113
Value: value,
114114
LocalObject: localObject.Object,
115115
RemoteObject: remoteObject.Object,
116-
ClusterName: clusterName,
117-
ClusterPath: clusterPath,
116+
ClusterName: clusterName.String(),
117+
ClusterPath: clusterPath.String(),
118118
}
119119

120120
if relatedObject != nil {

0 commit comments

Comments
 (0)