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
8 changes: 4 additions & 4 deletions internal/sync/templating/naming.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,16 @@ type localObjectNamingContext struct {
// Object is the full remote object found in a kcp workspace.
Object map[string]any
// ClusterName is the internal cluster identifier (e.g. "34hg2j4gh24jdfgf").
ClusterName logicalcluster.Name
ClusterName string
// ClusterPath is the workspace path (e.g. "root:customer:projectx").
ClusterPath logicalcluster.Path
ClusterPath string
}

func newLocalObjectNamingContext(object *unstructured.Unstructured, clusterName logicalcluster.Name, workspacePath logicalcluster.Path) localObjectNamingContext {
return localObjectNamingContext{
Object: object.Object,
ClusterName: clusterName,
ClusterPath: workspacePath,
ClusterName: clusterName.String(),
ClusterPath: workspacePath.String(),
}
}

Expand Down
24 changes: 12 additions & 12 deletions internal/sync/templating/related.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,18 +38,18 @@ type relatedObjectContext struct {
// ClusterName is the internal cluster identifier (e.g. "34hg2j4gh24jdfgf")
// of the kcp workspace that the synchronization is currently processing. This
// value is set for both evaluations, regardless of side.
ClusterName logicalcluster.Name
ClusterName string
// ClusterPath is the workspace path (e.g. "root:customer:projectx"). This
// value is set for both evaluations, regardless of side.
ClusterPath logicalcluster.Path
ClusterPath string
}

func NewRelatedObjectContext(object *unstructured.Unstructured, side syncagentv1alpha1.RelatedResourceOrigin, clusterName logicalcluster.Name, clusterPath logicalcluster.Path) relatedObjectContext {
return relatedObjectContext{
Side: side,
Object: object.Object,
ClusterName: clusterName,
ClusterPath: clusterPath,
ClusterName: clusterName.String(),
ClusterPath: clusterPath.String(),
}
}

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

func NewRelatedObjectLabelContext(localObject, remoteObject *unstructured.Unstructured, clusterName logicalcluster.Name, clusterPath logicalcluster.Path) relatedObjectLabelContext {
return relatedObjectLabelContext{
LocalObject: localObject.Object,
RemoteObject: remoteObject.Object,
ClusterName: clusterName,
ClusterPath: clusterPath,
ClusterName: clusterName.String(),
ClusterPath: clusterPath.String(),
}
}

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

func NewRelatedObjectLabelRewriteContext(value string, localObject, remoteObject, relatedObject *unstructured.Unstructured, clusterName logicalcluster.Name, clusterPath logicalcluster.Path) relatedObjectLabelRewriteContext {
ctx := relatedObjectLabelRewriteContext{
Value: value,
LocalObject: localObject.Object,
RemoteObject: remoteObject.Object,
ClusterName: clusterName,
ClusterPath: clusterPath,
ClusterName: clusterName.String(),
ClusterPath: clusterPath.String(),
}

if relatedObject != nil {
Expand Down