Skip to content

Commit

Permalink
Rename EndpointBinding to BoundEndpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
hjkatz committed Oct 29, 2024
1 parent 566b381 commit 7c5b997
Show file tree
Hide file tree
Showing 21 changed files with 356 additions and 356 deletions.
2 changes: 1 addition & 1 deletion PROJECT

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
Expand Up @@ -32,10 +32,10 @@ import (
// NOTE: Run "make" to regenerate code after modifying this file
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.

// EndpointBindingSpec defines the desired state of EndpointBinding
type EndpointBindingSpec struct {
// BoundEndpointSpec defines the desired state of BoundEndpoint
type BoundEndpointSpec struct {
// EndpointURI is the unique identifier
// representing the EndpointBinding + its Endpoints
// representing the BoundEndpoint + its Endpoints
// Format: <scheme>://<service>.<namespace>:<port>
//
// +kubebuilder:validation:Required
Expand All @@ -59,14 +59,14 @@ type EndpointBindingSpec struct {
Target EndpointTarget `json:"target"`
}

// EndpointBindingStatus defines the observed state of EndpointBinding
type EndpointBindingStatus struct {
// Endpoints is the list of BindingEndpoints that are created for this EndpointBinding
// BoundEndpointStatus defines the observed state of BoundEndpoint
type BoundEndpointStatus struct {
// Endpoints is the list of BindingEndpoints that are created for this BoundEndpoint
//
// Note: The collection of Endpoints per Binding are Many-to-One
// The uniqueness of each Endpoint is not ID, but rather the 4-tuple <scheme,service-name,namespace,port>
// All Endpoints bound to a EndpointBinding will share the same 4-tuple, statuses, errors, etc...
// this is because EndpointBinding represents 1 Service, yet many Endpoints
// All Endpoints bound to a BoundEndpoint will share the same 4-tuple, statuses, errors, etc...
// this is because BoundEndpoint represents 1 Service, yet many Endpoints
//
// +kubebuilder:validation:Required
Endpoints []BindingEndpoint `json:"endpoints"`
Expand Down Expand Up @@ -156,29 +156,29 @@ const (
// +kubebuilder:object:root=true
// +kubebuilder:subresource:status

// EndpointBinding is the Schema for the endpointbindings API
// BoundEndpoint is the Schema for the boundendpoints API
// +kubebuilder:printcolumn:name="URI",type="string",JSONPath=".spec.endpointURI"
// +kubebuilder:printcolumn:name="Port",type="string",JSONPath=".spec.port"
// +kubebuilder:printcolumn:name="Status",type="string",JSONPath=".status.endpoints[0].status"
// +kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp`,description="Age"
type EndpointBinding struct {
type BoundEndpoint struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

Spec EndpointBindingSpec `json:"spec,omitempty"`
Status EndpointBindingStatus `json:"status,omitempty"`
Spec BoundEndpointSpec `json:"spec,omitempty"`
Status BoundEndpointStatus `json:"status,omitempty"`
}

// +kubebuilder:object:root=true
// +kubebuilder:rbac:groups=core,resources=services,verbs=get;create;update;delete;list;watch

// EndpointBindingList contains a list of EndpointBinding
type EndpointBindingList struct {
// BoundEndpointList contains a list of BoundEndpoint
type BoundEndpointList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []EndpointBinding `json:"items"`
Items []BoundEndpoint `json:"items"`
}

func init() {
SchemeBuilder.Register(&EndpointBinding{}, &EndpointBindingList{})
SchemeBuilder.Register(&BoundEndpoint{}, &BoundEndpointList{})
}
38 changes: 19 additions & 19 deletions api/bindings/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion api/ngrok/v1alpha1/kubernetesoperator_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ type KubernetesOperatorBinding struct {
// +kubebuilder:validation:Pattern=`^k8s[/][a-zA-Z0-9-]{1,63}$`
Name string `json:"name,omitempty"`

// AllowedURLs is a list of URI patterns ([scheme://]<service-name>.<namespace-name>) thet determine which EndpointBindings are allowed to be created by the operator
// AllowedURLs is a list of URI patterns ([scheme://]<service-name>.<namespace-name>) thet determine which BoundEndpoints are allowed to be created by the operator
// TODO(hkatz) We are only implementing `*` for now
// Support more patterns in the future, see product spec
// +kubebuilder:validation:Required
Expand Down
12 changes: 6 additions & 6 deletions cmd/api/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -472,26 +472,26 @@ func enableGatewayFeatureSet(_ context.Context, _ managerOpts, mgr ctrl.Manager,

// enableBindingsFeatureSet enables the Bindings feature set for the operator
func enableBindingsFeatureSet(_ context.Context, opts managerOpts, mgr ctrl.Manager, _ *store.Driver, _ ngrokapi.Clientset) error {
// EndpointBindings
if err := (&bindingscontroller.EndpointBindingReconciler{
// BoundEndpoints
if err := (&bindingscontroller.BoundEndpointReconciler{
Client: mgr.GetClient(),
Scheme: mgr.GetScheme(),
Log: ctrl.Log.WithName("controllers").WithName("EndpointBinding"),
Log: ctrl.Log.WithName("controllers").WithName("BoundEndpoint"),
Recorder: mgr.GetEventRecorderFor("bindings-controller"),
ClusterDomain: opts.clusterDomain,
UpstreamServiceLabelSelector: map[string]string{
"app.kubernetes.io/component": "bindings-forwarder",
},
}).SetupWithManager(mgr); err != nil {
setupLog.Error(err, "unable to create controller", "controller", "EndpointBinding")
setupLog.Error(err, "unable to create controller", "controller", "BoundEndpoint")
os.Exit(1)
}

// Create a new Runnable that implements Start that the manager can manage running
if err := mgr.Add(&bindingscontroller.EndpointBindingPoller{
if err := mgr.Add(&bindingscontroller.BoundEndpointPoller{
Client: mgr.GetClient(),
Scheme: mgr.GetScheme(),
Log: ctrl.Log.WithName("controllers").WithName("EndpointBindingPoller"),
Log: ctrl.Log.WithName("controllers").WithName("BoundEndpointPoller"),
Recorder: mgr.GetEventRecorderFor("endpoint-binding-poller"),
Namespace: opts.namespace,
KubernetesOperatorConfigName: opts.releaseName,
Expand Down
2 changes: 1 addition & 1 deletion helm/ngrok-operator/templates/bindings-forwarder/rbac.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ rules:
- apiGroups:
- bindings.k8s.ngrok.com
resources:
- endpointbindings
- boundendpoints
verbs:
- get
- list
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

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
@@ -1,16 +1,16 @@
# permissions for end users to edit endpointbindings
# permissions for end users to edit boundendpoints
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
labels:
{{- include "ngrok-operator.labels" . | nindent 4 }}
app.kubernetes.io/component: rbac
name: {{ include "ngrok-operator.fullname" . }}-endpointbinding-editor-role
name: {{ include "ngrok-operator.fullname" . }}-boundendpoint-editor-role
rules:
- apiGroups:
- ngrok.k8s.ngrok.com
resources:
- endpointbindings
- boundendpoints
verbs:
- create
- delete
Expand All @@ -22,6 +22,6 @@ rules:
- apiGroups:
- ngrok.k8s.ngrok.com
resources:
- endpointbindings/status
- boundendpoints/status
verbs:
- get
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
# permissions for end users to view endpointbindings
# permissions for end users to view boundendpoints
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
labels:
{{- include "ngrok-operator.labels" . | nindent 4 }}
app.kubernetes.io/component: rbac
name: {{ include "ngrok-operator.fullname" . }}-endpointbinding-viewer-role
name: {{ include "ngrok-operator.fullname" . }}-boundendpoint-viewer-role
rules:
- apiGroups:
- ngrok.k8s.ngrok.com
resources:
- endpointbindings
- boundendpoints
verbs:
- get
- list
- watch
- apiGroups:
- ngrok.k8s.ngrok.com
resources:
- endpointbindings/status
- boundendpoints/status
verbs:
- get

Expand Down
Loading

0 comments on commit 7c5b997

Please sign in to comment.