-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
347 additions
and
0 deletions.
There are no files selected for viewing
11 changes: 11 additions & 0 deletions
11
pkg/components/canondata/TestConfigMerge/http_proxy_config_override.yson
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,11 @@ | ||
{ | ||
address_resolver = { | ||
force_tcp = %true; | ||
}; | ||
api = { | ||
concurrency_limit = 4000; | ||
}; | ||
cluster_connection = { | ||
thread_pool_size = 8; | ||
}; | ||
} |
153 changes: 153 additions & 0 deletions
153
pkg/components/canondata/TestConfigMerge/http_proxy_config_wo_override.yson
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,153 @@ | ||
{ | ||
"address_resolver"={ | ||
"enable_ipv4"=%true; | ||
"enable_ipv6"=%false; | ||
retries=1000; | ||
}; | ||
"solomon_exporter"={ | ||
host="{POD_SHORT_HOSTNAME}"; | ||
"instance_tags"={ | ||
pod="{K8S_POD_NAME}"; | ||
}; | ||
}; | ||
logging={ | ||
writers={ | ||
info={ | ||
type=file; | ||
"file_name"="/var/log/http-proxy.info.log"; | ||
format="plain_text"; | ||
"enable_system_messages"=%true; | ||
}; | ||
stderr={ | ||
type=stderr; | ||
format="plain_text"; | ||
"enable_system_messages"=%true; | ||
}; | ||
}; | ||
rules=[ | ||
{ | ||
"min_level"=info; | ||
writers=[ | ||
info; | ||
]; | ||
family="plain_text"; | ||
}; | ||
{ | ||
"min_level"=error; | ||
writers=[ | ||
stderr; | ||
]; | ||
family="plain_text"; | ||
}; | ||
]; | ||
"flush_period"=3000; | ||
}; | ||
"monitoring_port"=10016; | ||
"rpc_port"=9016; | ||
"timestamp_provider"={ | ||
addresses=[ | ||
"ms-test-0.masters-test.fake.svc.fake.zone:9010"; | ||
]; | ||
}; | ||
"cluster_connection"={ | ||
"cluster_name"=test; | ||
"primary_master"={ | ||
addresses=[ | ||
"ms-test-0.masters-test.fake.svc.fake.zone:9010"; | ||
]; | ||
peers=[ | ||
{ | ||
address="ms-test-0.masters-test.fake.svc.fake.zone:9010"; | ||
voting=%true; | ||
}; | ||
]; | ||
"cell_id"="65726e65-ad6b7562-259-79747361"; | ||
}; | ||
"discovery_connection"={ | ||
addresses=[ | ||
"ds-test-0.discovery-test.fake.svc.fake.zone:9020"; | ||
"ds-test-1.discovery-test.fake.svc.fake.zone:9020"; | ||
"ds-test-2.discovery-test.fake.svc.fake.zone:9020"; | ||
]; | ||
}; | ||
"master_cache"={ | ||
addresses=[ | ||
"msc-test-0.master-caches-test.fake.svc.fake.zone:9018"; | ||
"msc-test-1.master-caches-test.fake.svc.fake.zone:9018"; | ||
"msc-test-2.master-caches-test.fake.svc.fake.zone:9018"; | ||
]; | ||
"cell_id"="65726e65-ad6b7562-259-79747361"; | ||
"enable_master_cache_discovery"=%false; | ||
}; | ||
}; | ||
"cypress_annotations"={ | ||
"k8s_node_name"="{K8S_NODE_NAME}"; | ||
"k8s_pod_name"="{K8S_POD_NAME}"; | ||
"k8s_pod_namespace"="{K8S_POD_NAMESPACE}"; | ||
"physical_host"="{K8S_NODE_NAME}"; | ||
}; | ||
port=80; | ||
auth={ | ||
"cypress_cookie_manager"={ | ||
}; | ||
"cypress_user_manager"={ | ||
}; | ||
"cypress_token_authenticator"={ | ||
secure=%true; | ||
}; | ||
"oauth_service"={ | ||
host="oauth-host"; | ||
port=433; | ||
secure=%true; | ||
"user_info_endpoint"="user-info-endpoint"; | ||
"user_info_login_field"=login; | ||
"login_transformations"=[ | ||
{ | ||
"match_pattern"="(.*)@ytsaurus.team"; | ||
replacement="\\1"; | ||
}; | ||
]; | ||
}; | ||
"oauth_cookie_authenticator"={ | ||
}; | ||
"oauth_token_authenticator"={ | ||
}; | ||
"require_authentication"=%true; | ||
}; | ||
coordinator={ | ||
enable=%true; | ||
"default_role_filter"=default; | ||
}; | ||
driver={ | ||
"timestamp_provider"={ | ||
addresses=[ | ||
"ms-test-0.masters-test.fake.svc.fake.zone:9010"; | ||
]; | ||
}; | ||
"primary_master"={ | ||
addresses=[ | ||
"ms-test-0.masters-test.fake.svc.fake.zone:9010"; | ||
]; | ||
peers=[ | ||
{ | ||
address="ms-test-0.masters-test.fake.svc.fake.zone:9010"; | ||
voting=%true; | ||
}; | ||
]; | ||
"cell_id"="65726e65-ad6b7562-259-79747361"; | ||
}; | ||
}; | ||
role=control; | ||
"https_server"={ | ||
port=443; | ||
credentials={ | ||
"cert_chain"={ | ||
"file_name"="/tls/https_secret/tls.crt"; | ||
}; | ||
"private_key"={ | ||
"file_name"="/tls/https_secret/tls.key"; | ||
}; | ||
"update_period"=60000; | ||
}; | ||
}; | ||
} |
158 changes: 158 additions & 0 deletions
158
pkg/components/canondata/TestConfigMerge/test.canondata
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,158 @@ | ||
{ | ||
"address_resolver"={ | ||
"enable_ipv4"=%true; | ||
"enable_ipv6"=%false; | ||
"force_tcp"=%true; | ||
retries=1000; | ||
}; | ||
api={ | ||
"concurrency_limit"=4000; | ||
}; | ||
auth={ | ||
"cypress_cookie_manager"={ | ||
}; | ||
"cypress_token_authenticator"={ | ||
secure=%true; | ||
}; | ||
"cypress_user_manager"={ | ||
}; | ||
"oauth_cookie_authenticator"={ | ||
}; | ||
"oauth_service"={ | ||
host="oauth-host"; | ||
"login_transformations"=[ | ||
{ | ||
"match_pattern"="(.*)@ytsaurus.team"; | ||
replacement="\\1"; | ||
}; | ||
]; | ||
port=433; | ||
secure=%true; | ||
"user_info_endpoint"="user-info-endpoint"; | ||
"user_info_login_field"=login; | ||
}; | ||
"oauth_token_authenticator"={ | ||
}; | ||
"require_authentication"=%true; | ||
}; | ||
"cluster_connection"={ | ||
"cluster_name"=test; | ||
"discovery_connection"={ | ||
addresses=[ | ||
"ds-test-0.discovery-test.fake.svc.fake.zone:9020"; | ||
"ds-test-1.discovery-test.fake.svc.fake.zone:9020"; | ||
"ds-test-2.discovery-test.fake.svc.fake.zone:9020"; | ||
]; | ||
}; | ||
"master_cache"={ | ||
addresses=[ | ||
"msc-test-0.master-caches-test.fake.svc.fake.zone:9018"; | ||
"msc-test-1.master-caches-test.fake.svc.fake.zone:9018"; | ||
"msc-test-2.master-caches-test.fake.svc.fake.zone:9018"; | ||
]; | ||
"cell_id"="65726e65-ad6b7562-259-79747361"; | ||
"enable_master_cache_discovery"=%false; | ||
}; | ||
"primary_master"={ | ||
addresses=[ | ||
"ms-test-0.masters-test.fake.svc.fake.zone:9010"; | ||
]; | ||
"cell_id"="65726e65-ad6b7562-259-79747361"; | ||
peers=[ | ||
{ | ||
address="ms-test-0.masters-test.fake.svc.fake.zone:9010"; | ||
voting=%true; | ||
}; | ||
]; | ||
}; | ||
"thread_pool_size"=8; | ||
}; | ||
coordinator={ | ||
"default_role_filter"=default; | ||
enable=%true; | ||
}; | ||
"cypress_annotations"={ | ||
"k8s_node_name"="{K8S_NODE_NAME}"; | ||
"k8s_pod_name"="{K8S_POD_NAME}"; | ||
"k8s_pod_namespace"="{K8S_POD_NAMESPACE}"; | ||
"physical_host"="{K8S_NODE_NAME}"; | ||
}; | ||
driver={ | ||
"primary_master"={ | ||
addresses=[ | ||
"ms-test-0.masters-test.fake.svc.fake.zone:9010"; | ||
]; | ||
"cell_id"="65726e65-ad6b7562-259-79747361"; | ||
peers=[ | ||
{ | ||
address="ms-test-0.masters-test.fake.svc.fake.zone:9010"; | ||
voting=%true; | ||
}; | ||
]; | ||
}; | ||
"timestamp_provider"={ | ||
addresses=[ | ||
"ms-test-0.masters-test.fake.svc.fake.zone:9010"; | ||
]; | ||
}; | ||
}; | ||
"https_server"={ | ||
credentials={ | ||
"cert_chain"={ | ||
"file_name"="/tls/https_secret/tls.crt"; | ||
}; | ||
"private_key"={ | ||
"file_name"="/tls/https_secret/tls.key"; | ||
}; | ||
"update_period"=60000; | ||
}; | ||
port=443; | ||
}; | ||
logging={ | ||
"flush_period"=3000; | ||
rules=[ | ||
{ | ||
family="plain_text"; | ||
"min_level"=info; | ||
writers=[ | ||
info; | ||
]; | ||
}; | ||
{ | ||
family="plain_text"; | ||
"min_level"=error; | ||
writers=[ | ||
stderr; | ||
]; | ||
}; | ||
]; | ||
writers={ | ||
info={ | ||
"enable_system_messages"=%true; | ||
"file_name"="/var/log/http-proxy.info.log"; | ||
format="plain_text"; | ||
type=file; | ||
}; | ||
stderr={ | ||
"enable_system_messages"=%true; | ||
format="plain_text"; | ||
type=stderr; | ||
}; | ||
}; | ||
}; | ||
"monitoring_port"=10016; | ||
port=80; | ||
role=control; | ||
"rpc_port"=9016; | ||
"solomon_exporter"={ | ||
host="{POD_SHORT_HOSTNAME}"; | ||
"instance_tags"={ | ||
pod="{K8S_POD_NAME}"; | ||
}; | ||
}; | ||
"timestamp_provider"={ | ||
addresses=[ | ||
"ms-test-0.masters-test.fake.svc.fake.zone:9010"; | ||
]; | ||
}; | ||
} |
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,25 @@ | ||
package components | ||
|
||
import ( | ||
_ "embed" | ||
"testing" | ||
|
||
"github.com/stretchr/testify/require" | ||
|
||
"github.com/ytsaurus/ytsaurus-k8s-operator/pkg/canonize" | ||
) | ||
|
||
//go:embed canondata/TestConfigMerge/http_proxy_config_wo_override.yson | ||
var hpConfigWithoutOverride string | ||
|
||
//go:embed canondata/TestConfigMerge/http_proxy_config_override.yson | ||
var hpConfigOverride string | ||
|
||
func TestConfigMerge(t *testing.T) { | ||
merged, err := overrideYsonConfigs( | ||
[]byte(hpConfigWithoutOverride), | ||
[]byte(hpConfigOverride), | ||
) | ||
require.NoError(t, err) | ||
canonize.Assert(t, merged) | ||
} |