Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
postgres-operator
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
GitHub Mirror
zalando
postgres-operator
Commits
8beb5936
Commit
8beb5936
authored
8 years ago
by
Oleksii Kliukin
Committed by
GitHub
8 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Don't error out at sync on existence of the object. (#26)
parent
4acaf27a
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
pkg/cluster/sync.go
+21
-12
21 additions, 12 deletions
pkg/cluster/sync.go
with
21 additions
and
12 deletions
pkg/cluster/sync.go
+
21
−
12
View file @
8beb5936
...
...
@@ -4,6 +4,7 @@ import (
"fmt"
"github.com/zalando-incubator/postgres-operator/pkg/util"
"github.com/zalando-incubator/postgres-operator/pkg/util/k8sutil"
)
func
(
c
*
Cluster
)
Sync
(
stopCh
<-
chan
struct
{})
error
{
...
...
@@ -12,7 +13,7 @@ func (c *Cluster) Sync(stopCh <-chan struct{}) error {
err
:=
c
.
loadResources
()
if
err
!=
nil
{
c
.
logger
.
Errorf
(
"
Can'
t load resources: %
s
"
,
err
)
c
.
logger
.
Errorf
(
"
could no
t load resources: %
v
"
,
err
)
}
if
!
c
.
podDispatcherRunning
{
...
...
@@ -20,35 +21,43 @@ func (c *Cluster) Sync(stopCh <-chan struct{}) error {
c
.
podDispatcherRunning
=
true
}
c
.
logger
.
Debugf
(
"Syncing
S
ecrets"
)
c
.
logger
.
Debugf
(
"Syncing
s
ecrets"
)
if
err
:=
c
.
syncSecrets
();
err
!=
nil
{
return
fmt
.
Errorf
(
"Can't sync Secrets: %s"
,
err
)
if
!
k8sutil
.
ResourceAlreadyExists
(
err
)
{
return
fmt
.
Errorf
(
"could not sync secrets: %v"
,
err
)
}
}
c
.
logger
.
Debugf
(
"Syncing
E
ndpoints"
)
c
.
logger
.
Debugf
(
"Syncing
e
ndpoints"
)
if
err
:=
c
.
syncEndpoint
();
err
!=
nil
{
return
fmt
.
Errorf
(
"Can't sync Endpoints: %s"
,
err
)
if
!
k8sutil
.
ResourceAlreadyExists
(
err
)
{
return
fmt
.
Errorf
(
"could not sync endpoints: %v"
,
err
)
}
}
c
.
logger
.
Debugf
(
"Syncing
S
ervices"
)
c
.
logger
.
Debugf
(
"Syncing
s
ervices"
)
if
err
:=
c
.
syncService
();
err
!=
nil
{
return
fmt
.
Errorf
(
"Can't sync Services: %s"
,
err
)
if
!
k8sutil
.
ResourceAlreadyExists
(
err
)
{
return
fmt
.
Errorf
(
"coud not sync services: %v"
,
err
)
}
}
c
.
logger
.
Debugf
(
"Syncing
S
tateful
S
ets"
)
c
.
logger
.
Debugf
(
"Syncing
s
tateful
s
ets"
)
if
err
:=
c
.
syncStatefulSet
();
err
!=
nil
{
return
fmt
.
Errorf
(
"Can't sync StatefulSets: %s"
,
err
)
if
!
k8sutil
.
ResourceAlreadyExists
(
err
)
{
return
fmt
.
Errorf
(
"could not sync statefulsets: %v"
,
err
)
}
}
if
c
.
databaseAccessDisabled
()
{
return
nil
}
if
err
:=
c
.
initDbConn
();
err
!=
nil
{
return
fmt
.
Errorf
(
"
Can'
t init db connection: %
s
"
,
err
)
return
fmt
.
Errorf
(
"
could no
t init db connection: %
v
"
,
err
)
}
else
{
c
.
logger
.
Debugf
(
"Syncing
R
oles"
)
c
.
logger
.
Debugf
(
"Syncing
r
oles"
)
if
err
:=
c
.
SyncRoles
();
err
!=
nil
{
return
fmt
.
Errorf
(
"
Can'
t sync
R
oles: %
s
"
,
err
)
return
fmt
.
Errorf
(
"
could no
t sync
r
oles: %
v
"
,
err
)
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment