-
Notifications
You must be signed in to change notification settings - Fork 68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Handle the broker in the operator #1085
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -126,8 +126,54 @@ type SubmarinerList struct { | |
Items []Submariner `json:"items"` | ||
} | ||
|
||
// BrokerSpec defines the desired state of Broker | ||
// +k8s:openapi-gen=true | ||
type BrokerSpec struct { | ||
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster | ||
// Important: Run "make" to regenerate code after modifying this file | ||
|
||
Components []string `json:"components,omitempty"` | ||
DefaultCustomDomains []string `json:"defaultCustomDomains,omitempty"` | ||
GlobalnetCIDRRange string `json:"globalnetCIDRRange,omitempty"` | ||
DefaultGlobalnetClusterSize uint `json:"defaultGlobalnetClusterSize,omitempty"` | ||
GlobalnetEnabled bool `json:"globalnetEnabled,omitempty"` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We might require changes to subctl to prompt the user to provide the GlobalnetCIDR/GlobalnetClusterSize while joining a new Cluster, if there are no defaults configured when Broker is deployed. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is already the case, I’ll do that in a separate PR. #1103 tracks this. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Well, or may be not, not sure, if they are going through the process of using the operator directly.... may be it's better to let them be explicit There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I prefer #1104 ;-) |
||
} | ||
|
||
// BrokerStatus defines the observed state of Broker | ||
// +k8s:openapi-gen=true | ||
type BrokerStatus struct { | ||
// INSERT ADDITIONAL STATUS FIELD - define observed state of cluster | ||
// Important: Run "make" to regenerate code after modifying this file | ||
} | ||
|
||
// +kubebuilder:object:root=true | ||
|
||
// Broker is the Schema for the brokers API | ||
// +k8s:openapi-gen=true | ||
// +kubebuilder:subresource:status | ||
// +kubebuilder:resource:path=brokers,scope=Namespaced | ||
// +genclient | ||
// +operator-sdk:csv:customresourcedefinitions:displayName="Broker" | ||
type Broker struct { //nolint:maligned // we want to keep the traditional order | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ObjectMeta `json:"metadata,omitempty"` | ||
|
||
Spec BrokerSpec `json:"spec,omitempty"` | ||
Status BrokerStatus `json:"status,omitempty"` | ||
} | ||
|
||
// +kubebuilder:object:root=true | ||
|
||
// BrokerList contains a list of Broker | ||
type BrokerList struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ListMeta `json:"metadata,omitempty"` | ||
Items []Broker `json:"items"` | ||
} | ||
|
||
func init() { | ||
SchemeBuilder.Register(&Submariner{}, &SubmarinerList{}) | ||
SchemeBuilder.Register(&Broker{}, &BrokerList{}) | ||
} | ||
|
||
func (s *Submariner) UnmarshalJSON(data []byte) error { | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
|
||
--- | ||
apiVersion: apiextensions.k8s.io/v1 | ||
kind: CustomResourceDefinition | ||
metadata: | ||
annotations: | ||
controller-gen.kubebuilder.io/version: v0.3.0 | ||
creationTimestamp: null | ||
name: brokers.submariner.io | ||
spec: | ||
group: submariner.io | ||
names: | ||
kind: Broker | ||
listKind: BrokerList | ||
plural: brokers | ||
singular: broker | ||
scope: Namespaced | ||
versions: | ||
- name: v1alpha1 | ||
schema: | ||
openAPIV3Schema: | ||
description: Broker is the Schema for the brokers API | ||
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: BrokerSpec defines the desired state of Broker | ||
properties: | ||
components: | ||
items: | ||
type: string | ||
type: array | ||
defaultCustomDomains: | ||
items: | ||
type: string | ||
type: array | ||
defaultGlobalnetClusterSize: | ||
type: integer | ||
globalnetCIDRRange: | ||
type: string | ||
globalnetEnabled: | ||
type: boolean | ||
type: object | ||
status: | ||
description: BrokerStatus defines the observed state of Broker | ||
type: object | ||
type: object | ||
served: true | ||
storage: true | ||
subresources: | ||
status: {} | ||
status: | ||
acceptedNames: | ||
kind: "" | ||
plural: "" | ||
conditions: [] | ||
storedVersions: [] |
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/v1beta1 | ||
kind: CustomResourceDefinition | ||
metadata: | ||
annotations: | ||
cert-manager.io/inject-ca-from: $(CERTIFICATE_NAMESPACE)/$(CERTIFICATE_NAME) | ||
name: brokers.submariner.io |
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/v1beta1 | ||
kind: CustomResourceDefinition | ||
metadata: | ||
name: brokers.submariner.io | ||
spec: | ||
conversion: | ||
strategy: Webhook | ||
webhookClientConfig: | ||
# this is "\n" used as a placeholder, otherwise it will be rejected by the apiserver for being blank, | ||
# but we're going to set it later using the cert-manager (or potentially a patch if not using cert-manager) | ||
caBundle: Cg== | ||
service: | ||
namespace: system | ||
name: webhook-service | ||
path: /convert |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
apiVersion: submariner.io/v1alpha1 | ||
kind: Broker | ||
metadata: | ||
name: broker-sample | ||
spec: | ||
# defaultCustomDomains: | ||
# globalnetCIDRRange: | ||
defaultGlobalnetClusterSize: 8192 | ||
globalnetEnabled: false | ||
serviceDiscovery: true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for updating last moment, I just realized you were into this too :/