Skip to content

Commit

Permalink
add forceTcp and keepSocket options
Browse files Browse the repository at this point in the history
  • Loading branch information
leo-astorsky authored Aug 13, 2024
1 parent 17369f6 commit 9e48e21
Show file tree
Hide file tree
Showing 40 changed files with 124 additions and 6 deletions.
7 changes: 7 additions & 0 deletions api/v1/ytsaurus_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -571,6 +571,13 @@ type CommonSpec struct {
//+kubebuilder:default:=false
//+optional
UseIPv4 bool `json:"useIpv4"`
//+kubebuilder:default:=true
//+optional
KeepSocket bool `json:"keepSocket"`
//+kubebuilder:default:=false
//+optional
ForceTcp bool `json:"forceTcp"`

//+kubebuilder:default:=true
//+optional
UseShortNames bool `json:"useShortNames"`
Expand Down
6 changes: 6 additions & 0 deletions config/crd/bases/cluster.ytsaurus.tech_remoteexecnodes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -689,6 +689,9 @@ spec:
additionalProperties:
type: string
type: object
forceTcp:
default: false
type: boolean
hostNetwork:
default: false
description: Use the host's network namespace for all components.
Expand Down Expand Up @@ -901,6 +904,9 @@ spec:
resources required.
type: object
type: object
keepSocket:
default: true
type: boolean
locations:
items:
properties:
Expand Down
6 changes: 6 additions & 0 deletions config/crd/bases/cluster.ytsaurus.tech_ytsaurus.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10024,6 +10024,9 @@ spec:
additionalProperties:
type: string
type: object
forceTcp:
default: false
type: boolean
hostNetwork:
default: false
description: Use the host's network namespace for all components.
Expand Down Expand Up @@ -12495,6 +12498,9 @@ spec:
jobImage:
description: Default docker image for user jobs.
type: string
keepSocket:
default: true
type: boolean
masterCaches:
properties:
affinity:
Expand Down
6 changes: 6 additions & 0 deletions docs/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,8 @@ _Appears in:_
| `ephemeralCluster` _boolean_ | Allow prioritizing performance over data safety. Useful for tests and experiments. | false | |
| `useIpv6` _boolean_ | | false | |
| `useIpv4` _boolean_ | | false | |
| `keepSocket` _boolean_ | | true | |
| `forceTcp` _boolean_ | | false | |
| `useShortNames` _boolean_ | | true | |
| `hostNetwork` _boolean_ | Use the host's network namespace for all components. | false | |
| `usePorto` _boolean_ | | false | |
Expand Down Expand Up @@ -1145,6 +1147,8 @@ _Appears in:_
| `ephemeralCluster` _boolean_ | Allow prioritizing performance over data safety. Useful for tests and experiments. | false | |
| `useIpv6` _boolean_ | | false | |
| `useIpv4` _boolean_ | | false | |
| `keepSocket` _boolean_ | | true | |
| `forceTcp` _boolean_ | | false | |
| `useShortNames` _boolean_ | | true | |
| `hostNetwork` _boolean_ | Use the host's network namespace for all components. | false | |
| `usePorto` _boolean_ | | false | |
Expand Down Expand Up @@ -1693,6 +1697,8 @@ _Appears in:_
| `ephemeralCluster` _boolean_ | Allow prioritizing performance over data safety. Useful for tests and experiments. | false | |
| `useIpv6` _boolean_ | | false | |
| `useIpv4` _boolean_ | | false | |
| `keepSocket` _boolean_ | | true | |
| `forceTcp` _boolean_ | | false | |
| `useShortNames` _boolean_ | | true | |
| `hostNetwork` _boolean_ | Use the host's network namespace for all components. | false | |
| `usePorto` _boolean_ | | false | |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
"address_resolver"={
"enable_ipv4"=%true;
"enable_ipv6"=%false;
"keep_socket"=%true;
"force_tcp"=%false;
retries=1000;
};
"solomon_exporter"={
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
"address_resolver"={
"enable_ipv4"=%true;
"enable_ipv6"=%false;
"keep_socket"=%true;
"force_tcp"=%false;
retries=1000;
};
"solomon_exporter"={
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
"address_resolver"={
"enable_ipv4"=%true;
"enable_ipv6"=%false;
"keep_socket"=%true;
"force_tcp"=%false;
retries=1000;
};
"solomon_exporter"={
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
"address_resolver"={
"enable_ipv4"=%true;
"enable_ipv6"=%false;
"keep_socket"=%true;
"force_tcp"=%false;
retries=1000;
};
"solomon_exporter"={
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
"address_resolver"={
"enable_ipv4"=%false;
"enable_ipv6"=%true;
"keep_socket"=%true;
"force_tcp"=%false;
retries=1000;
};
"solomon_exporter"={
Expand Down
2 changes: 2 additions & 0 deletions pkg/ytconfig/canondata/TestGetDiscoveryConfig/test.canondata
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
"address_resolver"={
"enable_ipv4"=%true;
"enable_ipv6"=%false;
"keep_socket"=%true;
"force_tcp"=%false;
retries=1000;
};
"solomon_exporter"={
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
"address_resolver"={
"enable_ipv4"=%true;
"enable_ipv6"=%false;
"keep_socket"=%true;
"force_tcp"=%false;
retries=1000;
};
"solomon_exporter"={
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
"address_resolver"={
"enable_ipv4"=%true;
"enable_ipv6"=%false;
"keep_socket"=%true;
"force_tcp"=%false;
retries=1000;
};
"solomon_exporter"={
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
"address_resolver"={
"enable_ipv4"=%true;
"enable_ipv6"=%false;
"keep_socket"=%true;
"force_tcp"=%false;
retries=1000;
};
"solomon_exporter"={
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
"address_resolver"={
"enable_ipv4"=%true;
"enable_ipv6"=%false;
"keep_socket"=%true;
"force_tcp"=%false;
retries=1000;
};
"solomon_exporter"={
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
"address_resolver"={
"enable_ipv4"=%true;
"enable_ipv6"=%false;
"keep_socket"=%true;
"force_tcp"=%false;
retries=1000;
};
"solomon_exporter"={
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
"address_resolver"={
"enable_ipv4"=%true;
"enable_ipv6"=%false;
"keep_socket"=%true;
"force_tcp"=%false;
retries=1000;
};
"solomon_exporter"={
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
"address_resolver"={
"enable_ipv4"=%false;
"enable_ipv6"=%true;
"keep_socket"=%true;
"force_tcp"=%false;
retries=1000;
};
"solomon_exporter"={
Expand Down
2 changes: 2 additions & 0 deletions pkg/ytconfig/canondata/TestGetHTTPProxyConfig/test.canondata
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
"address_resolver"={
"enable_ipv4"=%true;
"enable_ipv6"=%false;
"keep_socket"=%true;
"force_tcp"=%false;
retries=1000;
};
"solomon_exporter"={
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
"address_resolver"={
"enable_ipv4"=%true;
"enable_ipv6"=%false;
"keep_socket"=%true;
"force_tcp"=%false;
retries=1000;
};
"solomon_exporter"={
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
"address_resolver"={
"enable_ipv4"=%true;
"enable_ipv6"=%false;
"keep_socket"=%true;
"force_tcp"=%false;
retries=1000;
};
"solomon_exporter"={
Expand Down
2 changes: 2 additions & 0 deletions pkg/ytconfig/canondata/TestGetMasterConfig/test.canondata
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
"address_resolver"={
"enable_ipv4"=%true;
"enable_ipv6"=%false;
"keep_socket"=%true;
"force_tcp"=%false;
retries=1000;
};
"solomon_exporter"={
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
"address_resolver"={
"enable_ipv4"=%false;
"enable_ipv6"=%true;
"keep_socket"=%true;
"force_tcp"=%false;
retries=1000;
};
"solomon_exporter"={
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
"address_resolver"={
"enable_ipv4"=%true;
"enable_ipv6"=%false;
"keep_socket"=%true;
"force_tcp"=%false;
retries=1000;
};
logging={
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
"address_resolver"={
"enable_ipv4"=%true;
"enable_ipv6"=%false;
"keep_socket"=%true;
"force_tcp"=%false;
retries=1000;
};
"solomon_exporter"={
Expand Down
2 changes: 2 additions & 0 deletions pkg/ytconfig/canondata/TestGetQueueAgentConfig/test.canondata
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
"address_resolver"={
"enable_ipv4"=%true;
"enable_ipv6"=%false;
"keep_socket"=%true;
"force_tcp"=%false;
retries=1000;
};
"solomon_exporter"={
Expand Down
2 changes: 2 additions & 0 deletions pkg/ytconfig/canondata/TestGetRPCProxyConfig/test.canondata
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
"address_resolver"={
"enable_ipv4"=%true;
"enable_ipv6"=%false;
"keep_socket"=%true;
"force_tcp"=%false;
retries=1000;
};
"solomon_exporter"={
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
"address_resolver"={
"enable_ipv4"=%false;
"enable_ipv6"=%true;
"keep_socket"=%true;
"force_tcp"=%false;
retries=1000;
};
"solomon_exporter"={
Expand Down
2 changes: 2 additions & 0 deletions pkg/ytconfig/canondata/TestGetSchedulerConfig/test.canondata
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
"address_resolver"={
"enable_ipv4"=%true;
"enable_ipv6"=%false;
"keep_socket"=%true;
"force_tcp"=%false;
retries=1000;
};
"solomon_exporter"={
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
"address_resolver"={
"enable_ipv4"=%false;
"enable_ipv6"=%true;
"keep_socket"=%true;
"force_tcp"=%false;
retries=1000;
};
"solomon_exporter"={
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
chyt={
"address_resolver"={
"enable_ipv4"=%true;
"enable_ipv6"=%true;
"enable_ipv6"=%false;
"keep_socket"=%true;
"force_tcp"=%false;
retries=1000;
};
};
Expand Down
2 changes: 2 additions & 0 deletions pkg/ytconfig/canondata/TestGetTCPProxyConfig/test.canondata
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
"address_resolver"={
"enable_ipv4"=%true;
"enable_ipv6"=%false;
"keep_socket"=%true;
"force_tcp"=%false;
retries=1000;
};
"solomon_exporter"={
Expand Down
2 changes: 2 additions & 0 deletions pkg/ytconfig/canondata/TestGetTabletNodeConfig/test.canondata
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
"address_resolver"={
"enable_ipv4"=%true;
"enable_ipv6"=%false;
"keep_socket"=%true;
"force_tcp"=%false;
retries=1000;
};
"solomon_exporter"={
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
"address_resolver"={
"enable_ipv4"=%false;
"enable_ipv6"=%true;
"keep_socket"=%true;
"force_tcp"=%false;
retries=1000;
};
"solomon_exporter"={
Expand Down
2 changes: 2 additions & 0 deletions pkg/ytconfig/canondata/TestGetYQLAgentConfig/test.canondata
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
"address_resolver"={
"enable_ipv4"=%true;
"enable_ipv6"=%false;
"keep_socket"=%true;
"force_tcp"=%false;
retries=1000;
};
"solomon_exporter"={
Expand Down
15 changes: 13 additions & 2 deletions pkg/ytconfig/chyt.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,18 @@ type ChytInitCluster struct {
Families []string `yson:"families"`
}

func getStrawberryController() StrawberryController {
type ChytConfig struct {
AddressResolver AddressResolver `yson:"address_resolver"`
}

func getStrawberryController(resolver *AddressResolver) StrawberryController {
chytConfig := ChytConfig{
AddressResolver: *resolver,
}
chytYsonConfig, err := marshallYsonConfig(chytConfig)
if err != nil {
chytYsonConfig = yson.RawValue("{address_resolver={enable_ipv4=%true;enable_ipv6=%true;retries=1000}}")
}
return StrawberryController{
Strawberry: Strawberry{
Root: "//sys/strawberry",
Expand All @@ -36,7 +47,7 @@ func getStrawberryController() StrawberryController {
RobotUsername: consts.StrawberryControllerUserName,
},
Controllers: map[string]yson.RawValue{
"chyt": yson.RawValue("{address_resolver={enable_ipv4=%true;enable_ipv6=%true;retries=1000}}"),
"chyt": chytYsonConfig,
},
HTTPAPIEndpoint: fmt.Sprintf(":%v", consts.StrawberryHTTPAPIPort),
}
Expand Down
2 changes: 2 additions & 0 deletions pkg/ytconfig/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ type ClusterConnection struct {
type AddressResolver struct {
EnableIPv4 bool `yson:"enable_ipv4"`
EnableIPv6 bool `yson:"enable_ipv6"`
KeepSocket bool `yson:"keep_socket"`
ForceTcp bool `yson:"force_tcp"`
Retries *int `yson:"retries,omitempty"`

LocalhostNameOverride *string `yson:"localhost_name_override,omitempty"`
Expand Down
Loading

0 comments on commit 9e48e21

Please sign in to comment.