Skip to content

Commit

Permalink
Merge pull request #232 from microsoft/user/peidlu/correlationid
Browse files Browse the repository at this point in the history
undefined
  • Loading branch information
lpdnju authored Sep 22, 2023
2 parents d924bff + ac54e44 commit e569bd2
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 7 deletions.
5 changes: 4 additions & 1 deletion cloud/scope/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import (
infrav1 "github.com/microsoft/cluster-api-provider-azurestackhci/api/v1beta1"
azhciauth "github.com/microsoft/cluster-api-provider-azurestackhci/pkg/auth"
"github.com/microsoft/moc/pkg/auth"
"github.com/microsoft/moc/pkg/diagnostics"
"github.com/pkg/errors"
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/types"
Expand Down Expand Up @@ -71,14 +72,16 @@ func NewClusterScope(params ClusterScopeParams) (*ClusterScope, error) {
if err != nil {
return nil, errors.Wrap(err, "failed to init patch helper")
}

scopeContext := diagnostics.NewContextWithCorrelationId(context.Background(), params.AzureStackHCICluster.GetAnnotations()[infrav1.AzureCorrelationIDAnnotationKey])
scope := &ClusterScope{
Logger: *params.Logger,
Client: params.Client,
AzureStackHCIClients: params.AzureStackHCIClients,
Cluster: params.Cluster,
AzureStackHCICluster: params.AzureStackHCICluster,
patchHelper: helper,
Context: context.Background(),
Context: scopeContext,
}

authorizer, err := azhciauth.ReconcileAzureStackHCIAccess(scope.Context, scope.Client, agentFqdn)
Expand Down
4 changes: 3 additions & 1 deletion cloud/scope/loadbalancer.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (

"github.com/go-logr/logr"
infrav1 "github.com/microsoft/cluster-api-provider-azurestackhci/api/v1beta1"
"github.com/microsoft/moc/pkg/diagnostics"
"github.com/pkg/errors"
"k8s.io/klog/v2/klogr"
"k8s.io/utils/pointer"
Expand Down Expand Up @@ -60,14 +61,15 @@ func NewLoadBalancerScope(params LoadBalancerScopeParams) (*LoadBalancerScope, e
if err != nil {
return nil, errors.Wrap(err, "failed to init patch helper")
}
scopeContext := diagnostics.NewContextWithCorrelationId(context.Background(), params.AzureStackHCILoadBalancer.GetAnnotations()[infrav1.AzureCorrelationIDAnnotationKey])
return &LoadBalancerScope{
client: params.Client,
AzureStackHCILoadBalancer: params.AzureStackHCILoadBalancer,
Cluster: params.Cluster,
AzureStackHCICluster: params.AzureStackHCICluster,
Logger: *params.Logger,
patchHelper: helper,
Context: context.Background(),
Context: scopeContext,
}, nil
}

Expand Down
4 changes: 3 additions & 1 deletion cloud/scope/virtualmachine.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import (
infrav1 "github.com/microsoft/cluster-api-provider-azurestackhci/api/v1beta1"
azhciauth "github.com/microsoft/cluster-api-provider-azurestackhci/pkg/auth"
"github.com/microsoft/moc/pkg/auth"
"github.com/microsoft/moc/pkg/diagnostics"
"github.com/pkg/errors"
"k8s.io/klog/v2/klogr"
"k8s.io/utils/pointer"
Expand Down Expand Up @@ -76,13 +77,14 @@ func NewVirtualMachineScope(params VirtualMachineScopeParams) (*VirtualMachineSc
if err != nil {
return nil, errors.Wrap(err, "failed to init patch helper")
}
scopeContext := diagnostics.NewContextWithCorrelationId(context.Background(), params.AzureStackHCIVirtualMachine.GetAnnotations()[infrav1.AzureCorrelationIDAnnotationKey])
return &VirtualMachineScope{
client: params.Client,
AzureStackHCIVirtualMachine: params.AzureStackHCIVirtualMachine,
AzureStackHCIClients: params.AzureStackHCIClients,
Logger: *params.Logger,
patchHelper: helper,
Context: context.Background(),
Context: scopeContext,
}, nil
}

Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ require (
github.com/Azure/go-autorest/autorest/to v0.4.0
github.com/blang/semver v3.5.1+incompatible
github.com/go-logr/logr v1.2.3
github.com/microsoft/moc v0.11.0-alpha.12
github.com/microsoft/moc v0.11.0-alpha.28
github.com/microsoft/moc-sdk-for-go v0.11.1-alpha.4
github.com/pkg/errors v0.9.1
github.com/spf13/pflag v1.0.5
Expand Down Expand Up @@ -67,7 +67,7 @@ require (
golang.org/x/oauth2 v0.6.0 // indirect
golang.org/x/sys v0.6.0 // indirect
golang.org/x/term v0.6.0 // indirect
golang.org/x/text v0.11.0 // indirect
golang.org/x/text v0.13.0 // indirect
golang.org/x/time v0.3.0 // indirect
gomodules.xyz/jsonpatch/v2 v2.2.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
Expand Down
6 changes: 4 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -682,8 +682,9 @@ github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJ
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
github.com/matttproud/golang_protobuf_extensions v1.0.2 h1:hAHbPm5IJGijwng3PWk09JkG9WeqChjprR5s9bBZ+OM=
github.com/matttproud/golang_protobuf_extensions v1.0.2/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4=
github.com/microsoft/moc v0.11.0-alpha.12 h1:t1RKeBLKBcQ/9qH9qXOcKW7jKpENFbSadldtch7lbmY=
github.com/microsoft/moc v0.11.0-alpha.12/go.mod h1:oWva5QnxchPzA+W9v5INDHjUksw/UKJPuNHnIwEpyEw=
github.com/microsoft/moc v0.11.0-alpha.28 h1:cdMgpkoyn937QZZMZ5NmYYAUHlonkeHw4vgeIPvZoKQ=
github.com/microsoft/moc v0.11.0-alpha.28/go.mod h1:EuYNwYdC667rnJSYcLcLHKTuQURy9GLm7n+SMDhK6ps=
github.com/microsoft/moc-sdk-for-go v0.11.1-alpha.4 h1:OpmgkyzLkWsNJybg8rO9VzxSpgT/tgmUAtS56sIpUVU=
github.com/microsoft/moc-sdk-for-go v0.11.1-alpha.4/go.mod h1:1A6goum1TLAc1zEc36DvBA799ZTmlva77VoT3+gTZhg=
github.com/mitchellh/copystructure v1.2.0 h1:vpKXTN4ewci03Vljg/q9QvCGUDttBOGBIa15WveJJGw=
Expand Down Expand Up @@ -1066,8 +1067,9 @@ golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/text v0.6.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
golang.org/x/text v0.11.0 h1:LAntKIrcmeSKERyiOh0XMV39LXS8IE9UL2yP7+f5ij4=
golang.org/x/text v0.11.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k=
golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
Expand Down

0 comments on commit e569bd2

Please sign in to comment.