-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
StaticService is a simple Service that wraps a static set of IP prefixes and can stand as a backend when we want to access to a set of known IP prefixes through STUNner. This is particularly useful when STUNner is used as a standalone public TURN server, where there is no Kubernetes service that would abstract the user base which is now outside the cluster.
- Loading branch information
Showing
20 changed files
with
1,314 additions
and
71 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
/* | ||
Copyright 2022 The l7mp/stunner team. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package v1alpha1 | ||
|
||
import ( | ||
corev1 "k8s.io/api/core/v1" | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
) | ||
|
||
//+kubebuilder:object:root=true | ||
// //+kubebuilder:subresource:status | ||
//+kubebuilder:resource:categories=stunner,shortName=ssvc | ||
|
||
// StaticService is a set of static IP address prefixes STUNner allows access to via a Route. The | ||
// purpose is to allow a Service-like CRD containing a set of static IP address prefixes to be set | ||
// as the backend of a UDPRoute (or TCPRoute). | ||
type StaticService struct { | ||
metav1.TypeMeta `json:",inline"` | ||
// +optional | ||
metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` | ||
|
||
// Spec defines the behavior of a service. | ||
Spec StaticServiceSpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` | ||
} | ||
|
||
// StaticServiceSpec describes the prefixes reachable via a StaticService. | ||
type StaticServiceSpec struct { | ||
// The list of ports reachable via this service (currently omitted). | ||
// +patchMergeKey=port | ||
// +patchStrategy=merge | ||
// +listType=map | ||
// +listMapKey=port | ||
// +listMapKey=protocol | ||
// +optional | ||
Ports []corev1.ServicePort `json:"ports,omitempty" patchStrategy:"merge" patchMergeKey:"port" protobuf:"bytes,1,rep,name=ports"` | ||
|
||
// Prefixes is a list of IP address prefixes reachable via this route. | ||
Prefixes []string `json:"prefixes"` | ||
} | ||
|
||
//+kubebuilder:object:root=true | ||
|
||
// StaticServiceList holds a list of static services. | ||
type StaticServiceList struct { | ||
metav1.TypeMeta `json:",inline"` | ||
// +optional | ||
metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` | ||
|
||
// List of services. | ||
Items []StaticService `json:"items"` | ||
} | ||
|
||
func init() { | ||
SchemeBuilder.Register(&StaticService{}, &StaticServiceList{}) | ||
} |
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
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
Oops, something went wrong.