Skip to content

Commit 930fdd7

Browse files
committed
added debugging through describeinstances trace
1 parent 1671354 commit 930fdd7

3 files changed

Lines changed: 20 additions & 10 deletions

File tree

pkg/providers/v1/aws.go

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -594,11 +594,12 @@ func newAWSCloud2(cfg config.CloudConfig, awsServices Services, provider config.
594594
}
595595

596596
ec2, err := awsServices.Compute(ctx, regionName)
597-
klog.InfoS("Created ec2, ", ec2, "nil check: ", (ec2 == nil))
597+
klog.InfoS("[debug] Created ec2, ", ec2, "nil check: ", (ec2 == nil))
598598
if err != nil {
599599
return nil, fmt.Errorf("error creating AWS EC2 client: %v", err)
600600
}
601601

602+
klog.InfoS("[debug] Created ec2, ", ec2, "nil check: ", (ec2 == nil))
602603
ec2v2, err := services.NewEc2SdkV2(ctx, regionName, credentialsV2)
603604
if err != nil {
604605
return nil, fmt.Errorf("error creating AWS EC2v2 client: %v", err)
@@ -630,6 +631,7 @@ func newAWSCloud2(cfg config.CloudConfig, awsServices Services, provider config.
630631
createTagsBatcher: newCreateTagsBatcher(ctx, ec2),
631632
deleteTagsBatcher: newDeleteTagsBatcher(ctx, ec2),
632633
}
634+
klog.InfoS("[debug] Created cloud, ec2:", ec2)
633635
awsCloud.instanceCache.cloud = awsCloud
634636
awsCloud.zoneCache.cloud = awsCloud
635637
awsCloud.instanceTopologyManager = resourcemanagers.NewInstanceTopologyManager(ec2v2, &cfg)
@@ -646,7 +648,9 @@ func newAWSCloud2(cfg config.CloudConfig, awsServices Services, provider config.
646648
}
647649
awsCloud.vpcID = cfg.Global.VPC
648650
} else {
651+
klog.InfoS("[debug] calling buildSelfAWSInstance", awsCloud.ec2)
649652
selfAWSInstance, err := awsCloud.buildSelfAWSInstance(ctx)
653+
klog.InfoS("[debug] done calling buildSelfAWSInstance", awsCloud.ec2)
650654
if err != nil {
651655
return nil, err
652656
}
@@ -1117,7 +1121,9 @@ func (c *Cloud) buildSelfAWSInstance(ctx context.Context) (*awsInstance, error)
11171121
// information from the instance returned by the EC2 API - it is a
11181122
// single API call to get all the information, and it means we don't
11191123
// have two code paths.
1124+
klog.InfoS("[debug] calling getInstanceByID", c.ec2)
11201125
instance, err := c.getInstanceByID(ctx, instanceID)
1126+
klog.InfoS("[debug] done calling getInstanceByID", c.ec2)
11211127
if err != nil {
11221128
return nil, fmt.Errorf("error finding instance %s: %q", instanceID, err)
11231129
}
@@ -3126,7 +3132,9 @@ func (c *Cloud) UpdateLoadBalancer(ctx context.Context, clusterName string, serv
31263132

31273133
// Returns the instance with the specified ID
31283134
func (c *Cloud) getInstanceByID(ctx context.Context, instanceID string) (*ec2types.Instance, error) {
3135+
klog.InfoS("[debug] calling getInstancesByIDs", c.ec2)
31293136
instances, err := c.getInstancesByIDs(ctx, []string{instanceID})
3137+
klog.InfoS("[debug] done calling getInstancesByIDs", c.ec2)
31303138
if err != nil {
31313139
return nil, err
31323140
}
@@ -3151,7 +3159,9 @@ func (c *Cloud) getInstancesByIDs(ctx context.Context, instanceIDs []string) (ma
31513159
InstanceIds: instanceIDs,
31523160
}
31533161

3162+
klog.InfoS("[debug] calling DescribeInstances", c.ec2)
31543163
instances, err := c.ec2.DescribeInstances(ctx, request)
3164+
klog.InfoS("[debug] done calling DescribeInstances", c.ec2)
31553165
if err != nil {
31563166
return nil, err
31573167
}

pkg/providers/v1/aws_sdk.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -157,31 +157,31 @@ func (p *awsSDKProvider) getCrossRequestRetryDelay(regionName string) *CrossRequ
157157
}
158158

159159
func (p *awsSDKProvider) Compute(ctx context.Context, regionName string) (iface.EC2, error) {
160-
klog.InfoS("[Compute] entered")
160+
klog.InfoS("[debug] [Compute] entered")
161161
cfg, err := awsConfig.LoadDefaultConfig(ctx,
162162
awsConfig.WithRegion(regionName),
163163
awsConfig.WithCredentialsProvider(p.credsV2),
164164
)
165-
klog.InfoS("[Compute] loaded config, err:", err)
165+
klog.InfoS("[debug] [Compute] loaded config, err:", err)
166166
if err != nil {
167167
return nil, fmt.Errorf("unable to initialize AWS config: %v", err)
168168
}
169169

170170
p.AddHandlersV2(ctx, regionName, &cfg)
171-
klog.InfoS("[Compute] added handlers")
171+
klog.InfoS("[debug] [Compute] added handlers")
172172
var opts []func(*ec2.Options) = p.cfg.GetEC2EndpointOpts(regionName)
173173
opts = append(opts, func(o *ec2.Options) {
174174
o.Retryer = &customRetryer{
175175
retry.NewStandard(),
176176
}
177177
})
178-
klog.InfoS("[Compute] did GetEC2EndpointOpts")
178+
klog.InfoS("[debug] [Compute] did GetEC2EndpointOpts")
179179
opts = append(opts, func(o *ec2.Options) {
180180
o.EndpointResolverV2 = p.cfg.GetCustomEC2Resolver()
181181
})
182-
klog.InfoS("[Compute] did GetCustomEC2Resolver")
182+
klog.InfoS("[debug] [Compute] did GetCustomEC2Resolver")
183183
ec2Client := ec2.NewFromConfig(cfg, opts...)
184-
klog.InfoS("[Compute] did NewFromConfig")
184+
klog.InfoS("[debug] [Compute] did NewFromConfig")
185185

186186
ec2 := &awsSdkEC2{
187187
ec2: ec2Client,

pkg/providers/v1/config/config.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,15 +135,15 @@ func (cfg *CloudConfig) GetRegion(metadata EC2Metadata) (string, error) {
135135
return cfg.Global.Region, nil
136136
}
137137

138-
klog.Info("Loading region from metadata service a")
138+
klog.Info("Loading region from metadata service [debug] a")
139139
region, err := metadata.Region()
140-
klog.Info("Loaded region from metadata service, err:", err)
140+
klog.Info("[debug] Loaded region from metadata service, err:", err)
141141
if err != nil {
142142
return "", err
143143
}
144144

145145
cfg.Global.Region = region
146-
klog.Info("Loaded region from metadata service, set region to", region)
146+
klog.Info("[debug] Loaded region from metadata service, set region to", region)
147147
return region, nil
148148
}
149149

0 commit comments

Comments
 (0)