Skip to content

Commit

Permalink
Fix bug where reporting applied intents to the cloud could fail when …
Browse files Browse the repository at this point in the history
…using istio, due to a missing SharedServiceAccount annotation
  • Loading branch information
omris94 committed Feb 24, 2025
1 parent aee63b3 commit 99637ea
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 28 deletions.
14 changes: 7 additions & 7 deletions src/operator/api/v1alpha3/clientintents_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -572,13 +572,13 @@ func clientIntentsStatusToCloudFormat(clientIntents ClientIntents, intent Intent

status.IstioStatus.ServiceAccountName = toPtrOrNil(serviceAccountName)
isSharedValue, ok := clientIntents.Annotations[OtterizeSharedServiceAccountAnnotation]
if !ok {
return nil, false, errors.Errorf("missing annotation shared service account for client intents %s", clientIntents.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", clientIntents.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", clientIntents.Name)
}
isShared = parsedIsShared
}
status.IstioStatus.IsServiceAccountShared = lo.ToPtr(isShared)

Expand Down
14 changes: 7 additions & 7 deletions src/operator/api/v1beta1/clientintents_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -575,13 +575,13 @@ func clientIntentsStatusToCloudFormat(clientIntents ClientIntents, intent Intent

status.IstioStatus.ServiceAccountName = toPtrOrNil(serviceAccountName)
isSharedValue, ok := clientIntents.Annotations[OtterizeSharedServiceAccountAnnotation]
if !ok {
return nil, false, errors.Errorf("missing annotation shared service account for client intents %s", clientIntents.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", clientIntents.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", clientIntents.Name)
}
isShared = parsedIsShared
}
status.IstioStatus.IsServiceAccountShared = lo.ToPtr(isShared)

Expand Down
14 changes: 7 additions & 7 deletions src/operator/api/v2alpha1/clientintents_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -688,13 +688,13 @@ func clientIntentsStatusToCloudFormat(clientIntents ClientIntents, intent Target

status.IstioStatus.ServiceAccountName = toPtrOrNil(serviceAccountName)
isSharedValue, ok := clientIntents.Annotations[OtterizeSharedServiceAccountAnnotation]
if !ok {
return nil, false, errors.Errorf("missing annotation shared service account for client intents %s", clientIntents.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", clientIntents.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", clientIntents.Name)
}
isShared = parsedIsShared
}
status.IstioStatus.IsServiceAccountShared = lo.ToPtr(isShared)

Expand Down
14 changes: 7 additions & 7 deletions src/operator/api/v2beta1/clientintents_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -688,13 +688,13 @@ func clientIntentsStatusToCloudFormat(clientIntents ClientIntents, intent Target

status.IstioStatus.ServiceAccountName = toPtrOrNil(serviceAccountName)
isSharedValue, ok := clientIntents.Annotations[OtterizeSharedServiceAccountAnnotation]
if !ok {
return nil, false, errors.Errorf("missing annotation shared service account for client intents %s", clientIntents.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", clientIntents.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", clientIntents.Name)
}
isShared = parsedIsShared
}
status.IstioStatus.IsServiceAccountShared = lo.ToPtr(isShared)

Expand Down

0 comments on commit 99637ea

Please sign in to comment.