Skip to content

Commit

Permalink
fix: check conditions test was failing
Browse files Browse the repository at this point in the history
  • Loading branch information
mojtaba-esk committed Sep 25, 2024
1 parent 9012c69 commit 7ac94a8
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions pkg/k8s/configmap.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,14 @@ func (c *Client) CreateConfigMap(

cm := prepareConfigMap(c.namespace, name, labels, data)
created, err := c.clientset.CoreV1().ConfigMaps(c.namespace).Create(ctx, cm, metav1.CreateOptions{})
if err != nil {
if !apierrs.IsAlreadyExists(err) {
return nil, ErrConfigmapAlreadyExists.WithParams(name).Wrap(err)
}
return nil, ErrCreatingConfigmap.WithParams(name).Wrap(err)
if err == nil {
return created, nil
}

return created, nil
if apierrs.IsAlreadyExists(err) {
return nil, ErrConfigmapAlreadyExists.WithParams(name).Wrap(err)
}
return nil, ErrCreatingConfigmap.WithParams(name).Wrap(err)
}

func (c *Client) UpdateConfigMap(
Expand All @@ -68,14 +68,14 @@ func (c *Client) UpdateConfigMap(

cm := prepareConfigMap(c.namespace, name, labels, data)
updated, err := c.clientset.CoreV1().ConfigMaps(c.namespace).Update(ctx, cm, metav1.UpdateOptions{})
if err != nil {
if !apierrs.IsNotFound(err) {
return nil, ErrConfigmapDoesNotExist.WithParams(name).Wrap(err)
}
return nil, ErrUpdatingConfigmap.WithParams(name).Wrap(err)
if err == nil {
return updated, nil
}

return updated, nil
if apierrs.IsNotFound(err) {
return nil, ErrConfigmapDoesNotExist.WithParams(name).Wrap(err)
}
return nil, ErrUpdatingConfigmap.WithParams(name).Wrap(err)
}

func (c *Client) CreateOrUpdateConfigMap(
Expand Down

0 comments on commit 7ac94a8

Please sign in to comment.