Skip to content

Commit

Permalink
Add yqla token file in container (#140)
Browse files Browse the repository at this point in the history
* Add yqla token file in container

* Codestyle

* Canonize

* Remove trailing newline in yqla token file

---------

Co-authored-by: Marina Pereskokova <[email protected]>
  • Loading branch information
Krisha11 and Marina Pereskokova authored Apr 4, 2024
1 parent ea2f734 commit 939f38c
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions pkg/components/yql_agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ func (yqla *YqlAgent) doSync(ctx context.Context, dry bool) (ComponentStatus, er
if !dry {
ss := yqla.server.buildStatefulSet()
container := &ss.Spec.Template.Spec.Containers[0]
container.Command = []string{"sh", "-c", fmt.Sprintf("echo -n $YT_TOKEN > %s; %s", consts.DefaultYqlTokenPath, strings.Join(container.Command, " "))}
container.EnvFrom = []corev1.EnvFromSource{yqla.secret.GetEnvSource()}
if yqla.ytsaurus.GetResource().Spec.UseIPv6 && !yqla.ytsaurus.GetResource().Spec.UseIPv4 {
container.Env = []corev1.EnvVar{{Name: "YT_FORCE_IPV4", Value: "0"}, {Name: "YT_FORCE_IPV6", Value: "1"}}
Expand Down
4 changes: 3 additions & 1 deletion pkg/consts/defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@ const DefaultCABundlePath = "/etc/ssl/certs/ca-certificates.crt"

const UIUserName = "robot-ui"
const StrawberryControllerUserName = "robot-strawberry-controller"
const YqlUserName = "yql_agent"
const YtsaurusOperatorUserName = "robot-yt-k8s-operator"

const YqlUserName = "yql_agent"
const DefaultYqlTokenPath = "/usr/yql_agent_token"

const StartUID = 19500

const DefaultHTTPProxyRole = "default"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@
];
};
"yql_plugin_shared_library"="/usr/lib/yql/libyqlplugin.so";
"yt_token_path"="/usr/yql_agent_token";
"mr_job_binary"="/usr/bin/mrjob";
"udf_directory"="/usr/lib/yql";
"additional_clusters"={
Expand Down
2 changes: 2 additions & 0 deletions pkg/ytconfig/yql_agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ type GatewayConfig struct {
type YQLAgent struct {
GatewayConfig GatewayConfig `yson:"gateway_config"`
YqlPluginSharedLibrary string `yson:"yql_plugin_shared_library"`
YTTokenPath string `yson:"yt_token_path"`

// For backward compatibility.
MRJobBinary string `yson:"mr_job_binary"`
Expand Down Expand Up @@ -55,6 +56,7 @@ func getYQLAgentServerCarcass(spec *ytv1.YQLAgentSpec) (YQLAgentServer, error) {
// For backward compatibility.
c.YQLAgent.UDFDirectory = "/usr/lib/yql"
c.YQLAgent.MRJobBinary = "/usr/bin/mrjob"
c.YQLAgent.YTTokenPath = consts.DefaultYqlTokenPath

c.Logging = getYQLAgentLogging(spec)

Expand Down

0 comments on commit 939f38c

Please sign in to comment.