Skip to content

Commit

Permalink
update v0.54.0
Browse files Browse the repository at this point in the history
Signed-off-by: Williams Alejandro <[email protected]>
  • Loading branch information
walejandromt committed Feb 13, 2024
1 parent 2f954b1 commit 5457d78
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 11 deletions.
3 changes: 3 additions & 0 deletions api/v1alpha1/upstream_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ type UpstreamSpec struct {
}

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"`
Expand Down
2 changes: 1 addition & 1 deletion controllers/client_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ func (r *ClientReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctr
pod, err := builder.NewPodBuilder().
SetName(client.Name).
SetNamespace(client.Namespace).
SetImage("fatedier/frpc:v0.43.0").
SetImage("fatedier/frpc:v0.54.0").
Build()
if err != nil {
return ctrl.Result{}, err
Expand Down
2 changes: 1 addition & 1 deletion pkg/client/builder/configmap_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func (n *ConfigMapBuilder) SetNamespace(namespace string) *ConfigMapBuilder {

func (n *ConfigMapBuilder) Build() (*corev1.ConfigMap, error) {
data := make(map[string]string)
data["config.ini"] = n.Config
data["config.toml"] = n.Config

configMap := &corev1.ConfigMap{
ObjectMeta: metav1.ObjectMeta{
Expand Down
2 changes: 1 addition & 1 deletion pkg/client/builder/pod_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func (n *PodBuilder) Build() (*corev1.Pod, error) {
{
Name: "frpc",
Image: n.Image,
Command: []string{"frpc", "-c", "/frp/config.ini"},
Command: []string{"frpc", "-c", "/frp/config.toml"},
Ports: []corev1.ContainerPort{
{ContainerPort: int32(4040)},
},
Expand Down
3 changes: 3 additions & 0 deletions pkg/client/models/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ type Upstream struct {
}

type Upstream_TCP struct {
Name string
Type string
SubDomain string
Host string
Port int
ServerPort int
Expand Down
20 changes: 12 additions & 8 deletions pkg/client/utils/template.go
Original file line number Diff line number Diff line change
@@ -1,23 +1,27 @@
package utils

const CLIENT_TEMPLATE = `
# frpc.toml
[common]
server_addr = {{ .Common.ServerAddress }}
server_port = {{ .Common.ServerPort }}
serverAddr = {{ .Common.ServerAddress }}
serverPort = {{ .Common.ServerPort }}
{{ if eq .Common.ServerAuthentication.Type 1 }}
token = {{ .Common.ServerAuthentication.Token }}
auth.method = "token"
auth.token = {{ .Common.ServerAuthentication.Token }}
{{ end }}
admin_addr = {{ .Common.AdminAddress }}
admin_port = {{ .Common.AdminPort }}
admin_user = {{ .Common.AdminUsername }}
admin_pwd = {{ .Common.AdminPassword }}
webServer.addr = {{ .Common.AdminAddress }}
webServer.port = {{ .Common.AdminPort }}
webServer.user = {{ .Common.AdminUsername }}
webServer.password = {{ .Common.AdminPassword }}
{{ range $upstream := .Upstreams }}
[{{ $upstream.Name }}]
{{ if eq $upstream.Type 1 }}
type = tcp
name = {{ $upstream.TCP.Name }}
type = {{ $upstream.TCP.Type }}
subdomain = {{ $upstream.TCP.SubDomain }}
local_ip = {{ $upstream.TCP.Host }}
local_port = {{ $upstream.TCP.Port }}
remote_port = {{ $upstream.TCP.ServerPort }}
Expand Down

0 comments on commit 5457d78

Please sign in to comment.