Skip to content

Commit d87e5a8

Browse files
committed
linting
1 parent 98c897d commit d87e5a8

File tree

3 files changed

+19
-12
lines changed

3 files changed

+19
-12
lines changed

controllers/azureresourcegraph_controller.go

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ func (r *AzureResourceGraphReconciler) Reconcile(ctx context.Context, req ctrl.R
7878
}
7979

8080
// Check if the resource is being deleted
81-
if !arg.ObjectMeta.DeletionTimestamp.IsZero() {
81+
if !arg.DeletionTimestamp.IsZero() {
8282
return ctrl.Result{}, nil
8383
}
8484

@@ -430,10 +430,18 @@ func (r *AzureResourceGraphReconciler) getAzureCredentials(arg *hubv1alpha1.Azur
430430
}
431431

432432
//set the environment variables from the secret
433-
os.Setenv("AZURE_TENANT_ID", arg.Spec.Tenant)
434-
os.Setenv("AZURE_SUBSCRIPTION_ID", arg.Spec.Subscription)
435-
os.Setenv("AZURE_CLIENT_SECRET", string(secret.Data["AZURE_CLIENT_SECRET"]))
436-
os.Setenv("AZURE_CLIENT_ID", string(secret.Data["AZURE_CLIENT_ID"]))
433+
if err := os.Setenv("AZURE_TENANT_ID", arg.Spec.Tenant); err != nil {
434+
return nil, err
435+
}
436+
if err := os.Setenv("AZURE_SUBSCRIPTION_ID", arg.Spec.Subscription); err != nil {
437+
return nil, err
438+
}
439+
if err := os.Setenv("AZURE_CLIENT_SECRET", string(secret.Data["AZURE_CLIENT_SECRET"])); err != nil {
440+
return nil, err
441+
}
442+
if err := os.Setenv("AZURE_CLIENT_ID", string(secret.Data["AZURE_CLIENT_ID"])); err != nil {
443+
return nil, err
444+
}
437445

438446
cred, err := azidentity.NewDefaultAzureCredential(nil)
439447
if err != nil {

controllers/deploymentdescriptor_controller.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ import (
3232
"sigs.k8s.io/controller-runtime/pkg/predicate"
3333

3434
kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1beta2"
35-
"github.com/microsoft/kalypso-observability-hub/api/v1alpha1"
3635
hubv1alpha1 "github.com/microsoft/kalypso-observability-hub/api/v1alpha1"
3736
grpcClient "github.com/microsoft/kalypso-observability-hub/storage/api/grpc/client"
3837
pb "github.com/microsoft/kalypso-observability-hub/storage/api/grpc/proto"
@@ -79,7 +78,7 @@ func (r *DeploymentDescriptorReconciler) Reconcile(ctx context.Context, req ctrl
7978
}
8079

8180
// Check if the resource is being deleted
82-
if !deploymentDescriptor.ObjectMeta.DeletionTimestamp.IsZero() {
81+
if !deploymentDescriptor.DeletionTimestamp.IsZero() {
8382
return ctrl.Result{}, nil
8483
}
8584

@@ -115,7 +114,7 @@ func (r *DeploymentDescriptorReconciler) Reconcile(ctx context.Context, req ctrl
115114
wkl, err := storageClient.UpdateWorkload(ctx, &pb.Workload{
116115
Name: descriptorWorkload.Name,
117116
Description: descriptorWorkload.Name,
118-
SourceStorageType: v1alpha1.GitStorageType,
117+
SourceStorageType: hubv1alpha1.GitStorageType,
119118
SourceEndpoint: fmt.Sprintf("%s/%s/%s", descriptorWorkload.Source.Repo, descriptorWorkload.Source.Branch, descriptorWorkload.Source.Path),
120119
ApplicationId: app.Id,
121120
})
@@ -141,7 +140,7 @@ func (r *DeploymentDescriptorReconciler) Reconcile(ctx context.Context, req ctrl
141140
Description: descriptorDeploymentTarget.Name,
142141
EnvironmentId: env.Id,
143142
WorkloadId: wkl.Id,
144-
ManifestsStorageType: v1alpha1.GitStorageType,
143+
ManifestsStorageType: hubv1alpha1.GitStorageType,
145144
ManifestsEndpoint: fmt.Sprintf("%s/%s/%s", descriptorDeploymentTarget.Manifests.Repo, descriptorDeploymentTarget.Manifests.Branch, descriptorDeploymentTarget.Manifests.Path),
146145
})
147146
if err != nil {
@@ -196,12 +195,12 @@ func (r *DeploymentDescriptorReconciler) getCommitFromFluxKustomization(deployme
196195
//get the flux kustomization name from the deployment descriptor
197196
fluxKustomizationName := deploymentDescriptor.Labels[FluxKustomizationNameLabel]
198197
if fluxKustomizationName == "" {
199-
return nil, fmt.Errorf("Flux Kustomization name not found in the deployment descriptor")
198+
return nil, fmt.Errorf("flux Kustomization name not found in the deployment descriptor")
200199
}
201200

202201
fluxKustomizationNamespace := deploymentDescriptor.Labels[FluxKustomizationNamespaceLabel]
203202
if fluxKustomizationNamespace == "" {
204-
return nil, fmt.Errorf("Flux Kustomization namespace not found in the deployment descriptor")
203+
return nil, fmt.Errorf("flux Kustomization namespace not found in the deployment descriptor")
205204
}
206205

207206
//get the flux kustomization

controllers/reconciler_controller.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ func (r *ReconcilerReconciler) Reconcile(ctx context.Context, req ctrl.Request)
7070
}
7171

7272
// Check if the resource is being deleted
73-
if !reconciler.ObjectMeta.DeletionTimestamp.IsZero() {
73+
if !reconciler.DeletionTimestamp.IsZero() {
7474
return ctrl.Result{}, nil
7575
}
7676

0 commit comments

Comments
 (0)