-
Notifications
You must be signed in to change notification settings - Fork 2
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
Multi cluster #146
Conversation
127c2d7
to
e95e761
Compare
There was a problem hiding this 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.
e3446b4
to
54ff40e
Compare
bd82e38
to
bf9a72c
Compare
pkg/schema/v1/contracts.go
Outdated
|
||
// ClusterUuidFromContext returns the uuid value of the cluster stored in ctx, if any: | ||
// | ||
// e, ok := ClusterUuidFromContext(ctx) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replace e
with clusterUuid
.
pkg/schema/v1/contracts.go
Outdated
// } | ||
func ClusterUuidFromContext(ctx context.Context) types.UUID { | ||
clusterUuid, ok := ctx.Value(clusterContextKey).(types.UUID) | ||
|
There was a problem hiding this comment.
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
.
pkg/schema/v1/contracts.go
Outdated
@@ -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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please adjust doc.
pkg/schema/v1/contracts.go
Outdated
@@ -10,24 +11,32 @@ import ( | |||
"reflect" | |||
) | |||
|
|||
// Private type to prevent collisions with other context keys | |||
type contextKey string |
There was a problem hiding this comment.
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.
pkg/schema/v1/contracts.go
Outdated
type contextKey string | ||
|
||
// clusterContextKey is the key for Cluster values in contexts. | ||
var clusterContextKey = contextKey("cluster") |
There was a problem hiding this comment.
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")
.
1e9cf01
to
07d1f90
Compare
2ac91f7
to
3e4acc7
Compare
…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.
3e4acc7
to
834fb17
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you 👍
No description provided.