Skip to content

Commit

Permalink
feat: adding support for UDP & TCP healthcheck
Browse files Browse the repository at this point in the history
  • Loading branch information
zufardhiyaulhaq committed Apr 4, 2024
1 parent aea8c5a commit a97e7da
Show file tree
Hide file tree
Showing 10 changed files with 256 additions and 150 deletions.
23 changes: 19 additions & 4 deletions api/v1alpha1/upstream_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,24 +24,39 @@ import (
type UpstreamSpec struct {
Client string `json:"client"`
TCP *UpstreamSpec_TCP `json:"tcp"`
UDP *UpstreamSpec_UDP `json:"udp"`
}

type UpstreamSpec_TCP struct {
Name string `json:"name"`
Type string `json:"type"`
SubDomain string `json:"subdomain"`
Host string `json:"host"`
Port int `json:"port"`
Server UpstreamSpec_TCP_Server `json:"server"`
// +kubebuilder:validation:Enum=v1;v2
// +optional
ProxyProtocol *string `json:"proxyProtocol"`
ProxyProtocol *string `json:"proxyProtocol"`
HealthCheck *UpstreamSpec_TCP_HealthCheck `json:"healthCheck"`
}

type UpstreamSpec_TCP_Server struct {
Port int `json:"port"`
}

type UpstreamSpec_TCP_HealthCheck struct {
TimeoutSeconds int `json:"timeoutSeconds"`
MaxFailed int `json:"maxFailed"`
IntervalSeconds int `json:"intervalSeconds"`
}

type UpstreamSpec_UDP struct {
Host string `json:"host"`
Port int `json:"port"`
Server UpstreamSpec_UDP_Server `json:"server"`
}

type UpstreamSpec_UDP_Server struct {
Port int `json:"port"`
}

// UpstreamStatus defines the observed state of Upstream
type UpstreamStatus struct {
}
Expand Down
56 changes: 56 additions & 0 deletions api/v1alpha1/zz_generated.deepcopy.go

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

34 changes: 33 additions & 1 deletion charts/frp-operator/crds/crds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ status:
conditions: []
storedVersions: []
---
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
Expand Down Expand Up @@ -125,6 +124,19 @@ spec:
type: string
tcp:
properties:
healthCheck:
properties:
intervalSeconds:
type: integer
maxFailed:
type: integer
timeoutSeconds:
type: integer
required:
- intervalSeconds
- maxFailed
- timeoutSeconds
type: object
host:
type: string
port:
Expand All @@ -142,13 +154,33 @@ spec:
- port
type: object
required:
- healthCheck
- host
- port
- server
type: object
udp:
properties:
host:
type: string
port:
type: integer
server:
properties:
port:
type: integer
required:
- port
type: object
required:
- host
- port
- server
type: object
required:
- client
- tcp
- udp
type: object
status:
description: UpstreamStatus defines the observed state of Upstream
Expand Down
Binary file modified charts/releases/frp-operator-1.1.0.tgz
Binary file not shown.
8 changes: 4 additions & 4 deletions charts/releases/index.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ entries:
frp-operator:
- apiVersion: v2
appVersion: 0.3.0
created: "2024-04-02T14:38:16.145718+07:00"
created: "2024-04-04T22:25:33.990033+07:00"
description: Expose your service in Kubernetes to the Internet with open source
FRP!
digest: 68c46081075922ae453f2767f7359d67f338891220c049106fd73d17e1223b9b
digest: b3c9f018a4f8fbd3a94f2c19ed72e99276b5fd7e59468f8109ab479e7230aab7
home: https://github.com/zufardhiyaulhaq/frp-operator
maintainers:
- email: [email protected]
Expand All @@ -19,7 +19,7 @@ entries:
version: 1.1.0
- apiVersion: v2
appVersion: 0.2.0
created: "2024-04-02T14:38:16.14494+07:00"
created: "2024-04-04T22:25:33.988819+07:00"
description: Expose your service in Kubernetes to the Internet with open source
FRP!
digest: 5f80631b3ce1dad5ed2039abb144506fa5795d378f4d465d33c475f216b77df1
Expand All @@ -33,4 +33,4 @@ entries:
urls:
- frp-operator-1.0.0.tgz
version: 1.0.0
generated: "2024-04-02T14:38:16.142679+07:00"
generated: "2024-04-04T22:25:33.985268+07:00"
33 changes: 33 additions & 0 deletions config/crd/bases/frp.zufardhiyaulhaq.com_upstreams.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,19 @@ spec:
type: string
tcp:
properties:
healthCheck:
properties:
intervalSeconds:
type: integer
maxFailed:
type: integer
timeoutSeconds:
type: integer
required:
- intervalSeconds
- maxFailed
- timeoutSeconds
type: object
host:
type: string
port:
Expand All @@ -56,13 +69,33 @@ spec:
- port
type: object
required:
- healthCheck
- host
- port
- server
type: object
udp:
properties:
host:
type: string
port:
type: integer
server:
properties:
port:
type: integer
required:
- port
type: object
required:
- host
- port
- server
type: object
required:
- client
- tcp
- udp
type: object
status:
description: UpstreamStatus defines the observed state of Upstream
Expand Down
36 changes: 18 additions & 18 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ require (
)

require (
cloud.google.com/go/compute v1.5.0 // indirect
cloud.google.com/go/compute v1.19.0 // indirect
cloud.google.com/go/compute/metadata v0.2.3 // indirect
github.com/Azure/go-autorest v14.2.0+incompatible // indirect
github.com/Azure/go-autorest/autorest v0.11.18 // indirect
github.com/Azure/go-autorest/autorest/adal v0.9.13 // indirect
Expand All @@ -25,17 +26,17 @@ require (
github.com/emicklei/go-restful v2.9.5+incompatible // indirect
github.com/evanphx/json-patch v4.12.0+incompatible // indirect
github.com/form3tech-oss/jwt-go v3.2.3+incompatible // indirect
github.com/fsnotify/fsnotify v1.5.4 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/go-logr/logr v1.2.0 // indirect
github.com/go-logr/zapr v1.2.0 // indirect
github.com/go-openapi/jsonpointer v0.19.5 // indirect
github.com/go-openapi/jsonreference v0.19.5 // indirect
github.com/go-openapi/swag v0.19.14 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/google/gnostic v0.5.7-v3refs // indirect
github.com/google/go-cmp v0.5.7 // indirect
github.com/google/go-cmp v0.5.9 // indirect
github.com/google/gofuzz v1.1.0 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/imdario/mergo v0.3.12 // indirect
Expand All @@ -53,24 +54,23 @@ require (
github.com/prometheus/common v0.32.1 // indirect
github.com/prometheus/procfs v0.7.3 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/stretchr/testify v1.7.1 // indirect
go.uber.org/atomic v1.7.0 // indirect
go.uber.org/multierr v1.6.0 // indirect
go.uber.org/zap v1.19.1 // indirect
golang.org/x/crypto v0.0.0-20220411220226-7b82a4e95df4 // indirect
golang.org/x/net v0.0.0-20220412020605-290c469a71a5 // indirect
golang.org/x/oauth2 v0.0.0-20220411215720-9780585627b5 // indirect
golang.org/x/sys v0.0.0-20220422013727-9388b58f7150 // indirect
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 // indirect
golang.org/x/text v0.3.7 // indirect
golang.org/x/time v0.0.0-20220210224613-90d013bbcef8 // indirect
golang.org/x/xerrors v0.0.0-20220411194840-2f41105eb62f // indirect
github.com/stretchr/testify v1.8.3 // indirect
go.uber.org/atomic v1.9.0 // indirect
go.uber.org/multierr v1.8.0 // indirect
go.uber.org/zap v1.21.0 // indirect
golang.org/x/crypto v0.20.0 // indirect
golang.org/x/net v0.21.0 // indirect
golang.org/x/oauth2 v0.7.0 // indirect
golang.org/x/sys v0.17.0 // indirect
golang.org/x/term v0.17.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/time v0.1.0 // indirect
gomodules.xyz/jsonpatch/v2 v2.2.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/protobuf v1.28.0 // indirect
google.golang.org/protobuf v1.30.0 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/apiextensions-apiserver v0.23.5 // indirect
k8s.io/component-base v0.23.5 // indirect
k8s.io/klog/v2 v2.60.1 // indirect
Expand Down
Loading

0 comments on commit a97e7da

Please sign in to comment.