Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added externalProxy parameter for UI #308

Merged
merged 1 commit into from
Jul 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions api/v1/ytsaurus_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -485,6 +485,10 @@ type UISpec struct {
Resources corev1.ResourceRequirements `json:"resources,omitempty"`
InstanceCount int32 `json:"instanceCount,omitempty"`

// If defined it will be used for direct heavy url/commands like: read_table, write_table, etc.
//+optional
ExternalProxy *string `json:"externalProxy,omitempty"`
// Odin is a service for monitoring the availability of YTsaurus clusters.
//+optional
OdinBaseUrl *string `json:"odinBaseUrl,omitempty"`

Expand Down
5 changes: 5 additions & 0 deletions api/v1/zz_generated.deepcopy.go

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

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 @@ -34214,6 +34214,10 @@ spec:
environment:
default: testing
type: string
externalProxy:
description: 'If defined it will be used for direct heavy url/commands
like: read_table, write'
type: string
extraEnvVariables:
items:
description: EnvVar represents an environment variable present
Expand Down Expand Up @@ -34327,6 +34331,8 @@ spec:
format: int32
type: integer
odinBaseUrl:
description: Odin is a service for monitoring the availability
of YTsaurus clusters.
type: string
resources:
description: ResourceRequirements describes the compute resource
Expand Down
3 changes: 2 additions & 1 deletion docs/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -1544,7 +1544,8 @@ _Appears in:_
| `useInsecureCookies` _boolean_ | | true | |
| `resources` _[ResourceRequirements](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.28/#resourcerequirements-v1-core)_ | | | |
| `instanceCount` _integer_ | | | |
| `odinBaseUrl` _string_ | | | |
| `externalProxy` _string_ | If defined it will be used for direct heavy url/commands like: read_table, write_table, etc. | | |
| `odinBaseUrl` _string_ | Odin is a service for monitoring the availability of YTsaurus clusters. | | |
| `extraEnvVariables` _[EnvVar](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.28/#envvar-v1-core) array_ | | | |
| `environment` _string_ | | testing | |
| `theme` _string_ | | lavander | |
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
clusters=[
{
id=test;
name=test;
proxy="http-proxies-lb-test.fake.svc.fake.zone";
externalProxy="https://my-external-proxy.example.com";
secure=%false;
authentication=basic;
group="My YTsaurus clusters";
theme="";
environment="";
description="My first YTsaurus. Handle with care.";
primaryMaster={
cellTag=0;
};
};
];
}
1 change: 1 addition & 0 deletions pkg/ytconfig/generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -684,6 +684,7 @@ func (g *Generator) GetUIClustersConfig() ([]byte, error) {
c.ID = g.ytsaurus.Name
c.Name = g.ytsaurus.Name
c.Proxy = g.GetHTTPProxiesAddress(consts.DefaultHTTPProxyRole)
c.ExternalProxy = g.ytsaurus.Spec.UI.ExternalProxy
c.PrimaryMaster.CellTag = g.ytsaurus.Spec.PrimaryMasters.CellTag

c.Theme = g.ytsaurus.Spec.UI.Theme
Expand Down
11 changes: 10 additions & 1 deletion pkg/ytconfig/generator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,13 @@ func TestGetUIClustersConfig(t *testing.T) {
canonize.Assert(t, cfg)
}

func TestGetUIClustersConfigWithSettings(t *testing.T) {
g := NewGenerator(withUICustom(getYtsaurus()), testClusterDomain)
cfg, err := g.GetUIClustersConfig()
require.NoError(t, err)
canonize.Assert(t, cfg)
}

func TestGetUICustomConfig(t *testing.T) {
g := NewGenerator(withUICustom(getYtsaurus()), testClusterDomain)
cfg, err := g.GetUICustomConfig()
Expand Down Expand Up @@ -616,8 +623,10 @@ func withUI(ytsaurus *ytv1.Ytsaurus) *ytv1.Ytsaurus {

func withUICustom(ytsaurus *ytv1.Ytsaurus) *ytv1.Ytsaurus {
odinUrl := "http://odin-webservice.odin.svc.cluster.local"
externalProxy := "https://my-external-proxy.example.com"
ytsaurus.Spec.UI = &ytv1.UISpec{
OdinBaseUrl: &odinUrl,
ExternalProxy: &externalProxy,
OdinBaseUrl: &odinUrl,
}
return ytsaurus
}
Expand Down
1 change: 1 addition & 0 deletions pkg/ytconfig/ui.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ type UICluster struct {
ID string `yson:"id"`
Name string `yson:"name"`
Proxy string `yson:"proxy"`
ExternalProxy *string `yson:"externalProxy,omitempty"`
Secure bool `yson:"secure"`
Authentication UIAuthenticationType `yson:"authentication"`
Group string `yson:"group"`
Expand Down
6 changes: 6 additions & 0 deletions ytop-chart/templates/ytsaurus-crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34003,6 +34003,10 @@ spec:
environment:
default: testing
type: string
externalProxy:
description: 'If defined it will be used for direct heavy url/commands
like: read_table, write'
type: string
extraEnvVariables:
items:
description: EnvVar represents an environment variable present
Expand Down Expand Up @@ -34114,6 +34118,8 @@ spec:
format: int32
type: integer
odinBaseUrl:
description: Odin is a service for monitoring the availability of
YTsaurus clusters.
type: string
resources:
description: ResourceRequirements describes the compute resource
Expand Down
Loading