Skip to content

Commit

Permalink
fix(install): replace generated APIServices on collision
Browse files Browse the repository at this point in the history
  • Loading branch information
njhale authored Oct 3, 2018
1 parent e9522fe commit 3e8d3c1
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions pkg/controller/operators/olm/apiservices.go
Original file line number Diff line number Diff line change
Expand Up @@ -392,9 +392,10 @@ func (a *Operator) installAPIServices(csv *v1alpha1.ClusterServiceVersion) error

_, err = a.OpClient.CreateAPIService(apiService)
if k8serrors.IsAlreadyExists(err) {
// attempt an update
if _, err := a.OpClient.UpdateAPIService(apiService); err != nil {
logger.Debugf("could not update APIService %s", apiService.GetName())
// attempt a replace
deleteErr := a.OpClient.DeleteAPIService(apiService.GetName(), &metav1.DeleteOptions{})
if _, err := a.OpClient.CreateAPIService(apiService); err != nil || deleteErr != nil {
logger.Debugf("could not replace APIService %s", apiService.GetName())
return err
}
} else if err != nil {
Expand Down

0 comments on commit 3e8d3c1

Please sign in to comment.