Skip to content

Commit

Permalink
TMP
Browse files Browse the repository at this point in the history
  • Loading branch information
l0kix2 committed Oct 10, 2024
1 parent c439d7c commit 58fd2b6
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 2 deletions.
19 changes: 17 additions & 2 deletions pkg/components/queue_agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -300,11 +300,26 @@ func (qa *QueueAgent) init(ctx context.Context, ytClient yt.Client) (err error)

func (qa *QueueAgent) prepareInitQueueAgentState() {
path := "/usr/bin/init_queue_agent_state"
proxy := qa.cfgen.GetHTTPProxiesServiceAddress(consts.DefaultHTTPProxyRole)

existenceCheck := fmt.Sprintf(
`if [[ ! -f \"%s\" ]] && echo "%s doesn't exist, nothing to do" && exit 0`,
path,
path,
)
oldVersionInvokation := fmt.Sprintf("%s --create-registration-table --create-replicated-table-mapping-table --recursive --ignore-existing --proxy %s;",
path,
proxy,
)
newVersionInvokation := fmt.Sprintf("%s --create-registration-table --create-replicated-table-mapping-table --recursive --ignore-existing --latest --proxy %s;",
path,
proxy,
)
script := []string{
initJobWithNativeDriverPrologue(),
fmt.Sprintf("if [[ -f \"%s\" ]]; then %s --create-registration-table --create-replicated-table-mapping-table --recursive --ignore-existing --proxy %s; fi",
path, path, qa.cfgen.GetHTTPProxiesServiceAddress(consts.DefaultHTTPProxyRole)),
existenceCheck,
`[[ "$YTSAURUS_VERSION" < "24.1" ]] &&` + oldVersionInvokation,
`[[ "$YTSAURUS_VERSION" >= "24.2" ]] &&` + newVersionInvokation,
}

qa.initQAState.SetInitScript(strings.Join(script, "\n"))
Expand Down
9 changes: 9 additions & 0 deletions pkg/testutil/spec_builders.go
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,15 @@ func WithQueryTracker(ytsaurus *ytv1.Ytsaurus) *ytv1.Ytsaurus {
return ytsaurus
}

func WithQueueAgent(ytsaurus *ytv1.Ytsaurus) *ytv1.Ytsaurus {
ytsaurus.Spec.QueueAgents = &ytv1.QueueAgentSpec{
InstanceSpec: ytv1.InstanceSpec{
InstanceCount: 1,
},
}
return ytsaurus
}

func WithRPCProxies(ytsaurus *ytv1.Ytsaurus) *ytv1.Ytsaurus {
ytsaurus.Spec.RPCProxies = []ytv1.RPCProxiesSpec{
createRPCProxiesSpec(),
Expand Down
1 change: 1 addition & 0 deletions test/e2e/ytsaurus_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -632,6 +632,7 @@ var _ = Describe("Basic test for Ytsaurus controller", func() {

ytsaurus := testutil.CreateBaseYtsaurusResource(namespace)
ytsaurus = testutil.WithQueryTracker(ytsaurus)
ytsaurus = testutil.WithQueueAgent(ytsaurus)

g := ytconfig.NewGenerator(ytsaurus, "local")

Expand Down

0 comments on commit 58fd2b6

Please sign in to comment.