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

WIP: Multi cluster #146

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open

WIP: Multi cluster #146

wants to merge 6 commits into from

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

// 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 3 times, most recently from 5a66ec1 to d739e11 Compare December 2, 2024 11:48
…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.
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