mirror of
https://github.com/zalando/postgres-operator.git
synced 2026-10-04 17:51:56 +02:00
Generate CRD for postgresteam resource (#3004)
* Sort postgresteam.crd.yaml Signed-off-by: Mikkel Oscar Lyderik Larsen <mikkel.larsen@zalando.de> * Generate CRD for postgresteam resource Signed-off-by: Mikkel Oscar Lyderik Larsen <mikkel.larsen@zalando.de> --------- Signed-off-by: Mikkel Oscar Lyderik Larsen <mikkel.larsen@zalando.de> Co-authored-by: Felix Kunde <felix-kunde@gmx.de>
This commit is contained in:
co-authored by
Felix Kunde
parent
c331fd9434
commit
0a44252534
+33
-6
@@ -14,8 +14,39 @@ import (
|
||||
"k8s.io/client-go/rest"
|
||||
)
|
||||
|
||||
// NamespacedName describes the namespace/name pairs used in Kubernetes names.
|
||||
type NamespacedName types.NamespacedName
|
||||
// NamespacedName comprises a resource name, with a mandatory namespace,
|
||||
// rendered as "<namespace>/<name>". Being a type captures intent and
|
||||
// helps make sure that UIDs, namespaced names and non-namespaced names
|
||||
// do not get conflated in code. For most use cases, namespace and name
|
||||
// will already have been format validated at the API entry point, so we
|
||||
// don't do that here. Where that's not the case (e.g. in testing),
|
||||
// consider using NamespacedNameOrDie() in testing.go in this package.
|
||||
//
|
||||
// from: https://github.com/kubernetes/apimachinery/blob/master/pkg/types/namespacedname.go
|
||||
type NamespacedName struct {
|
||||
Namespace string `json:"namespace,omitempty"`
|
||||
Name string `json:"name"`
|
||||
}
|
||||
|
||||
const (
|
||||
Separator = '/'
|
||||
)
|
||||
|
||||
// String returns the general purpose string representation
|
||||
func (n NamespacedName) String() string {
|
||||
return n.Namespace + string(Separator) + n.Name
|
||||
}
|
||||
|
||||
// MarshalLog emits a struct containing required key/value pair
|
||||
func (n NamespacedName) MarshalLog() interface{} {
|
||||
return struct {
|
||||
Name string `json:"name"`
|
||||
Namespace string `json:"namespace,omitempty"`
|
||||
}{
|
||||
Name: n.Name,
|
||||
Namespace: n.Namespace,
|
||||
}
|
||||
}
|
||||
|
||||
const fileWithNamespace = "/var/run/secrets/kubernetes.io/serviceaccount/namespace"
|
||||
|
||||
@@ -131,10 +162,6 @@ type ControllerConfig struct {
|
||||
// cached value for the GetOperatorNamespace
|
||||
var operatorNamespace string
|
||||
|
||||
func (n NamespacedName) String() string {
|
||||
return types.NamespacedName(n).String()
|
||||
}
|
||||
|
||||
// MarshalJSON defines marshaling rule for the namespaced name type.
|
||||
func (n NamespacedName) MarshalJSON() ([]byte, error) {
|
||||
return []byte("\"" + n.String() + "\""), nil
|
||||
|
||||
Reference in New Issue
Block a user