parent
00150711e4
commit
ce2648c62e
|
|
@ -8,6 +8,8 @@ import (
|
||||||
"sync"
|
"sync"
|
||||||
"syscall"
|
"syscall"
|
||||||
|
|
||||||
|
meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
|
|
||||||
"github.com/zalando-incubator/postgres-operator/pkg/controller"
|
"github.com/zalando-incubator/postgres-operator/pkg/controller"
|
||||||
"github.com/zalando-incubator/postgres-operator/pkg/spec"
|
"github.com/zalando-incubator/postgres-operator/pkg/spec"
|
||||||
"github.com/zalando-incubator/postgres-operator/pkg/util/config"
|
"github.com/zalando-incubator/postgres-operator/pkg/util/config"
|
||||||
|
|
@ -79,7 +81,7 @@ func main() {
|
||||||
controllerConfig := ControllerConfig()
|
controllerConfig := ControllerConfig()
|
||||||
|
|
||||||
if configMapName != (spec.NamespacedName{}) {
|
if configMapName != (spec.NamespacedName{}) {
|
||||||
configMap, err := controllerConfig.KubeClient.ConfigMaps(configMapName.Namespace).Get(configMapName.Name)
|
configMap, err := controllerConfig.KubeClient.ConfigMaps(configMapName.Namespace).Get(configMapName.Name, meta_v1.GetOptions{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|
@ -88,6 +90,7 @@ func main() {
|
||||||
} else {
|
} else {
|
||||||
log.Printf("No ConfigMap specified. Loading default values")
|
log.Printf("No ConfigMap specified. Loading default values")
|
||||||
}
|
}
|
||||||
|
|
||||||
if configMapData["namespace"] == "" { // Namespace in ConfigMap has priority over env var
|
if configMapData["namespace"] == "" { // Namespace in ConfigMap has priority over env var
|
||||||
configMapData["namespace"] = podNamespace
|
configMapData["namespace"] = podNamespace
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,8 @@
|
||||||
hash: 427db08c70ab32596f9230f0111e24996f73b1b66ddd7365dd0b1b38c0ae367f
|
hash: 140e0c8a606d18ca405e9c50359cc673e4aa0cc88bcae5d7f83791e7002bd6a1
|
||||||
updated: 2017-05-19T17:11:37.120200516+02:00
|
updated: 2017-07-12T12:52:55.896264+02:00
|
||||||
imports:
|
imports:
|
||||||
- name: cloud.google.com/go
|
|
||||||
version: 3b1ae45394a234c385be014e9a488f2bb6eef821
|
|
||||||
subpackages:
|
|
||||||
- compute/metadata
|
|
||||||
- internal
|
|
||||||
- name: github.com/aws/aws-sdk-go
|
- name: github.com/aws/aws-sdk-go
|
||||||
version: e766cfe96ef7320817087fa4cd92c09abdb87310
|
version: b1a7b51924b90a6ecdbaeb17e96418740ff07a1e
|
||||||
subpackages:
|
subpackages:
|
||||||
- aws
|
- aws
|
||||||
- aws/awserr
|
- aws/awserr
|
||||||
|
|
@ -25,38 +20,15 @@ imports:
|
||||||
- aws/request
|
- aws/request
|
||||||
- aws/session
|
- aws/session
|
||||||
- aws/signer/v4
|
- aws/signer/v4
|
||||||
|
- internal/shareddefaults
|
||||||
- private/protocol
|
- private/protocol
|
||||||
- private/protocol/ec2query
|
- private/protocol/ec2query
|
||||||
- private/protocol/json/jsonutil
|
|
||||||
- private/protocol/jsonrpc
|
|
||||||
- private/protocol/query
|
- private/protocol/query
|
||||||
- private/protocol/query/queryutil
|
- private/protocol/query/queryutil
|
||||||
- private/protocol/rest
|
- private/protocol/rest
|
||||||
- private/protocol/restxml
|
|
||||||
- private/protocol/xml/xmlutil
|
- private/protocol/xml/xmlutil
|
||||||
- private/waiter
|
|
||||||
- service/autoscaling
|
|
||||||
- service/ec2
|
- service/ec2
|
||||||
- service/ecr
|
|
||||||
- service/elb
|
|
||||||
- service/route53
|
|
||||||
- service/sts
|
- service/sts
|
||||||
- name: github.com/blang/semver
|
|
||||||
version: 31b736133b98f26d5e078ec9eb591666edfd091f
|
|
||||||
- name: github.com/coreos/go-oidc
|
|
||||||
version: 5644a2f50e2d2d5ba0b474bc5bc55fea1925936d
|
|
||||||
subpackages:
|
|
||||||
- http
|
|
||||||
- jose
|
|
||||||
- key
|
|
||||||
- oauth2
|
|
||||||
- oidc
|
|
||||||
- name: github.com/coreos/pkg
|
|
||||||
version: fa29b1d70f0beaddd4c7021607cc3c3be8ce94b8
|
|
||||||
subpackages:
|
|
||||||
- health
|
|
||||||
- httputil
|
|
||||||
- timeutil
|
|
||||||
- name: github.com/davecgh/go-spew
|
- name: github.com/davecgh/go-spew
|
||||||
version: 5215b55f46b2b919f50a1df0eaa5886afe4e3b3d
|
version: 5215b55f46b2b919f50a1df0eaa5886afe4e3b3d
|
||||||
subpackages:
|
subpackages:
|
||||||
|
|
@ -71,49 +43,52 @@ imports:
|
||||||
subpackages:
|
subpackages:
|
||||||
- spdy
|
- spdy
|
||||||
- name: github.com/emicklei/go-restful
|
- name: github.com/emicklei/go-restful
|
||||||
version: 89ef8af493ab468a45a42bb0d89a06fccdd2fb22
|
version: ff4f55a206334ef123e4f79bbf348980da81ca46
|
||||||
subpackages:
|
subpackages:
|
||||||
- log
|
- log
|
||||||
- swagger
|
- name: github.com/emicklei/go-restful-swagger12
|
||||||
|
version: dcef7f55730566d41eae5db10e7d6981829720f6
|
||||||
- name: github.com/ghodss/yaml
|
- name: github.com/ghodss/yaml
|
||||||
version: 73d445a93680fa1a78ae23a5839bad48f32ba1ee
|
version: 73d445a93680fa1a78ae23a5839bad48f32ba1ee
|
||||||
- name: github.com/go-ini/ini
|
- name: github.com/go-ini/ini
|
||||||
version: 2e44421e256d82ebbf3d4d4fcabe8930b905eff3
|
version: 3d73f4b845efdf9989fffd4b4e562727744a34ba
|
||||||
|
- name: github.com/go-openapi/analysis
|
||||||
|
version: b44dc874b601d9e4e2f6e19140e794ba24bead3b
|
||||||
- name: github.com/go-openapi/jsonpointer
|
- name: github.com/go-openapi/jsonpointer
|
||||||
version: 46af16f9f7b149af66e5d1bd010e3574dc06de98
|
version: 46af16f9f7b149af66e5d1bd010e3574dc06de98
|
||||||
- name: github.com/go-openapi/jsonreference
|
- name: github.com/go-openapi/jsonreference
|
||||||
version: 13c6e3589ad90f49bd3e3bbe2c2cb3d7a4142272
|
version: 13c6e3589ad90f49bd3e3bbe2c2cb3d7a4142272
|
||||||
|
- name: github.com/go-openapi/loads
|
||||||
|
version: 18441dfa706d924a39a030ee2c3b1d8d81917b38
|
||||||
- name: github.com/go-openapi/spec
|
- name: github.com/go-openapi/spec
|
||||||
version: 6aced65f8501fe1217321abf0749d354824ba2ff
|
version: 6aced65f8501fe1217321abf0749d354824ba2ff
|
||||||
- name: github.com/go-openapi/swag
|
- name: github.com/go-openapi/swag
|
||||||
version: 1d0bd113de87027671077d3c71eb3ac5d7dbba72
|
version: 1d0bd113de87027671077d3c71eb3ac5d7dbba72
|
||||||
- name: github.com/gogo/protobuf
|
- name: github.com/gogo/protobuf
|
||||||
version: 100ba4e885062801d56799d78530b73b178a78f3
|
version: c0656edd0d9eab7c66d1eb0c568f9039345796f7
|
||||||
subpackages:
|
subpackages:
|
||||||
- proto
|
- proto
|
||||||
- sortkeys
|
- sortkeys
|
||||||
- name: github.com/golang/glog
|
- name: github.com/golang/glog
|
||||||
version: 44145f04b68cf362d9c4df2182967c2275eaefed
|
version: 44145f04b68cf362d9c4df2182967c2275eaefed
|
||||||
- name: github.com/golang/protobuf
|
|
||||||
version: 8616e8ee5e20a1704615e6c8d7afcdac06087a67
|
|
||||||
subpackages:
|
|
||||||
- proto
|
|
||||||
- name: github.com/google/gofuzz
|
- name: github.com/google/gofuzz
|
||||||
version: bbcb9da2d746f8bdbd6a936686a0a6067ada0ec5
|
version: 44d81051d367757e1c7c6a5a86423ece9afcf63c
|
||||||
|
- name: github.com/hashicorp/golang-lru
|
||||||
|
version: a0d98a5f288019575c6d1f4bb1573fef2d1fcdc4
|
||||||
|
subpackages:
|
||||||
|
- simplelru
|
||||||
- name: github.com/howeyc/gopass
|
- name: github.com/howeyc/gopass
|
||||||
version: 3ca23474a7c7203e0a0a070fd33508f6efdb9b3d
|
version: bf9dde6d0d2c004a008c27aaee91170c786f6db8
|
||||||
- name: github.com/imdario/mergo
|
- name: github.com/imdario/mergo
|
||||||
version: 6633656539c1639d9d78127b7d47c622b5d7b6dc
|
version: 6633656539c1639d9d78127b7d47c622b5d7b6dc
|
||||||
- name: github.com/jmespath/go-jmespath
|
- name: github.com/jmespath/go-jmespath
|
||||||
version: 3433f3ea46d9f8019119e7dd41274e112a2359a9
|
version: bd40a432e4c76585ef6b72d3fd96fb9b6dc7b68d
|
||||||
- name: github.com/jonboulle/clockwork
|
|
||||||
version: 72f9bd7c4e0c2a40055ab3d0f09654f730cce982
|
|
||||||
- name: github.com/juju/ratelimit
|
- name: github.com/juju/ratelimit
|
||||||
version: 77ed1c8a01217656d2080ad51981f6e99adaa177
|
version: 5b9ff866471762aa2ab2dced63c9fb6f53921342
|
||||||
- name: github.com/kr/text
|
- name: github.com/kr/text
|
||||||
version: 7cafcd837844e784b526369c9bce262804aebc60
|
version: 7cafcd837844e784b526369c9bce262804aebc60
|
||||||
- name: github.com/lib/pq
|
- name: github.com/lib/pq
|
||||||
version: 2704adc878c21e1329f46f6e56a1c387d788ff94
|
version: dd1fe2071026ce53f36a39112e645b4d4f5793a4
|
||||||
subpackages:
|
subpackages:
|
||||||
- oid
|
- oid
|
||||||
- name: github.com/mailru/easyjson
|
- name: github.com/mailru/easyjson
|
||||||
|
|
@ -124,42 +99,29 @@ imports:
|
||||||
- jwriter
|
- jwriter
|
||||||
- name: github.com/motomux/pretty
|
- name: github.com/motomux/pretty
|
||||||
version: b2aad2c9a95d14eb978f29baa6e3a5c3c20eef30
|
version: b2aad2c9a95d14eb978f29baa6e3a5c3c20eef30
|
||||||
- name: github.com/pborman/uuid
|
|
||||||
version: ca53cad383cad2479bbba7f7a1a05797ec1386e4
|
|
||||||
- name: github.com/PuerkitoBio/purell
|
- name: github.com/PuerkitoBio/purell
|
||||||
version: 8a290539e2e8629dbc4e6bad948158f790ec31f4
|
version: 8a290539e2e8629dbc4e6bad948158f790ec31f4
|
||||||
- name: github.com/PuerkitoBio/urlesc
|
- name: github.com/PuerkitoBio/urlesc
|
||||||
version: 5bd2802263f21d8788851d5305584c82a5c75d7e
|
version: 5bd2802263f21d8788851d5305584c82a5c75d7e
|
||||||
- name: github.com/Sirupsen/logrus
|
- name: github.com/Sirupsen/logrus
|
||||||
version: ba1b36c82c5e05c4f912a88eab0dcd91a171688f
|
version: 7f976d3a76720c4c27af2ba716b85d2e0a7e38b1
|
||||||
subpackages:
|
|
||||||
- client
|
|
||||||
- name: github.com/spf13/pflag
|
- name: github.com/spf13/pflag
|
||||||
version: 5ccb023bc27df288a957c5e994cd44fd19619465
|
version: 9ff6c6923cfffbcd502984b8e0c80539a94968b7
|
||||||
- name: github.com/ugorji/go
|
- name: github.com/ugorji/go
|
||||||
version: f1f1a805ed361a0e078bb537e4ea78cd37dcf065
|
version: ded73eae5db7e7a0ef6f55aace87a2873c5d2b74
|
||||||
subpackages:
|
subpackages:
|
||||||
- codec
|
- codec
|
||||||
- name: golang.org/x/crypto
|
- name: golang.org/x/crypto
|
||||||
version: 1f22c0103821b9390939b6776727195525381532
|
version: d172538b2cfce0c13cee31e647d0367aa8cd2486
|
||||||
subpackages:
|
subpackages:
|
||||||
- ssh/terminal
|
- ssh/terminal
|
||||||
- name: golang.org/x/net
|
- name: golang.org/x/net
|
||||||
version: e90d6d0afc4c315a0d87a568ae68577cc15149a0
|
version: f2499483f923065a842d38eb4c7f1927e6fc6e6d
|
||||||
subpackages:
|
subpackages:
|
||||||
- context
|
|
||||||
- context/ctxhttp
|
|
||||||
- http2
|
- http2
|
||||||
- http2/hpack
|
- http2/hpack
|
||||||
- idna
|
- idna
|
||||||
- lex/httplex
|
- lex/httplex
|
||||||
- name: golang.org/x/oauth2
|
|
||||||
version: 3c3a985cb79f52a3190fbc056984415ca6763d01
|
|
||||||
subpackages:
|
|
||||||
- google
|
|
||||||
- internal
|
|
||||||
- jws
|
|
||||||
- jwt
|
|
||||||
- name: golang.org/x/sys
|
- name: golang.org/x/sys
|
||||||
version: 8f0908ab3b2457e2e15403d3697c9ef5cb4b57a9
|
version: 8f0908ab3b2457e2e15403d3697c9ef5cb4b57a9
|
||||||
subpackages:
|
subpackages:
|
||||||
|
|
@ -177,25 +139,14 @@ imports:
|
||||||
- unicode/bidi
|
- unicode/bidi
|
||||||
- unicode/norm
|
- unicode/norm
|
||||||
- width
|
- width
|
||||||
- name: google.golang.org/appengine
|
|
||||||
version: 4f7eeb5305a4ba1966344836ba4af9996b7b4e05
|
|
||||||
subpackages:
|
|
||||||
- internal
|
|
||||||
- internal/app_identity
|
|
||||||
- internal/base
|
|
||||||
- internal/datastore
|
|
||||||
- internal/log
|
|
||||||
- internal/modules
|
|
||||||
- internal/remote_api
|
|
||||||
- internal/urlfetch
|
|
||||||
- urlfetch
|
|
||||||
- name: gopkg.in/inf.v0
|
- name: gopkg.in/inf.v0
|
||||||
version: 3887ee99ecf07df5b447e9b00d9c0b2adaa9f3e4
|
version: 3887ee99ecf07df5b447e9b00d9c0b2adaa9f3e4
|
||||||
- name: gopkg.in/yaml.v2
|
- name: gopkg.in/yaml.v2
|
||||||
version: 53feefa2559fb8dfa8d81baad31be332c97d6c77
|
version: 53feefa2559fb8dfa8d81baad31be332c97d6c77
|
||||||
- name: k8s.io/apimachinery
|
- name: k8s.io/apimachinery
|
||||||
version: 84c15da65eb86243c295d566203d7689cc6ac04b
|
version: abe34e4f5b4413c282a83011892cbeea5b32223b
|
||||||
subpackages:
|
subpackages:
|
||||||
|
- pkg/api/equality
|
||||||
- pkg/api/errors
|
- pkg/api/errors
|
||||||
- pkg/api/meta
|
- pkg/api/meta
|
||||||
- pkg/api/resource
|
- pkg/api/resource
|
||||||
|
|
@ -204,8 +155,10 @@ imports:
|
||||||
- pkg/apimachinery/registered
|
- pkg/apimachinery/registered
|
||||||
- pkg/apis/meta/v1
|
- pkg/apis/meta/v1
|
||||||
- pkg/apis/meta/v1/unstructured
|
- pkg/apis/meta/v1/unstructured
|
||||||
|
- pkg/apis/meta/v1alpha1
|
||||||
- pkg/conversion
|
- pkg/conversion
|
||||||
- pkg/conversion/queryparams
|
- pkg/conversion/queryparams
|
||||||
|
- pkg/conversion/unstructured
|
||||||
- pkg/fields
|
- pkg/fields
|
||||||
- pkg/labels
|
- pkg/labels
|
||||||
- pkg/openapi
|
- pkg/openapi
|
||||||
|
|
@ -215,9 +168,13 @@ imports:
|
||||||
- pkg/runtime/serializer/json
|
- pkg/runtime/serializer/json
|
||||||
- pkg/runtime/serializer/protobuf
|
- pkg/runtime/serializer/protobuf
|
||||||
- pkg/runtime/serializer/recognizer
|
- pkg/runtime/serializer/recognizer
|
||||||
|
- pkg/runtime/serializer/streaming
|
||||||
- pkg/runtime/serializer/versioning
|
- pkg/runtime/serializer/versioning
|
||||||
- pkg/selection
|
- pkg/selection
|
||||||
- pkg/types
|
- pkg/types
|
||||||
|
- pkg/util/cache
|
||||||
|
- pkg/util/clock
|
||||||
|
- pkg/util/diff
|
||||||
- pkg/util/errors
|
- pkg/util/errors
|
||||||
- pkg/util/framer
|
- pkg/util/framer
|
||||||
- pkg/util/httpstream
|
- pkg/util/httpstream
|
||||||
|
|
@ -225,6 +182,7 @@ imports:
|
||||||
- pkg/util/intstr
|
- pkg/util/intstr
|
||||||
- pkg/util/json
|
- pkg/util/json
|
||||||
- pkg/util/net
|
- pkg/util/net
|
||||||
|
- pkg/util/rand
|
||||||
- pkg/util/remotecommand
|
- pkg/util/remotecommand
|
||||||
- pkg/util/runtime
|
- pkg/util/runtime
|
||||||
- pkg/util/sets
|
- pkg/util/sets
|
||||||
|
|
@ -232,116 +190,76 @@ imports:
|
||||||
- pkg/util/validation/field
|
- pkg/util/validation/field
|
||||||
- pkg/util/wait
|
- pkg/util/wait
|
||||||
- pkg/util/yaml
|
- pkg/util/yaml
|
||||||
|
- pkg/version
|
||||||
- pkg/watch
|
- pkg/watch
|
||||||
- third_party/forked/golang/netutil
|
- third_party/forked/golang/netutil
|
||||||
- third_party/forked/golang/reflect
|
- third_party/forked/golang/reflect
|
||||||
- name: k8s.io/client-go
|
- name: k8s.io/client-go
|
||||||
version: e121606b0d09b2e1c467183ee46217fa85a6b672
|
version: df46f7f13b3da19b90b8b4f0d18b8adc6fbf28dc
|
||||||
subpackages:
|
subpackages:
|
||||||
- discovery
|
- discovery
|
||||||
- kubernetes
|
- kubernetes
|
||||||
|
- kubernetes/scheme
|
||||||
|
- kubernetes/typed/admissionregistration/v1alpha1
|
||||||
- kubernetes/typed/apps/v1beta1
|
- kubernetes/typed/apps/v1beta1
|
||||||
|
- kubernetes/typed/authentication/v1
|
||||||
- kubernetes/typed/authentication/v1beta1
|
- kubernetes/typed/authentication/v1beta1
|
||||||
|
- kubernetes/typed/authorization/v1
|
||||||
- kubernetes/typed/authorization/v1beta1
|
- kubernetes/typed/authorization/v1beta1
|
||||||
- kubernetes/typed/autoscaling/v1
|
- kubernetes/typed/autoscaling/v1
|
||||||
|
- kubernetes/typed/autoscaling/v2alpha1
|
||||||
- kubernetes/typed/batch/v1
|
- kubernetes/typed/batch/v1
|
||||||
- kubernetes/typed/batch/v2alpha1
|
- kubernetes/typed/batch/v2alpha1
|
||||||
- kubernetes/typed/certificates/v1alpha1
|
- kubernetes/typed/certificates/v1beta1
|
||||||
- kubernetes/typed/core/v1
|
- kubernetes/typed/core/v1
|
||||||
- kubernetes/typed/extensions/v1beta1
|
- kubernetes/typed/extensions/v1beta1
|
||||||
|
- kubernetes/typed/networking/v1
|
||||||
- kubernetes/typed/policy/v1beta1
|
- kubernetes/typed/policy/v1beta1
|
||||||
- kubernetes/typed/rbac/v1alpha1
|
- kubernetes/typed/rbac/v1alpha1
|
||||||
|
- kubernetes/typed/rbac/v1beta1
|
||||||
|
- kubernetes/typed/settings/v1alpha1
|
||||||
|
- kubernetes/typed/storage/v1
|
||||||
- kubernetes/typed/storage/v1beta1
|
- kubernetes/typed/storage/v1beta1
|
||||||
- pkg/api
|
- pkg/api
|
||||||
- pkg/api/errors
|
|
||||||
- pkg/api/install
|
|
||||||
- pkg/api/meta
|
|
||||||
- pkg/api/meta/metatypes
|
|
||||||
- pkg/api/resource
|
|
||||||
- pkg/api/unversioned
|
|
||||||
- pkg/api/v1
|
- pkg/api/v1
|
||||||
- pkg/api/validation/path
|
- pkg/api/v1/ref
|
||||||
- pkg/apimachinery
|
- pkg/apis/admissionregistration
|
||||||
- pkg/apimachinery/announced
|
- pkg/apis/admissionregistration/v1alpha1
|
||||||
- pkg/apimachinery/registered
|
|
||||||
- pkg/apis/apps
|
- pkg/apis/apps
|
||||||
- pkg/apis/apps/install
|
|
||||||
- pkg/apis/apps/v1beta1
|
- pkg/apis/apps/v1beta1
|
||||||
- pkg/apis/authentication
|
- pkg/apis/authentication
|
||||||
- pkg/apis/authentication/install
|
- pkg/apis/authentication/v1
|
||||||
- pkg/apis/authentication/v1beta1
|
- pkg/apis/authentication/v1beta1
|
||||||
- pkg/apis/authorization
|
- pkg/apis/authorization
|
||||||
- pkg/apis/authorization/install
|
- pkg/apis/authorization/v1
|
||||||
- pkg/apis/authorization/v1beta1
|
- pkg/apis/authorization/v1beta1
|
||||||
- pkg/apis/autoscaling
|
- pkg/apis/autoscaling
|
||||||
- pkg/apis/autoscaling/install
|
|
||||||
- pkg/apis/autoscaling/v1
|
- pkg/apis/autoscaling/v1
|
||||||
|
- pkg/apis/autoscaling/v2alpha1
|
||||||
- pkg/apis/batch
|
- pkg/apis/batch
|
||||||
- pkg/apis/batch/install
|
|
||||||
- pkg/apis/batch/v1
|
- pkg/apis/batch/v1
|
||||||
- pkg/apis/batch/v2alpha1
|
- pkg/apis/batch/v2alpha1
|
||||||
- pkg/apis/certificates
|
- pkg/apis/certificates
|
||||||
- pkg/apis/certificates/install
|
- pkg/apis/certificates/v1beta1
|
||||||
- pkg/apis/certificates/v1alpha1
|
|
||||||
- pkg/apis/extensions
|
- pkg/apis/extensions
|
||||||
- pkg/apis/extensions/install
|
|
||||||
- pkg/apis/extensions/v1beta1
|
- pkg/apis/extensions/v1beta1
|
||||||
|
- pkg/apis/networking
|
||||||
|
- pkg/apis/networking/v1
|
||||||
- pkg/apis/policy
|
- pkg/apis/policy
|
||||||
- pkg/apis/policy/install
|
|
||||||
- pkg/apis/policy/v1beta1
|
- pkg/apis/policy/v1beta1
|
||||||
- pkg/apis/rbac
|
- pkg/apis/rbac
|
||||||
- pkg/apis/rbac/install
|
|
||||||
- pkg/apis/rbac/v1alpha1
|
- pkg/apis/rbac/v1alpha1
|
||||||
|
- pkg/apis/rbac/v1beta1
|
||||||
|
- pkg/apis/settings
|
||||||
|
- pkg/apis/settings/v1alpha1
|
||||||
- pkg/apis/storage
|
- pkg/apis/storage
|
||||||
- pkg/apis/storage/install
|
- pkg/apis/storage/v1
|
||||||
- pkg/apis/storage/v1beta1
|
- pkg/apis/storage/v1beta1
|
||||||
- pkg/auth/user
|
|
||||||
- pkg/conversion
|
|
||||||
- pkg/conversion/queryparams
|
|
||||||
- pkg/fields
|
|
||||||
- pkg/genericapiserver/openapi/common
|
|
||||||
- pkg/labels
|
|
||||||
- pkg/runtime
|
|
||||||
- pkg/runtime/serializer
|
|
||||||
- pkg/runtime/serializer/json
|
|
||||||
- pkg/runtime/serializer/protobuf
|
|
||||||
- pkg/runtime/serializer/recognizer
|
|
||||||
- pkg/runtime/serializer/streaming
|
|
||||||
- pkg/runtime/serializer/versioning
|
|
||||||
- pkg/selection
|
|
||||||
- pkg/third_party/forked/golang/reflect
|
|
||||||
- pkg/third_party/forked/golang/template
|
|
||||||
- pkg/types
|
|
||||||
- pkg/util
|
- pkg/util
|
||||||
- pkg/util/cert
|
|
||||||
- pkg/util/clock
|
|
||||||
- pkg/util/diff
|
|
||||||
- pkg/util/errors
|
|
||||||
- pkg/util/flowcontrol
|
|
||||||
- pkg/util/framer
|
|
||||||
- pkg/util/homedir
|
|
||||||
- pkg/util/integer
|
|
||||||
- pkg/util/intstr
|
|
||||||
- pkg/util/json
|
|
||||||
- pkg/util/jsonpath
|
|
||||||
- pkg/util/labels
|
|
||||||
- pkg/util/net
|
|
||||||
- pkg/util/parsers
|
- pkg/util/parsers
|
||||||
- pkg/util/rand
|
|
||||||
- pkg/util/runtime
|
|
||||||
- pkg/util/sets
|
|
||||||
- pkg/util/uuid
|
|
||||||
- pkg/util/validation
|
|
||||||
- pkg/util/validation/field
|
|
||||||
- pkg/util/wait
|
|
||||||
- pkg/util/yaml
|
|
||||||
- pkg/version
|
- pkg/version
|
||||||
- pkg/watch
|
|
||||||
- pkg/watch/versioned
|
|
||||||
- plugin/pkg/client/auth
|
|
||||||
- plugin/pkg/client/auth/gcp
|
|
||||||
- plugin/pkg/client/auth/oidc
|
|
||||||
- rest
|
- rest
|
||||||
|
- rest/watch
|
||||||
- tools/auth
|
- tools/auth
|
||||||
- tools/cache
|
- tools/cache
|
||||||
- tools/clientcmd
|
- tools/clientcmd
|
||||||
|
|
@ -349,11 +267,11 @@ imports:
|
||||||
- tools/clientcmd/api/latest
|
- tools/clientcmd/api/latest
|
||||||
- tools/clientcmd/api/v1
|
- tools/clientcmd/api/v1
|
||||||
- tools/metrics
|
- tools/metrics
|
||||||
|
- tools/remotecommand
|
||||||
- transport
|
- transport
|
||||||
- name: k8s.io/kubernetes
|
- util/cert
|
||||||
version: ee39d359dd0896c4c0eccf23f033f158ad3d3bd7
|
- util/exec
|
||||||
subpackages:
|
- util/flowcontrol
|
||||||
- pkg/api
|
- util/homedir
|
||||||
- pkg/client/unversioned/remotecommand
|
- util/integer
|
||||||
- pkg/util/exec
|
|
||||||
testImports: []
|
testImports: []
|
||||||
|
|
|
||||||
55
glide.yaml
55
glide.yaml
|
|
@ -1,26 +1,39 @@
|
||||||
package: github.com/zalando-incubator/postgres-operator
|
package: github.com/zalando-incubator/postgres-operator
|
||||||
import:
|
import:
|
||||||
- package: github.com/gogo/protobuf
|
|
||||||
version: ^0.3.0
|
|
||||||
- package: github.com/Sirupsen/logrus
|
- package: github.com/Sirupsen/logrus
|
||||||
version: ^0.11.5
|
version: ^1.0.1
|
||||||
subpackages:
|
|
||||||
- client
|
|
||||||
- package: github.com/lib/pq
|
|
||||||
- package: github.com/motomux/pretty
|
|
||||||
- package: golang.org/x/net
|
|
||||||
subpackages:
|
|
||||||
- context
|
|
||||||
- package: k8s.io/apimachinery
|
|
||||||
version: 84c15da65eb86243c295d566203d7689cc6ac04b
|
|
||||||
subpackages:
|
|
||||||
- pkg/util/json
|
|
||||||
- pkg/util/remotecommand
|
|
||||||
- package: k8s.io/client-go
|
|
||||||
version: ^2.0.0
|
|
||||||
- package: k8s.io/kubernetes
|
|
||||||
version: ee39d359dd0896c4c0eccf23f033f158ad3d3bd7
|
|
||||||
subpackages:
|
|
||||||
- pkg/client/unversioned/remotecommand
|
|
||||||
- package: github.com/aws/aws-sdk-go
|
- package: github.com/aws/aws-sdk-go
|
||||||
version: ^1.8.24
|
version: ^1.8.24
|
||||||
|
subpackages:
|
||||||
|
- aws
|
||||||
|
- aws/session
|
||||||
|
- service/ec2
|
||||||
|
- package: github.com/lib/pq
|
||||||
|
- package: github.com/motomux/pretty
|
||||||
|
- package: k8s.io/apimachinery
|
||||||
|
subpackages:
|
||||||
|
- pkg/api/errors
|
||||||
|
- pkg/api/meta
|
||||||
|
- pkg/api/resource
|
||||||
|
- pkg/apis/meta/v1
|
||||||
|
- pkg/fields
|
||||||
|
- pkg/labels
|
||||||
|
- pkg/runtime
|
||||||
|
- pkg/runtime/schema
|
||||||
|
- pkg/runtime/serializer
|
||||||
|
- pkg/types
|
||||||
|
- pkg/util/intstr
|
||||||
|
- pkg/util/remotecommand
|
||||||
|
- pkg/watch
|
||||||
|
- package: k8s.io/client-go
|
||||||
|
version: ^4.0.0-beta.0
|
||||||
|
subpackages:
|
||||||
|
- kubernetes
|
||||||
|
- pkg/api
|
||||||
|
- pkg/api/v1
|
||||||
|
- pkg/apis/apps/v1beta1
|
||||||
|
- pkg/apis/extensions/v1beta1
|
||||||
|
- rest
|
||||||
|
- tools/cache
|
||||||
|
- tools/clientcmd
|
||||||
|
- tools/remotecommand
|
||||||
|
|
|
||||||
|
|
@ -11,11 +11,11 @@ import (
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/Sirupsen/logrus"
|
"github.com/Sirupsen/logrus"
|
||||||
|
meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
|
"k8s.io/apimachinery/pkg/types"
|
||||||
"k8s.io/client-go/kubernetes"
|
"k8s.io/client-go/kubernetes"
|
||||||
"k8s.io/client-go/pkg/api"
|
|
||||||
"k8s.io/client-go/pkg/api/v1"
|
"k8s.io/client-go/pkg/api/v1"
|
||||||
"k8s.io/client-go/pkg/apis/apps/v1beta1"
|
"k8s.io/client-go/pkg/apis/apps/v1beta1"
|
||||||
"k8s.io/client-go/pkg/types"
|
|
||||||
"k8s.io/client-go/rest"
|
"k8s.io/client-go/rest"
|
||||||
"k8s.io/client-go/tools/cache"
|
"k8s.io/client-go/tools/cache"
|
||||||
|
|
||||||
|
|
@ -66,7 +66,7 @@ type Cluster struct {
|
||||||
mu sync.Mutex
|
mu sync.Mutex
|
||||||
masterLess bool
|
masterLess bool
|
||||||
userSyncStrategy spec.UserSyncer
|
userSyncStrategy spec.UserSyncer
|
||||||
deleteOptions *v1.DeleteOptions
|
deleteOptions *meta_v1.DeleteOptions
|
||||||
podEventsQueue *cache.FIFO
|
podEventsQueue *cache.FIFO
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -102,7 +102,7 @@ func New(cfg Config, pgSpec spec.Postgresql, logger *logrus.Entry) *Cluster {
|
||||||
kubeResources: kubeResources,
|
kubeResources: kubeResources,
|
||||||
masterLess: false,
|
masterLess: false,
|
||||||
userSyncStrategy: users.DefaultUserSyncStrategy{},
|
userSyncStrategy: users.DefaultUserSyncStrategy{},
|
||||||
deleteOptions: &v1.DeleteOptions{OrphanDependents: &orphanDependents},
|
deleteOptions: &meta_v1.DeleteOptions{OrphanDependents: &orphanDependents},
|
||||||
podEventsQueue: podEventsQueue,
|
podEventsQueue: podEventsQueue,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -126,7 +126,7 @@ func (c *Cluster) setStatus(status spec.PostgresStatus) {
|
||||||
}
|
}
|
||||||
request := []byte(fmt.Sprintf(`{"status": %s}`, string(b))) //TODO: Look into/wait for k8s go client methods
|
request := []byte(fmt.Sprintf(`{"status": %s}`, string(b))) //TODO: Look into/wait for k8s go client methods
|
||||||
|
|
||||||
_, err = c.RestClient.Patch(api.MergePatchType).
|
_, err = c.RestClient.Patch(types.MergePatchType).
|
||||||
RequestURI(c.Metadata.GetSelfLink()).
|
RequestURI(c.Metadata.GetSelfLink()).
|
||||||
Body(request).
|
Body(request).
|
||||||
DoRaw()
|
DoRaw()
|
||||||
|
|
|
||||||
|
|
@ -4,9 +4,10 @@ import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
|
meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
remotecommandconsts "k8s.io/apimachinery/pkg/util/remotecommand"
|
remotecommandconsts "k8s.io/apimachinery/pkg/util/remotecommand"
|
||||||
"k8s.io/client-go/pkg/api"
|
"k8s.io/client-go/pkg/api"
|
||||||
"k8s.io/kubernetes/pkg/client/unversioned/remotecommand"
|
"k8s.io/client-go/tools/remotecommand"
|
||||||
|
|
||||||
"github.com/zalando-incubator/postgres-operator/pkg/spec"
|
"github.com/zalando-incubator/postgres-operator/pkg/spec"
|
||||||
)
|
)
|
||||||
|
|
@ -17,7 +18,7 @@ func (c *Cluster) ExecCommand(podName *spec.NamespacedName, command ...string) (
|
||||||
execErr bytes.Buffer
|
execErr bytes.Buffer
|
||||||
)
|
)
|
||||||
|
|
||||||
pod, err := c.KubeClient.Pods(podName.Namespace).Get(podName.Name)
|
pod, err := c.KubeClient.Pods(podName.Namespace).Get(podName.Name, meta_v1.GetOptions{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", fmt.Errorf("could not get pod info: %v", err)
|
return "", fmt.Errorf("could not get pod info: %v", err)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,15 @@
|
||||||
package cluster
|
package cluster
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"sort"
|
"sort"
|
||||||
|
|
||||||
"encoding/json"
|
"k8s.io/apimachinery/pkg/api/resource"
|
||||||
"k8s.io/client-go/pkg/api/resource"
|
meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
|
"k8s.io/apimachinery/pkg/util/intstr"
|
||||||
"k8s.io/client-go/pkg/api/v1"
|
"k8s.io/client-go/pkg/api/v1"
|
||||||
"k8s.io/client-go/pkg/apis/apps/v1beta1"
|
"k8s.io/client-go/pkg/apis/apps/v1beta1"
|
||||||
"k8s.io/client-go/pkg/util/intstr"
|
|
||||||
|
|
||||||
"github.com/zalando-incubator/postgres-operator/pkg/spec"
|
"github.com/zalando-incubator/postgres-operator/pkg/spec"
|
||||||
"github.com/zalando-incubator/postgres-operator/pkg/util/constants"
|
"github.com/zalando-incubator/postgres-operator/pkg/util/constants"
|
||||||
|
|
@ -311,7 +312,7 @@ func (c *Cluster) generatePodTemplate(resourceRequirements *v1.ResourceRequireme
|
||||||
}
|
}
|
||||||
|
|
||||||
template := v1.PodTemplateSpec{
|
template := v1.PodTemplateSpec{
|
||||||
ObjectMeta: v1.ObjectMeta{
|
ObjectMeta: meta_v1.ObjectMeta{
|
||||||
Labels: c.labelsSet(),
|
Labels: c.labelsSet(),
|
||||||
Namespace: c.Metadata.Name,
|
Namespace: c.Metadata.Name,
|
||||||
},
|
},
|
||||||
|
|
@ -337,7 +338,7 @@ func (c *Cluster) generateStatefulSet(spec spec.PostgresSpec) (*v1beta1.Stateful
|
||||||
}
|
}
|
||||||
|
|
||||||
statefulSet := &v1beta1.StatefulSet{
|
statefulSet := &v1beta1.StatefulSet{
|
||||||
ObjectMeta: v1.ObjectMeta{
|
ObjectMeta: meta_v1.ObjectMeta{
|
||||||
Name: c.Metadata.Name,
|
Name: c.Metadata.Name,
|
||||||
Namespace: c.Metadata.Namespace,
|
Namespace: c.Metadata.Namespace,
|
||||||
Labels: c.labelsSet(),
|
Labels: c.labelsSet(),
|
||||||
|
|
@ -354,7 +355,7 @@ func (c *Cluster) generateStatefulSet(spec spec.PostgresSpec) (*v1beta1.Stateful
|
||||||
}
|
}
|
||||||
|
|
||||||
func generatePersistentVolumeClaimTemplate(volumeSize, volumeStorageClass string) (*v1.PersistentVolumeClaim, error) {
|
func generatePersistentVolumeClaimTemplate(volumeSize, volumeStorageClass string) (*v1.PersistentVolumeClaim, error) {
|
||||||
metadata := v1.ObjectMeta{
|
metadata := meta_v1.ObjectMeta{
|
||||||
Name: constants.DataVolumeName,
|
Name: constants.DataVolumeName,
|
||||||
}
|
}
|
||||||
if volumeStorageClass != "" {
|
if volumeStorageClass != "" {
|
||||||
|
|
@ -412,7 +413,7 @@ func (c *Cluster) generateSingleUserSecret(namespace string, pgUser spec.PgUser)
|
||||||
}
|
}
|
||||||
username := pgUser.Name
|
username := pgUser.Name
|
||||||
secret := v1.Secret{
|
secret := v1.Secret{
|
||||||
ObjectMeta: v1.ObjectMeta{
|
ObjectMeta: meta_v1.ObjectMeta{
|
||||||
Name: c.credentialSecretName(username),
|
Name: c.credentialSecretName(username),
|
||||||
Namespace: namespace,
|
Namespace: namespace,
|
||||||
Labels: c.labelsSet(),
|
Labels: c.labelsSet(),
|
||||||
|
|
@ -468,7 +469,7 @@ func (c *Cluster) generateService(role PostgresRole, newSpec *spec.PostgresSpec)
|
||||||
}
|
}
|
||||||
|
|
||||||
service := &v1.Service{
|
service := &v1.Service{
|
||||||
ObjectMeta: v1.ObjectMeta{
|
ObjectMeta: meta_v1.ObjectMeta{
|
||||||
Name: name,
|
Name: name,
|
||||||
Namespace: c.Metadata.Namespace,
|
Namespace: c.Metadata.Namespace,
|
||||||
Labels: c.roleLabelsSet(role),
|
Labels: c.roleLabelsSet(role),
|
||||||
|
|
@ -482,7 +483,7 @@ func (c *Cluster) generateService(role PostgresRole, newSpec *spec.PostgresSpec)
|
||||||
|
|
||||||
func (c *Cluster) generateMasterEndpoints(subsets []v1.EndpointSubset) *v1.Endpoints {
|
func (c *Cluster) generateMasterEndpoints(subsets []v1.EndpointSubset) *v1.Endpoints {
|
||||||
endpoints := &v1.Endpoints{
|
endpoints := &v1.Endpoints{
|
||||||
ObjectMeta: v1.ObjectMeta{
|
ObjectMeta: meta_v1.ObjectMeta{
|
||||||
Name: c.Metadata.Name,
|
Name: c.Metadata.Name,
|
||||||
Namespace: c.Metadata.Namespace,
|
Namespace: c.Metadata.Namespace,
|
||||||
Labels: c.roleLabelsSet(Master),
|
Labels: c.roleLabelsSet(Master),
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ package cluster
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
|
meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
"k8s.io/client-go/pkg/api/v1"
|
"k8s.io/client-go/pkg/api/v1"
|
||||||
|
|
||||||
"github.com/zalando-incubator/postgres-operator/pkg/spec"
|
"github.com/zalando-incubator/postgres-operator/pkg/spec"
|
||||||
|
|
@ -12,7 +13,7 @@ import (
|
||||||
|
|
||||||
func (c *Cluster) listPods() ([]v1.Pod, error) {
|
func (c *Cluster) listPods() ([]v1.Pod, error) {
|
||||||
ns := c.Metadata.Namespace
|
ns := c.Metadata.Namespace
|
||||||
listOptions := v1.ListOptions{
|
listOptions := meta_v1.ListOptions{
|
||||||
LabelSelector: c.labelsSet().String(),
|
LabelSelector: c.labelsSet().String(),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -115,7 +116,7 @@ func (c *Cluster) recreatePods() error {
|
||||||
ls := c.labelsSet()
|
ls := c.labelsSet()
|
||||||
namespace := c.Metadata.Namespace
|
namespace := c.Metadata.Namespace
|
||||||
|
|
||||||
listOptions := v1.ListOptions{
|
listOptions := meta_v1.ListOptions{
|
||||||
LabelSelector: ls.String(),
|
LabelSelector: ls.String(),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,8 @@ package cluster
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"k8s.io/client-go/pkg/api"
|
meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
|
"k8s.io/apimachinery/pkg/types"
|
||||||
"k8s.io/client-go/pkg/api/v1"
|
"k8s.io/client-go/pkg/api/v1"
|
||||||
"k8s.io/client-go/pkg/apis/apps/v1beta1"
|
"k8s.io/client-go/pkg/apis/apps/v1beta1"
|
||||||
|
|
||||||
|
|
@ -16,7 +17,7 @@ import (
|
||||||
|
|
||||||
func (c *Cluster) loadResources() error {
|
func (c *Cluster) loadResources() error {
|
||||||
ns := c.Metadata.Namespace
|
ns := c.Metadata.Namespace
|
||||||
listOptions := v1.ListOptions{
|
listOptions := meta_v1.ListOptions{
|
||||||
LabelSelector: c.labelsSet().String(),
|
LabelSelector: c.labelsSet().String(),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -148,7 +149,7 @@ func (c *Cluster) updateStatefulSet(newStatefulSet *v1beta1.StatefulSet) error {
|
||||||
|
|
||||||
statefulSet, err := c.KubeClient.StatefulSets(c.Statefulset.Namespace).Patch(
|
statefulSet, err := c.KubeClient.StatefulSets(c.Statefulset.Namespace).Patch(
|
||||||
c.Statefulset.Name,
|
c.Statefulset.Name,
|
||||||
api.MergePatchType,
|
types.MergePatchType,
|
||||||
patchData, "")
|
patchData, "")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("could not patch statefulset '%s': %v", statefulSetName, err)
|
return fmt.Errorf("could not patch statefulset '%s': %v", statefulSetName, err)
|
||||||
|
|
@ -171,7 +172,7 @@ func (c *Cluster) replaceStatefulSet(newStatefulSet *v1beta1.StatefulSet) error
|
||||||
orphanDepencies := true
|
orphanDepencies := true
|
||||||
oldStatefulset := c.Statefulset
|
oldStatefulset := c.Statefulset
|
||||||
|
|
||||||
options := v1.DeleteOptions{OrphanDependents: &orphanDepencies}
|
options := meta_v1.DeleteOptions{OrphanDependents: &orphanDepencies}
|
||||||
if err := c.KubeClient.StatefulSets(oldStatefulset.Namespace).Delete(oldStatefulset.Name, &options); err != nil {
|
if err := c.KubeClient.StatefulSets(oldStatefulset.Namespace).Delete(oldStatefulset.Name, &options); err != nil {
|
||||||
return fmt.Errorf("could not delete statefulset '%s': %v", statefulSetName, err)
|
return fmt.Errorf("could not delete statefulset '%s': %v", statefulSetName, err)
|
||||||
}
|
}
|
||||||
|
|
@ -182,7 +183,7 @@ func (c *Cluster) replaceStatefulSet(newStatefulSet *v1beta1.StatefulSet) error
|
||||||
|
|
||||||
err := retryutil.Retry(constants.StatefulsetDeletionInterval, constants.StatefulsetDeletionTimeout,
|
err := retryutil.Retry(constants.StatefulsetDeletionInterval, constants.StatefulsetDeletionTimeout,
|
||||||
func() (bool, error) {
|
func() (bool, error) {
|
||||||
_, err := c.KubeClient.StatefulSets(oldStatefulset.Namespace).Get(oldStatefulset.Name)
|
_, err := c.KubeClient.StatefulSets(oldStatefulset.Namespace).Get(oldStatefulset.Name, meta_v1.GetOptions{})
|
||||||
|
|
||||||
return err != nil, nil
|
return err != nil, nil
|
||||||
})
|
})
|
||||||
|
|
@ -262,7 +263,7 @@ func (c *Cluster) updateService(role PostgresRole, newService *v1.Service) error
|
||||||
if role == Master {
|
if role == Master {
|
||||||
// for the master service we need to re-create the endpoint as well. Get the up-to-date version of
|
// for the master service we need to re-create the endpoint as well. Get the up-to-date version of
|
||||||
// the addresses stored in it before the service is deleted (deletion of the service removes the endpooint)
|
// the addresses stored in it before the service is deleted (deletion of the service removes the endpooint)
|
||||||
currentEndpoint, err = c.KubeClient.Endpoints(c.Service[role].Namespace).Get(c.Service[role].Name)
|
currentEndpoint, err = c.KubeClient.Endpoints(c.Service[role].Namespace).Get(c.Service[role].Name, meta_v1.GetOptions{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("could not get current cluster endpoints: %v", err)
|
return fmt.Errorf("could not get current cluster endpoints: %v", err)
|
||||||
}
|
}
|
||||||
|
|
@ -294,7 +295,7 @@ func (c *Cluster) updateService(role PostgresRole, newService *v1.Service) error
|
||||||
|
|
||||||
_, err := c.KubeClient.Services(c.Service[role].Namespace).Patch(
|
_, err := c.KubeClient.Services(c.Service[role].Namespace).Patch(
|
||||||
c.Service[role].Name,
|
c.Service[role].Name,
|
||||||
api.StrategicMergePatchType,
|
types.StrategicMergePatchType,
|
||||||
[]byte(annotationsPatchData), "")
|
[]byte(annotationsPatchData), "")
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
@ -309,7 +310,7 @@ func (c *Cluster) updateService(role PostgresRole, newService *v1.Service) error
|
||||||
|
|
||||||
svc, err := c.KubeClient.Services(c.Service[role].Namespace).Patch(
|
svc, err := c.KubeClient.Services(c.Service[role].Namespace).Patch(
|
||||||
c.Service[role].Name,
|
c.Service[role].Name,
|
||||||
api.MergePatchType,
|
types.MergePatchType,
|
||||||
patchData, "")
|
patchData, "")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("could not patch service '%s': %v", serviceName, err)
|
return fmt.Errorf("could not patch service '%s': %v", serviceName, err)
|
||||||
|
|
@ -371,7 +372,7 @@ func (c *Cluster) applySecrets() error {
|
||||||
secret, err := c.KubeClient.Secrets(secretSpec.Namespace).Create(secretSpec)
|
secret, err := c.KubeClient.Secrets(secretSpec.Namespace).Create(secretSpec)
|
||||||
if k8sutil.ResourceAlreadyExists(err) {
|
if k8sutil.ResourceAlreadyExists(err) {
|
||||||
var userMap map[string]spec.PgUser
|
var userMap map[string]spec.PgUser
|
||||||
curSecret, err := c.KubeClient.Secrets(secretSpec.Namespace).Get(secretSpec.Name)
|
curSecret, err := c.KubeClient.Secrets(secretSpec.Namespace).Get(secretSpec.Name, meta_v1.GetOptions{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("could not get current secret: %v", err)
|
return fmt.Errorf("could not get current secret: %v", err)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,9 +6,10 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
|
"k8s.io/apimachinery/pkg/labels"
|
||||||
"k8s.io/client-go/pkg/api/v1"
|
"k8s.io/client-go/pkg/api/v1"
|
||||||
"k8s.io/client-go/pkg/apis/apps/v1beta1"
|
"k8s.io/client-go/pkg/apis/apps/v1beta1"
|
||||||
"k8s.io/client-go/pkg/labels"
|
|
||||||
|
|
||||||
"github.com/zalando-incubator/postgres-operator/pkg/spec"
|
"github.com/zalando-incubator/postgres-operator/pkg/spec"
|
||||||
"github.com/zalando-incubator/postgres-operator/pkg/util"
|
"github.com/zalando-incubator/postgres-operator/pkg/util"
|
||||||
|
|
@ -123,7 +124,7 @@ func (c *Cluster) getOAuthToken() (string, error) {
|
||||||
// Temporary getting postgresql-operator secret from the NamespaceDefault
|
// Temporary getting postgresql-operator secret from the NamespaceDefault
|
||||||
credentialsSecret, err := c.KubeClient.
|
credentialsSecret, err := c.KubeClient.
|
||||||
Secrets(c.OpConfig.OAuthTokenSecretName.Namespace).
|
Secrets(c.OpConfig.OAuthTokenSecretName.Namespace).
|
||||||
Get(c.OpConfig.OAuthTokenSecretName.Name)
|
Get(c.OpConfig.OAuthTokenSecretName.Name, meta_v1.GetOptions{})
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
c.logger.Debugf("Oauth token secret name: %s", c.OpConfig.OAuthTokenSecretName)
|
c.logger.Debugf("Oauth token secret name: %s", c.OpConfig.OAuthTokenSecretName)
|
||||||
|
|
@ -193,7 +194,7 @@ func (c *Cluster) waitForPodDeletion(podEvents chan spec.PodEvent) error {
|
||||||
func (c *Cluster) waitStatefulsetReady() error {
|
func (c *Cluster) waitStatefulsetReady() error {
|
||||||
return retryutil.Retry(c.OpConfig.ResourceCheckInterval, c.OpConfig.ResourceCheckTimeout,
|
return retryutil.Retry(c.OpConfig.ResourceCheckInterval, c.OpConfig.ResourceCheckTimeout,
|
||||||
func() (bool, error) {
|
func() (bool, error) {
|
||||||
listOptions := v1.ListOptions{
|
listOptions := meta_v1.ListOptions{
|
||||||
LabelSelector: c.labelsSet().String(),
|
LabelSelector: c.labelsSet().String(),
|
||||||
}
|
}
|
||||||
ss, err := c.KubeClient.StatefulSets(c.Metadata.Namespace).List(listOptions)
|
ss, err := c.KubeClient.StatefulSets(c.Metadata.Namespace).List(listOptions)
|
||||||
|
|
@ -213,15 +214,15 @@ func (c *Cluster) waitPodLabelsReady() error {
|
||||||
ls := c.labelsSet()
|
ls := c.labelsSet()
|
||||||
namespace := c.Metadata.Namespace
|
namespace := c.Metadata.Namespace
|
||||||
|
|
||||||
listOptions := v1.ListOptions{
|
listOptions := meta_v1.ListOptions{
|
||||||
LabelSelector: ls.String(),
|
LabelSelector: ls.String(),
|
||||||
}
|
}
|
||||||
masterListOption := v1.ListOptions{
|
masterListOption := meta_v1.ListOptions{
|
||||||
LabelSelector: labels.Merge(ls, labels.Set{
|
LabelSelector: labels.Merge(ls, labels.Set{
|
||||||
c.OpConfig.PodRoleLabel: constants.PodRoleMaster,
|
c.OpConfig.PodRoleLabel: constants.PodRoleMaster,
|
||||||
}).String(),
|
}).String(),
|
||||||
}
|
}
|
||||||
replicaListOption := v1.ListOptions{
|
replicaListOption := meta_v1.ListOptions{
|
||||||
LabelSelector: labels.Merge(ls, labels.Set{
|
LabelSelector: labels.Merge(ls, labels.Set{
|
||||||
c.OpConfig.PodRoleLabel: constants.PodRoleReplica,
|
c.OpConfig.PodRoleLabel: constants.PodRoleReplica,
|
||||||
}).String(),
|
}).String(),
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,8 @@ import (
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"k8s.io/client-go/pkg/api/resource"
|
"k8s.io/apimachinery/pkg/api/resource"
|
||||||
|
meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
"k8s.io/client-go/pkg/api/v1"
|
"k8s.io/client-go/pkg/api/v1"
|
||||||
|
|
||||||
"github.com/zalando-incubator/postgres-operator/pkg/spec"
|
"github.com/zalando-incubator/postgres-operator/pkg/spec"
|
||||||
|
|
@ -17,7 +18,7 @@ import (
|
||||||
|
|
||||||
func (c *Cluster) listPersistentVolumeClaims() ([]v1.PersistentVolumeClaim, error) {
|
func (c *Cluster) listPersistentVolumeClaims() ([]v1.PersistentVolumeClaim, error) {
|
||||||
ns := c.Metadata.Namespace
|
ns := c.Metadata.Namespace
|
||||||
listOptions := v1.ListOptions{
|
listOptions := meta_v1.ListOptions{
|
||||||
LabelSelector: c.labelsSet().String(),
|
LabelSelector: c.labelsSet().String(),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -69,7 +70,7 @@ func (c *Cluster) listPersistentVolumes() ([]*v1.PersistentVolume, error) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pv, err := c.KubeClient.PersistentVolumes().Get(pvc.Spec.VolumeName)
|
pv, err := c.KubeClient.PersistentVolumes().Get(pvc.Spec.VolumeName, meta_v1.GetOptions{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("could not get PersistentVolume: %v", err)
|
return nil, fmt.Errorf("could not get PersistentVolume: %v", err)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -99,13 +99,11 @@ func (c *Controller) initController() {
|
||||||
constants.QueueResyncPeriodTPR,
|
constants.QueueResyncPeriodTPR,
|
||||||
cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc})
|
cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc})
|
||||||
|
|
||||||
if err := c.postgresqlInformer.AddEventHandler(cache.ResourceEventHandlerFuncs{
|
c.postgresqlInformer.AddEventHandler(cache.ResourceEventHandlerFuncs{
|
||||||
AddFunc: c.postgresqlAdd,
|
AddFunc: c.postgresqlAdd,
|
||||||
UpdateFunc: c.postgresqlUpdate,
|
UpdateFunc: c.postgresqlUpdate,
|
||||||
DeleteFunc: c.postgresqlDelete,
|
DeleteFunc: c.postgresqlDelete,
|
||||||
}); err != nil {
|
})
|
||||||
c.logger.Fatalf("could not add event handlers: %v", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Pods
|
// Pods
|
||||||
podLw := &cache.ListWatch{
|
podLw := &cache.ListWatch{
|
||||||
|
|
@ -119,13 +117,11 @@ func (c *Controller) initController() {
|
||||||
constants.QueueResyncPeriodPod,
|
constants.QueueResyncPeriodPod,
|
||||||
cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc})
|
cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc})
|
||||||
|
|
||||||
if err := c.podInformer.AddEventHandler(cache.ResourceEventHandlerFuncs{
|
c.podInformer.AddEventHandler(cache.ResourceEventHandlerFuncs{
|
||||||
AddFunc: c.podAdd,
|
AddFunc: c.podAdd,
|
||||||
UpdateFunc: c.podUpdate,
|
UpdateFunc: c.podUpdate,
|
||||||
DeleteFunc: c.podDelete,
|
DeleteFunc: c.podDelete,
|
||||||
}); err != nil {
|
})
|
||||||
c.logger.Fatalf("could not add event handlers: %v", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
c.clusterEventQueues = make([]*cache.FIFO, c.opConfig.Workers)
|
c.clusterEventQueues = make([]*cache.FIFO, c.opConfig.Workers)
|
||||||
for i := range c.clusterEventQueues {
|
for i := range c.clusterEventQueues {
|
||||||
|
|
|
||||||
|
|
@ -1,27 +1,20 @@
|
||||||
package controller
|
package controller
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"k8s.io/client-go/pkg/api"
|
meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
|
"k8s.io/apimachinery/pkg/runtime"
|
||||||
|
"k8s.io/apimachinery/pkg/watch"
|
||||||
"k8s.io/client-go/pkg/api/v1"
|
"k8s.io/client-go/pkg/api/v1"
|
||||||
"k8s.io/client-go/pkg/runtime"
|
|
||||||
"k8s.io/client-go/pkg/watch"
|
|
||||||
|
|
||||||
"github.com/zalando-incubator/postgres-operator/pkg/spec"
|
"github.com/zalando-incubator/postgres-operator/pkg/spec"
|
||||||
"github.com/zalando-incubator/postgres-operator/pkg/util"
|
"github.com/zalando-incubator/postgres-operator/pkg/util"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (c *Controller) podListFunc(options api.ListOptions) (runtime.Object, error) {
|
func (c *Controller) podListFunc(options meta_v1.ListOptions) (runtime.Object, error) {
|
||||||
var labelSelector string
|
var labelSelector string
|
||||||
var fieldSelector string
|
var fieldSelector string
|
||||||
|
|
||||||
if options.LabelSelector != nil {
|
opts := meta_v1.ListOptions{
|
||||||
labelSelector = options.LabelSelector.String()
|
|
||||||
}
|
|
||||||
|
|
||||||
if options.FieldSelector != nil {
|
|
||||||
fieldSelector = options.FieldSelector.String()
|
|
||||||
}
|
|
||||||
opts := v1.ListOptions{
|
|
||||||
LabelSelector: labelSelector,
|
LabelSelector: labelSelector,
|
||||||
FieldSelector: fieldSelector,
|
FieldSelector: fieldSelector,
|
||||||
Watch: options.Watch,
|
Watch: options.Watch,
|
||||||
|
|
@ -32,19 +25,11 @@ func (c *Controller) podListFunc(options api.ListOptions) (runtime.Object, error
|
||||||
return c.KubeClient.CoreV1().Pods(c.opConfig.Namespace).List(opts)
|
return c.KubeClient.CoreV1().Pods(c.opConfig.Namespace).List(opts)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Controller) podWatchFunc(options api.ListOptions) (watch.Interface, error) {
|
func (c *Controller) podWatchFunc(options meta_v1.ListOptions) (watch.Interface, error) {
|
||||||
var labelSelector string
|
var labelSelector string
|
||||||
var fieldSelector string
|
var fieldSelector string
|
||||||
|
|
||||||
if options.LabelSelector != nil {
|
opts := meta_v1.ListOptions{
|
||||||
labelSelector = options.LabelSelector.String()
|
|
||||||
}
|
|
||||||
|
|
||||||
if options.FieldSelector != nil {
|
|
||||||
fieldSelector = options.FieldSelector.String()
|
|
||||||
}
|
|
||||||
|
|
||||||
opts := v1.ListOptions{
|
|
||||||
LabelSelector: labelSelector,
|
LabelSelector: labelSelector,
|
||||||
FieldSelector: fieldSelector,
|
FieldSelector: fieldSelector,
|
||||||
Watch: options.Watch,
|
Watch: options.Watch,
|
||||||
|
|
|
||||||
|
|
@ -6,12 +6,13 @@ import (
|
||||||
"sync/atomic"
|
"sync/atomic"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"k8s.io/apimachinery/pkg/api/meta"
|
||||||
|
meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
|
"k8s.io/apimachinery/pkg/fields"
|
||||||
|
"k8s.io/apimachinery/pkg/runtime"
|
||||||
|
"k8s.io/apimachinery/pkg/types"
|
||||||
|
"k8s.io/apimachinery/pkg/watch"
|
||||||
"k8s.io/client-go/pkg/api"
|
"k8s.io/client-go/pkg/api"
|
||||||
"k8s.io/client-go/pkg/api/meta"
|
|
||||||
"k8s.io/client-go/pkg/fields"
|
|
||||||
"k8s.io/client-go/pkg/runtime"
|
|
||||||
"k8s.io/client-go/pkg/types"
|
|
||||||
"k8s.io/client-go/pkg/watch"
|
|
||||||
"k8s.io/client-go/tools/cache"
|
"k8s.io/client-go/tools/cache"
|
||||||
|
|
||||||
"github.com/zalando-incubator/postgres-operator/pkg/cluster"
|
"github.com/zalando-incubator/postgres-operator/pkg/cluster"
|
||||||
|
|
@ -26,14 +27,14 @@ func (c *Controller) clusterResync(stopCh <-chan struct{}) {
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case <-ticker.C:
|
case <-ticker.C:
|
||||||
c.clusterListFunc(api.ListOptions{ResourceVersion: "0"})
|
c.clusterListFunc(meta_v1.ListOptions{ResourceVersion: "0"})
|
||||||
case <-stopCh:
|
case <-stopCh:
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Controller) clusterListFunc(options api.ListOptions) (runtime.Object, error) {
|
func (c *Controller) clusterListFunc(options meta_v1.ListOptions) (runtime.Object, error) {
|
||||||
c.logger.Info("Getting list of currently running clusters")
|
c.logger.Info("Getting list of currently running clusters")
|
||||||
|
|
||||||
req := c.RestClient.Get().
|
req := c.RestClient.Get().
|
||||||
|
|
@ -88,7 +89,7 @@ func (c *Controller) clusterListFunc(options api.ListOptions) (runtime.Object, e
|
||||||
return object, err
|
return object, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Controller) clusterWatchFunc(options api.ListOptions) (watch.Interface, error) {
|
func (c *Controller) clusterWatchFunc(options meta_v1.ListOptions) (watch.Interface, error) {
|
||||||
req := c.RestClient.Get().
|
req := c.RestClient.Get().
|
||||||
RequestURI(fmt.Sprintf(constants.WatchClustersURITemplate, c.opConfig.Namespace)).
|
RequestURI(fmt.Sprintf(constants.WatchClustersURITemplate, c.opConfig.Namespace)).
|
||||||
VersionedParams(&options, api.ParameterCodec).
|
VersionedParams(&options, api.ParameterCodec).
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"hash/crc32"
|
"hash/crc32"
|
||||||
|
|
||||||
|
meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
"k8s.io/client-go/pkg/api/v1"
|
"k8s.io/client-go/pkg/api/v1"
|
||||||
extv1beta "k8s.io/client-go/pkg/apis/extensions/v1beta1"
|
extv1beta "k8s.io/client-go/pkg/apis/extensions/v1beta1"
|
||||||
|
|
||||||
|
|
@ -32,7 +33,7 @@ func (c *Controller) makeClusterConfig() cluster.Config {
|
||||||
|
|
||||||
func thirdPartyResource(TPRName string) *extv1beta.ThirdPartyResource {
|
func thirdPartyResource(TPRName string) *extv1beta.ThirdPartyResource {
|
||||||
return &extv1beta.ThirdPartyResource{
|
return &extv1beta.ThirdPartyResource{
|
||||||
ObjectMeta: v1.ObjectMeta{
|
ObjectMeta: meta_v1.ObjectMeta{
|
||||||
//ThirdPartyResources are cluster-wide
|
//ThirdPartyResources are cluster-wide
|
||||||
Name: TPRName,
|
Name: TPRName,
|
||||||
},
|
},
|
||||||
|
|
@ -72,7 +73,7 @@ func (c *Controller) getInfrastructureRoles() (result map[string]spec.PgUser, er
|
||||||
|
|
||||||
infraRolesSecret, err := c.KubeClient.
|
infraRolesSecret, err := c.KubeClient.
|
||||||
Secrets(c.opConfig.InfrastructureRolesSecretName.Namespace).
|
Secrets(c.opConfig.InfrastructureRolesSecretName.Namespace).
|
||||||
Get(c.opConfig.InfrastructureRolesSecretName.Name)
|
Get(c.opConfig.InfrastructureRolesSecretName.Name, meta_v1.GetOptions{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
c.logger.Debugf("Infrastructure roles secret name: %s", c.opConfig.InfrastructureRolesSecretName)
|
c.logger.Debugf("Infrastructure roles secret name: %s", c.opConfig.InfrastructureRolesSecretName)
|
||||||
return nil, fmt.Errorf("could not get infrastructure roles secret: %v", err)
|
return nil, fmt.Errorf("could not get infrastructure roles secret: %v", err)
|
||||||
|
|
|
||||||
|
|
@ -6,9 +6,8 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"k8s.io/client-go/pkg/api/meta"
|
meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
"k8s.io/client-go/pkg/api/unversioned"
|
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||||
"k8s.io/client-go/pkg/api/v1"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// MaintenanceWindow describes the time window when the operator is allowed to do maintenance on a cluster.
|
// MaintenanceWindow describes the time window when the operator is allowed to do maintenance on a cluster.
|
||||||
|
|
@ -71,8 +70,8 @@ const (
|
||||||
|
|
||||||
// Postgresql defines PostgreSQL Third Party (resource) Object.
|
// Postgresql defines PostgreSQL Third Party (resource) Object.
|
||||||
type Postgresql struct {
|
type Postgresql struct {
|
||||||
unversioned.TypeMeta `json:",inline"`
|
meta_v1.TypeMeta `json:",inline"`
|
||||||
Metadata v1.ObjectMeta `json:"metadata"`
|
Metadata meta_v1.ObjectMeta `json:"metadata"`
|
||||||
|
|
||||||
Spec PostgresSpec `json:"spec"`
|
Spec PostgresSpec `json:"spec"`
|
||||||
Status PostgresStatus `json:"status,omitempty"`
|
Status PostgresStatus `json:"status,omitempty"`
|
||||||
|
|
@ -99,8 +98,8 @@ type PostgresSpec struct {
|
||||||
|
|
||||||
// PostgresqlList defines a list of PostgreSQL clusters.
|
// PostgresqlList defines a list of PostgreSQL clusters.
|
||||||
type PostgresqlList struct {
|
type PostgresqlList struct {
|
||||||
unversioned.TypeMeta `json:",inline"`
|
meta_v1.TypeMeta `json:",inline"`
|
||||||
Metadata unversioned.ListMeta `json:"metadata"`
|
Metadata meta_v1.ListMeta `json:"metadata"`
|
||||||
|
|
||||||
Items []Postgresql `json:"items"`
|
Items []Postgresql `json:"items"`
|
||||||
}
|
}
|
||||||
|
|
@ -192,17 +191,21 @@ func (m *MaintenanceWindow) UnmarshalJSON(data []byte) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetObject implements Object interface for PostgreSQL TPR spec object.
|
// GetObject implements Object interface for PostgreSQL TPR spec object.
|
||||||
func (p *Postgresql) GetObjectKind() unversioned.ObjectKind {
|
func (p *Postgresql) GetObjectKind() schema.ObjectKind {
|
||||||
return &p.TypeMeta
|
return &p.TypeMeta
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetObjectMeta implements ObjectMetaAccessor interface for PostgreSQL TPR spec object.
|
// GetObjectMeta implements ObjectMetaAccessor interface for PostgreSQL TPR spec object.
|
||||||
func (p *Postgresql) GetObjectMeta() meta.Object {
|
func (p *Postgresql) GetObjectMeta() meta_v1.Object {
|
||||||
return &p.Metadata
|
return &p.Metadata
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (pl *PostgresqlList) GetObjectKind() schema.ObjectKind {
|
||||||
|
return &pl.TypeMeta
|
||||||
|
}
|
||||||
|
|
||||||
// GetListMeta implements ListMetaAccessor interface for PostgreSQL TPR List spec object.
|
// GetListMeta implements ListMetaAccessor interface for PostgreSQL TPR List spec object.
|
||||||
func (pl *PostgresqlList) GetListMeta() unversioned.List {
|
func (pl *PostgresqlList) GetListMeta() meta_v1.List {
|
||||||
return &pl.Metadata
|
return &pl.Metadata
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,8 +8,8 @@ import (
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"k8s.io/client-go/pkg/api/unversioned"
|
meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
"k8s.io/client-go/pkg/api/v1"
|
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||||
)
|
)
|
||||||
|
|
||||||
var parseTimeTests = []struct {
|
var parseTimeTests = []struct {
|
||||||
|
|
@ -104,11 +104,11 @@ var unmarshalCluster = []struct {
|
||||||
"kind": "Postgresql","apiVersion": "acid.zalan.do/v1",
|
"kind": "Postgresql","apiVersion": "acid.zalan.do/v1",
|
||||||
"metadata": {"name": "acid-testcluster1"}, "spec": {"teamId": 100}}`),
|
"metadata": {"name": "acid-testcluster1"}, "spec": {"teamId": 100}}`),
|
||||||
Postgresql{
|
Postgresql{
|
||||||
TypeMeta: unversioned.TypeMeta{
|
TypeMeta: meta_v1.TypeMeta{
|
||||||
Kind: "Postgresql",
|
Kind: "Postgresql",
|
||||||
APIVersion: "acid.zalan.do/v1",
|
APIVersion: "acid.zalan.do/v1",
|
||||||
},
|
},
|
||||||
Metadata: v1.ObjectMeta{
|
Metadata: meta_v1.ObjectMeta{
|
||||||
Name: "acid-testcluster1",
|
Name: "acid-testcluster1",
|
||||||
},
|
},
|
||||||
Status: ClusterStatusInvalid,
|
Status: ClusterStatusInvalid,
|
||||||
|
|
@ -184,11 +184,11 @@ var unmarshalCluster = []struct {
|
||||||
}
|
}
|
||||||
}`),
|
}`),
|
||||||
Postgresql{
|
Postgresql{
|
||||||
TypeMeta: unversioned.TypeMeta{
|
TypeMeta: meta_v1.TypeMeta{
|
||||||
Kind: "Postgresql",
|
Kind: "Postgresql",
|
||||||
APIVersion: "acid.zalan.do/v1",
|
APIVersion: "acid.zalan.do/v1",
|
||||||
},
|
},
|
||||||
Metadata: v1.ObjectMeta{
|
Metadata: meta_v1.ObjectMeta{
|
||||||
Name: "acid-testcluster1",
|
Name: "acid-testcluster1",
|
||||||
},
|
},
|
||||||
Spec: PostgresSpec{
|
Spec: PostgresSpec{
|
||||||
|
|
@ -250,11 +250,11 @@ var unmarshalCluster = []struct {
|
||||||
{
|
{
|
||||||
[]byte(`{"kind": "Postgresql","apiVersion": "acid.zalan.do/v1","metadata": {"name": "teapot-testcluster1"}, "spec": {"teamId": "acid"}}`),
|
[]byte(`{"kind": "Postgresql","apiVersion": "acid.zalan.do/v1","metadata": {"name": "teapot-testcluster1"}, "spec": {"teamId": "acid"}}`),
|
||||||
Postgresql{
|
Postgresql{
|
||||||
TypeMeta: unversioned.TypeMeta{
|
TypeMeta: meta_v1.TypeMeta{
|
||||||
Kind: "Postgresql",
|
Kind: "Postgresql",
|
||||||
APIVersion: "acid.zalan.do/v1",
|
APIVersion: "acid.zalan.do/v1",
|
||||||
},
|
},
|
||||||
Metadata: v1.ObjectMeta{
|
Metadata: meta_v1.ObjectMeta{
|
||||||
Name: "teapot-testcluster1",
|
Name: "teapot-testcluster1",
|
||||||
},
|
},
|
||||||
Spec: PostgresSpec{TeamID: "acid"},
|
Spec: PostgresSpec{TeamID: "acid"},
|
||||||
|
|
@ -278,16 +278,16 @@ var postgresqlList = []struct {
|
||||||
}{
|
}{
|
||||||
{[]byte(`{"apiVersion":"v1","items":[{"apiVersion":"acid.zalan.do/v1","kind":"Postgresql","metadata":{"labels":{"team":"acid"},"name":"acid-testcluster42","namespace":"default","resourceVersion":"30446957","selfLink":"/apis/acid.zalan.do/v1/namespaces/default/postgresqls/acid-testcluster42","uid":"857cd208-33dc-11e7-b20a-0699041e4b03"},"spec":{"allowedSourceRanges":["185.85.220.0/22"],"numberOfInstances":1,"postgresql":{"version":"9.6"},"teamId":"acid","volume":{"size":"10Gi"}},"status":"Running"}],"kind":"List","metadata":{},"resourceVersion":"","selfLink":""}`),
|
{[]byte(`{"apiVersion":"v1","items":[{"apiVersion":"acid.zalan.do/v1","kind":"Postgresql","metadata":{"labels":{"team":"acid"},"name":"acid-testcluster42","namespace":"default","resourceVersion":"30446957","selfLink":"/apis/acid.zalan.do/v1/namespaces/default/postgresqls/acid-testcluster42","uid":"857cd208-33dc-11e7-b20a-0699041e4b03"},"spec":{"allowedSourceRanges":["185.85.220.0/22"],"numberOfInstances":1,"postgresql":{"version":"9.6"},"teamId":"acid","volume":{"size":"10Gi"}},"status":"Running"}],"kind":"List","metadata":{},"resourceVersion":"","selfLink":""}`),
|
||||||
PostgresqlList{
|
PostgresqlList{
|
||||||
TypeMeta: unversioned.TypeMeta{
|
TypeMeta: meta_v1.TypeMeta{
|
||||||
Kind: "List",
|
Kind: "List",
|
||||||
APIVersion: "v1",
|
APIVersion: "v1",
|
||||||
},
|
},
|
||||||
Items: []Postgresql{{
|
Items: []Postgresql{{
|
||||||
TypeMeta: unversioned.TypeMeta{
|
TypeMeta: meta_v1.TypeMeta{
|
||||||
Kind: "Postgresql",
|
Kind: "Postgresql",
|
||||||
APIVersion: "acid.zalan.do/v1",
|
APIVersion: "acid.zalan.do/v1",
|
||||||
},
|
},
|
||||||
Metadata: v1.ObjectMeta{
|
Metadata: meta_v1.ObjectMeta{
|
||||||
Name: "acid-testcluster42",
|
Name: "acid-testcluster42",
|
||||||
Namespace: "default",
|
Namespace: "default",
|
||||||
Labels: map[string]string{"team": "acid"},
|
Labels: map[string]string{"team": "acid"},
|
||||||
|
|
|
||||||
|
|
@ -6,8 +6,8 @@ import (
|
||||||
|
|
||||||
"database/sql"
|
"database/sql"
|
||||||
|
|
||||||
|
"k8s.io/apimachinery/pkg/types"
|
||||||
"k8s.io/client-go/pkg/api/v1"
|
"k8s.io/client-go/pkg/api/v1"
|
||||||
"k8s.io/client-go/pkg/types"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// EvenType contains type of the events for the TPRs and Pods received from Kubernetes
|
// EvenType contains type of the events for the TPRs and Pods received from Kubernetes
|
||||||
|
|
|
||||||
|
|
@ -4,12 +4,13 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
apierrors "k8s.io/apimachinery/pkg/api/errors"
|
||||||
|
meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
|
"k8s.io/apimachinery/pkg/runtime"
|
||||||
|
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||||
|
"k8s.io/apimachinery/pkg/runtime/serializer"
|
||||||
"k8s.io/client-go/kubernetes"
|
"k8s.io/client-go/kubernetes"
|
||||||
"k8s.io/client-go/pkg/api"
|
"k8s.io/client-go/pkg/api"
|
||||||
apierrors "k8s.io/client-go/pkg/api/errors"
|
|
||||||
"k8s.io/client-go/pkg/api/unversioned"
|
|
||||||
"k8s.io/client-go/pkg/runtime"
|
|
||||||
"k8s.io/client-go/pkg/runtime/serializer"
|
|
||||||
"k8s.io/client-go/rest"
|
"k8s.io/client-go/rest"
|
||||||
"k8s.io/client-go/tools/clientcmd"
|
"k8s.io/client-go/tools/clientcmd"
|
||||||
|
|
||||||
|
|
@ -38,21 +39,21 @@ func ResourceNotFound(err error) bool {
|
||||||
}
|
}
|
||||||
|
|
||||||
func KubernetesRestClient(c *rest.Config) (*rest.RESTClient, error) {
|
func KubernetesRestClient(c *rest.Config) (*rest.RESTClient, error) {
|
||||||
c.GroupVersion = &unversioned.GroupVersion{Version: constants.K8sVersion}
|
c.GroupVersion = &schema.GroupVersion{Version: constants.K8sVersion}
|
||||||
c.APIPath = constants.K8sAPIPath
|
c.APIPath = constants.K8sAPIPath
|
||||||
c.NegotiatedSerializer = serializer.DirectCodecFactory{CodecFactory: api.Codecs}
|
c.NegotiatedSerializer = serializer.DirectCodecFactory{CodecFactory: api.Codecs}
|
||||||
|
|
||||||
schemeBuilder := runtime.NewSchemeBuilder(
|
schemeBuilder := runtime.NewSchemeBuilder(
|
||||||
func(scheme *runtime.Scheme) error {
|
func(scheme *runtime.Scheme) error {
|
||||||
scheme.AddKnownTypes(
|
scheme.AddKnownTypes(
|
||||||
unversioned.GroupVersion{
|
schema.GroupVersion{
|
||||||
Group: constants.TPRVendor,
|
Group: constants.TPRVendor,
|
||||||
Version: constants.TPRApiVersion,
|
Version: constants.TPRApiVersion,
|
||||||
},
|
},
|
||||||
&spec.Postgresql{},
|
&spec.Postgresql{},
|
||||||
&spec.PostgresqlList{},
|
&spec.PostgresqlList{},
|
||||||
&api.ListOptions{},
|
&meta_v1.ListOptions{},
|
||||||
&api.DeleteOptions{},
|
&meta_v1.DeleteOptions{},
|
||||||
)
|
)
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/motomux/pretty"
|
"github.com/motomux/pretty"
|
||||||
"k8s.io/client-go/pkg/api/v1"
|
meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
|
|
||||||
"github.com/zalando-incubator/postgres-operator/pkg/spec"
|
"github.com/zalando-incubator/postgres-operator/pkg/spec"
|
||||||
)
|
)
|
||||||
|
|
@ -34,7 +34,7 @@ func RandomPassword(n int) string {
|
||||||
}
|
}
|
||||||
|
|
||||||
// NameFromMeta converts a metadata object to the NamespacedName name representation.
|
// NameFromMeta converts a metadata object to the NamespacedName name representation.
|
||||||
func NameFromMeta(meta v1.ObjectMeta) spec.NamespacedName {
|
func NameFromMeta(meta meta_v1.ObjectMeta) spec.NamespacedName {
|
||||||
return spec.NamespacedName{
|
return spec.NamespacedName{
|
||||||
Namespace: meta.Namespace,
|
Namespace: meta.Namespace,
|
||||||
Name: meta.Name,
|
Name: meta.Name,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue