Skip to content

Commit

Permalink
bugfix isShared
Browse files Browse the repository at this point in the history
  • Loading branch information
omris94 committed Feb 26, 2025
1 parent 26e0d5c commit 04d771a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
14 changes: 7 additions & 7 deletions src/operator/api/v2alpha1/approved_clientintents_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,13 +206,13 @@ func approvedClientIntentsStatusToCloudFormat(approvedClientIntents ApprovedClie

status.IstioStatus.ServiceAccountName = toPtrOrNil(serviceAccountName)
isSharedValue, ok := approvedClientIntents.Annotations[OtterizeSharedServiceAccountAnnotation]
if !ok {
return nil, false, errors.Errorf("missing annotation shared service account for client intents %s", approvedClientIntents.Name)
}

isShared, err := strconv.ParseBool(isSharedValue)
if err != nil {
return nil, false, errors.Errorf("failed to parse shared service account annotation for client intents %s", approvedClientIntents.Name)
isShared := false
if ok {
parsedIsShared, err := strconv.ParseBool(isSharedValue)
if err != nil {
return nil, false, errors.Errorf("failed to parse shared service account annotation for client intents %s", approvedClientIntents.Name)
}
isShared = parsedIsShared
}
status.IstioStatus.IsServiceAccountShared = lo.ToPtr(isShared)

Expand Down
14 changes: 7 additions & 7 deletions src/operator/api/v2beta1/approved_clientintents_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -207,13 +207,13 @@ func approvedClientIntentsStatusToCloudFormat(approvedClientIntents ApprovedClie

status.IstioStatus.ServiceAccountName = toPtrOrNil(serviceAccountName)
isSharedValue, ok := approvedClientIntents.Annotations[OtterizeSharedServiceAccountAnnotation]
if !ok {
return nil, false, errors.Errorf("missing annotation shared service account for client intents %s", approvedClientIntents.Name)
}

isShared, err := strconv.ParseBool(isSharedValue)
if err != nil {
return nil, false, errors.Errorf("failed to parse shared service account annotation for client intents %s", approvedClientIntents.Name)
isShared := false
if ok {
parsedIsShared, err := strconv.ParseBool(isSharedValue)
if err != nil {
return nil, false, errors.Errorf("failed to parse shared service account annotation for client intents %s", approvedClientIntents.Name)
}
isShared = parsedIsShared
}
status.IstioStatus.IsServiceAccountShared = lo.ToPtr(isShared)

Expand Down

0 comments on commit 04d771a

Please sign in to comment.