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
e084bc58
Commit
e084bc58
authored
6 years ago
by
Felix Kunde
Browse files
Options
Downloads
Patches
Plain Diff
patch existing CRD each time there is an operator update
parent
8f9dfffe
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
manifests/operator-service-account-rbac.yaml
+1
-0
1 addition, 0 deletions
manifests/operator-service-account-rbac.yaml
pkg/controller/util.go
+11
-1
11 additions, 1 deletion
pkg/controller/util.go
with
12 additions
and
1 deletion
manifests/operator-service-account-rbac.yaml
+
1
−
0
View file @
e084bc58
...
...
@@ -25,6 +25,7 @@ rules:
verbs
:
-
create
-
get
-
patch
-
apiGroups
:
-
"
"
resources
:
...
...
This diff is collapsed.
Click to expand it.
pkg/controller/util.go
+
11
−
1
View file @
e084bc58
package
controller
import
(
"encoding/json"
"fmt"
"k8s.io/api/core/v1"
apiextv1beta1
"k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1"
metav1
"k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types"
"k8s.io/apimachinery/pkg/util/wait"
acidv1
"github.com/zalando/postgres-operator/pkg/apis/acid.zalan.do/v1"
...
...
@@ -52,7 +54,15 @@ func (c *Controller) createOperatorCRD(crd *apiextv1beta1.CustomResourceDefiniti
if
!
k8sutil
.
ResourceAlreadyExists
(
err
)
{
return
fmt
.
Errorf
(
"could not create customResourceDefinition: %v"
,
err
)
}
c
.
logger
.
Infof
(
"customResourceDefinition %q is already registered"
,
crd
.
Name
)
c
.
logger
.
Infof
(
"customResourceDefinition %q is already registered and will only be updated"
,
crd
.
Name
)
patch
,
err
:=
json
.
Marshal
(
crd
)
if
err
!=
nil
{
return
fmt
.
Errorf
(
"could not marshal new customResourceDefintion: %v"
,
err
)
}
if
_
,
err
:=
c
.
KubeClient
.
CustomResourceDefinitions
()
.
Patch
(
crd
.
Name
,
types
.
MergePatchType
,
patch
);
err
!=
nil
{
return
fmt
.
Errorf
(
"could not update customResourceDefinition: %v"
,
err
)
}
}
else
{
c
.
logger
.
Infof
(
"customResourceDefinition %q has been registered"
,
crd
.
Name
)
}
...
...
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