Skip to content

Instantly share code, notes, and snippets.

@tamalsaha
Created January 14, 2022 13:26
Show Gist options
  • Save tamalsaha/1a8f354ad09b66198158c9976532cbbd to your computer and use it in GitHub Desktop.
Save tamalsaha/1a8f354ad09b66198158c9976532cbbd to your computer and use it in GitHub Desktop.
type MySQLSpec struct {
// AllowedReadReplicas defines the types of read replicas that MAY be attached to a
// MySQL instance and the trusted namespaces where those Read Replica resources MAY be
// present.
//
// Support: Core
// +kubebuilder:default={namespaces:{from: Same}}
// +optional
AllowedReadReplicas *AllowedReadReplicas `json:"allowedReadReplicas,omitempty"`
}
// AllowedReadReplicas defines which ReadReplicas may be attached to this Listener.
type AllowedReadReplicas struct {
// Namespaces indicates namespaces from which ReadReplicas may be attached to this
// Listener. This is restricted to the namespace of this Gateway by default.
//
// Support: Core
//
// +optional
// +kubebuilder:default={from: Same}
Namespaces *ReadRouteNamespaces `json:"namespaces,omitempty"`
// ReplicaSelector specifies a selector for ReadReplicas that are allowed to bind
// to this Gateway Listener. When unspecified or empty, the kinds of ReadReplicas
// selected are determined using the Listener protocol.
//
// Support: Core
//
// +optional
ReplicaSelector *metav1.LabelSelector `json:"replicaSelector,omitempty"`
}
// FromNamespaces specifies namespace from which ReadReplicas may be attached to a
// Gateway.
//
// +kubebuilder:validation:Enum=All;Selector;Same
type FromNamespaces string
const (
// ReadReplicas in all namespaces may be attached to this Gateway.
NamespacesFromAll FromNamespaces = "All"
// Only ReadReplicas in namespaces selected by the selector may be attached to
// this Gateway.
NamespacesFromSelector FromNamespaces = "Selector"
// Only ReadReplicas in the same namespace as the Gateway may be attached to this
// Gateway.
NamespacesFromSame FromNamespaces = "Same"
)
// ReadRouteNamespaces indicate which namespaces ReadReplicas should be selected from.
type ReadRouteNamespaces struct {
// From indicates where ReadReplicas will be selected for this Gateway. Possible
// values are:
// * All: ReadReplicas in all namespaces may be used by this Gateway.
// * Selector: ReadReplicas in namespaces selected by the selector may be used by
// this Gateway.
// * Same: Only ReadReplicas in the same namespace may be used by this Gateway.
//
// Support: Core
//
// +optional
// +kubebuilder:default=Same
From *FromNamespaces `json:"from,omitempty"`
// Selector must be specified when From is set to "Selector". In that case,
// only ReadReplicas in Namespaces matching this Selector will be selected by this
// Gateway. This field is ignored for other values of "From".
//
// Support: Core
//
// +optional
Selector *metav1.LabelSelector `json:"selector,omitempty"`
}
@tamalsaha
Copy link
Author

1 Facility - Many Users

Many Facilities - Many Users


Facility Spec
{
	Who are Allowed to use this facility

	Namespace selection
	User selection via labels
}

User {
	ref to a Facility
}

@tamalsaha
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment