-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- sets global parameter 'schema_definition_sync_upstream' with value 'username' 'password' and 'endpoints'
- Loading branch information
Showing
23 changed files
with
1,276 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
/* | ||
RabbitMQ Messaging Topology Kubernetes Operator | ||
Copyright 2021 VMware, Inc. | ||
This product is licensed to you under the Mozilla Public License 2.0 license (the "License"). You may not use this product except in compliance with the Mozilla 2.0 License. | ||
This product may include a number of subcomponents with separate copyright notices and license terms. Your use of these subcomponents is subject to the terms and conditions of the subcomponent's license, as noted in the LICENSE file. | ||
*/ | ||
|
||
package v1alpha2 | ||
|
||
import ( | ||
corev1 "k8s.io/api/core/v1" | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
) | ||
|
||
// SchemaReplicationSpec defines the desired state of SchemaReplication | ||
type SchemaReplicationSpec struct { | ||
// Reference to the RabbitmqCluster that schema replication would be set for. Must be an existing cluster. | ||
// +kubebuilder:validation:Required | ||
RabbitmqClusterReference RabbitmqClusterReference `json:"rabbitmqClusterReference"` | ||
// Defines a Secret which contains credentials to be used for schema replication. | ||
// The Secret must contain the keys `endpoints`, `username` and `password` in its Data field, or the controller errors. | ||
// +kubebuilder:validation:Required | ||
UpstreamSecret *corev1.LocalObjectReference `json:"upstreamSecret,omitempty"` | ||
} | ||
|
||
// SchemaReplicationStatus defines the observed state of SchemaReplication | ||
type SchemaReplicationStatus struct { | ||
// observedGeneration is the most recent successful generation observed for this Queue. It corresponds to the | ||
// Queue's generation, which is updated on mutation by the API Server. | ||
ObservedGeneration int64 `json:"observedGeneration,omitempty"` | ||
Conditions []Condition `json:"conditions,omitempty"` | ||
} | ||
|
||
// +kubebuilder:object:root=true | ||
// +kubebuilder:subresource:status | ||
|
||
// SchemaReplication is the Schema for the schemareplications API | ||
// This feature requires Tanzu RabbitMQ with schema replication plugin. | ||
// For more information, see: https://tanzu.vmware.com/rabbitmq and https://www.rabbitmq.com/definitions-standby.html. | ||
type SchemaReplication struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ObjectMeta `json:"metadata,omitempty"` | ||
|
||
Spec SchemaReplicationSpec `json:"spec,omitempty"` | ||
Status SchemaReplicationStatus `json:"status,omitempty"` | ||
} | ||
|
||
// +kubebuilder:object:root=true | ||
|
||
// SchemaReplicationList contains a list of SchemaReplication | ||
type SchemaReplicationList struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ListMeta `json:"metadata,omitempty"` | ||
Items []SchemaReplication `json:"items"` | ||
} | ||
|
||
func init() { | ||
SchemeBuilder.Register(&SchemaReplication{}, &SchemaReplicationList{}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package v1alpha2 | ||
|
||
import ( | ||
"context" | ||
. "github.com/onsi/ginkgo" | ||
. "github.com/onsi/gomega" | ||
corev1 "k8s.io/api/core/v1" | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
"k8s.io/apimachinery/pkg/types" | ||
) | ||
|
||
var _ = Describe("schemaReplication spec", func() { | ||
It("creates a schemaReplication", func() { | ||
replication := SchemaReplication{ | ||
ObjectMeta: metav1.ObjectMeta{ | ||
Name: "replication", | ||
Namespace: "default", | ||
}, | ||
Spec: SchemaReplicationSpec{ | ||
RabbitmqClusterReference: RabbitmqClusterReference{ | ||
Name: "some-cluster", | ||
}, | ||
UpstreamSecret: &corev1.LocalObjectReference{ | ||
Name: "a-secret", | ||
}, | ||
}} | ||
Expect(k8sClient.Create(context.Background(), &replication)).To(Succeed()) | ||
|
||
fetched := &SchemaReplication{} | ||
Expect(k8sClient.Get(context.Background(), types.NamespacedName{ | ||
Name: replication.Name, | ||
Namespace: replication.Namespace, | ||
}, fetched)).To(Succeed()) | ||
Expect(fetched.Spec.RabbitmqClusterReference).To(Equal(RabbitmqClusterReference{ | ||
Name: "some-cluster", | ||
})) | ||
Expect(fetched.Spec.UpstreamSecret.Name).To(Equal("a-secret")) | ||
}) | ||
}) |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
|
||
--- | ||
apiVersion: apiextensions.k8s.io/v1 | ||
kind: CustomResourceDefinition | ||
metadata: | ||
annotations: | ||
controller-gen.kubebuilder.io/version: v0.5.0 | ||
creationTimestamp: null | ||
name: schemareplications.rabbitmq.com | ||
spec: | ||
group: rabbitmq.com | ||
names: | ||
kind: SchemaReplication | ||
listKind: SchemaReplicationList | ||
plural: schemareplications | ||
singular: schemareplication | ||
scope: Namespaced | ||
versions: | ||
- name: v1alpha2 | ||
schema: | ||
openAPIV3Schema: | ||
description: 'SchemaReplication is the Schema for the schemareplications API | ||
This feature requires Tanzu RabbitMQ with schema replication plugin. For | ||
more information, see: https://tanzu.vmware.com/rabbitmq and https://www.rabbitmq.com/definitions-standby.html.' | ||
properties: | ||
apiVersion: | ||
description: 'APIVersion defines the versioned schema of this representation | ||
of an object. Servers should convert recognized schemas to the latest | ||
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' | ||
type: string | ||
kind: | ||
description: 'Kind is a string value representing the REST resource this | ||
object represents. Servers may infer this from the endpoint the client | ||
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' | ||
type: string | ||
metadata: | ||
type: object | ||
spec: | ||
description: SchemaReplicationSpec defines the desired state of SchemaReplication | ||
properties: | ||
rabbitmqClusterReference: | ||
description: Reference to the RabbitmqCluster that schema replication | ||
would be set for. Must be an existing cluster. | ||
properties: | ||
name: | ||
type: string | ||
required: | ||
- name | ||
type: object | ||
upstreamSecret: | ||
description: Defines a Secret which contains credentials to be used | ||
for schema replication. The Secret must contain the keys `endpoints`, | ||
`username` and `password` in its Data field, or the controller errors. | ||
properties: | ||
name: | ||
description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names | ||
TODO: Add other useful fields. apiVersion, kind, uid?' | ||
type: string | ||
type: object | ||
required: | ||
- rabbitmqClusterReference | ||
type: object | ||
status: | ||
description: SchemaReplicationStatus defines the observed state of SchemaReplication | ||
properties: | ||
conditions: | ||
items: | ||
properties: | ||
lastTransitionTime: | ||
description: The last time this Condition type changed. | ||
format: date-time | ||
type: string | ||
message: | ||
description: Full text reason for current status of the condition. | ||
type: string | ||
reason: | ||
description: One word, camel-case reason for current status | ||
of the condition. | ||
type: string | ||
status: | ||
description: True, False, or Unknown | ||
type: string | ||
type: | ||
description: Type indicates the scope of RabbitmqCluster status | ||
addressed by the condition. | ||
type: string | ||
required: | ||
- status | ||
- type | ||
type: object | ||
type: array | ||
observedGeneration: | ||
description: observedGeneration is the most recent successful generation | ||
observed for this Queue. It corresponds to the Queue's generation, | ||
which is updated on mutation by the API Server. | ||
format: int64 | ||
type: integer | ||
type: object | ||
type: object | ||
served: true | ||
storage: true | ||
subresources: | ||
status: {} | ||
status: | ||
acceptedNames: | ||
kind: "" | ||
plural: "" | ||
conditions: [] | ||
storedVersions: [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# The following patch adds a directive for certmanager to inject CA into the CRD | ||
# CRD conversion requires k8s 1.13 or later. | ||
apiVersion: apiextensions.k8s.io/v1 | ||
kind: CustomResourceDefinition | ||
metadata: | ||
annotations: | ||
cert-manager.io/inject-ca-from: $(CERTIFICATE_NAMESPACE)/$(CERTIFICATE_NAME) | ||
name: schemareplications.rabbitmq.com |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# The following patch enables conversion webhook for CRD | ||
# CRD conversion requires k8s 1.13 or later. | ||
apiVersion: apiextensions.k8s.io/v1 | ||
kind: CustomResourceDefinition | ||
metadata: | ||
name: schemareplications.rabbitmq.com | ||
spec: | ||
conversion: | ||
strategy: Webhook | ||
webhook: | ||
conversionReviewVersions: ["v1", "v1beta1"] | ||
clientConfig: | ||
caBundle: Cg== | ||
service: | ||
namespace: system | ||
name: webhook-service | ||
path: /convert |
Oops, something went wrong.