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

Multi cluster #146

Merged
merged 6 commits into from
Dec 17, 2024
Merged

Multi cluster #146

merged 6 commits into from
Dec 17, 2024

Conversation

jhoxhaa
Copy link
Collaborator

@jhoxhaa jhoxhaa commented Nov 22, 2024

No description provided.

@jhoxhaa jhoxhaa force-pushed the multi-cluster branch 2 times, most recently from 127c2d7 to e95e761 Compare November 22, 2024 15:27
@jhoxhaa jhoxhaa self-assigned this Nov 25, 2024
Copy link
Member

@lippserd lippserd left a comment

Choose a reason for hiding this comment

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

Retrieve the value of the cluster ID from the context instead of introducing an additional argument.

@cla-bot cla-bot bot added the cla/signed CLA is signed by all contributors of a PR label Nov 28, 2024
@jhoxhaa jhoxhaa force-pushed the multi-cluster branch 2 times, most recently from bd82e38 to bf9a72c Compare November 29, 2024 11:40
@jhoxhaa jhoxhaa requested a review from lippserd November 29, 2024 11:57

// ClusterUuidFromContext returns the uuid value of the cluster stored in ctx, if any:
//
// e, ok := ClusterUuidFromContext(ctx)
Copy link
Member

Choose a reason for hiding this comment

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

Replace e with clusterUuid.

// }
func ClusterUuidFromContext(ctx context.Context) types.UUID {
clusterUuid, ok := ctx.Value(clusterContextKey).(types.UUID)

Copy link
Member

Choose a reason for hiding this comment

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

Remove newline here and add one before the return.

@@ -116,6 +125,26 @@ func NewNullableString(s any) sql.NullString {
panic(fmt.Sprintf("invalid type %T", s))
}

// NewClusterUuidContext returns a new Context that carries this Cluster as value.
Copy link
Member

Choose a reason for hiding this comment

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

Please adjust doc.

@@ -10,24 +11,32 @@ import (
"reflect"
)

// Private type to prevent collisions with other context keys
type contextKey string
Copy link
Member

Choose a reason for hiding this comment

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

I would move the whole context related stuff to pkg/cluster so that it is encapsulated.

type contextKey string

// clusterContextKey is the key for Cluster values in contexts.
var clusterContextKey = contextKey("cluster")
Copy link
Member

Choose a reason for hiding this comment

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

Please rename clusterContextKey to clusterUuidContextKey and use contextKey("cluster_uuid").

@jhoxhaa jhoxhaa force-pushed the multi-cluster branch 5 times, most recently from 1e9cf01 to 07d1f90 Compare December 2, 2024 13:03
@jhoxhaa jhoxhaa force-pushed the multi-cluster branch 2 times, most recently from 2ac91f7 to 3e4acc7 Compare December 9, 2024 14:05
…ndling

- Add `clusterUuid` to the `Meta` struct and update the `ObtainMeta` method to set it.
- Modify the `Resource` interface to require `clusterUuid` in the `Obtain` method.
@jhoxhaa jhoxhaa changed the title WIP: Multi cluster Multi cluster Dec 17, 2024
@lippserd lippserd self-requested a review December 17, 2024 11:44
Copy link
Member

@lippserd lippserd left a comment

Choose a reason for hiding this comment

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

Thank you 👍

@lippserd lippserd merged commit ea8ecc7 into main Dec 17, 2024
7 checks passed
@lippserd lippserd deleted the multi-cluster branch December 17, 2024 11:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla/signed CLA is signed by all contributors of a PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants