Skip to content

Commit

Permalink
add entrypoint to k8s cluster workload
Browse files Browse the repository at this point in the history
  • Loading branch information
Eslam-Nawara committed Sep 22, 2024
1 parent 6931594 commit 04933fb
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 4 deletions.
11 changes: 8 additions & 3 deletions grid-client/deployer/k8s_deployer.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ func (d *K8sDeployer) Deploy(ctx context.Context, k8sCluster *workloads.K8sClust
return err
}

assignNodesFlists(k8sCluster)
assignNodesFlistsAndEntryPoints(k8sCluster)

if err := d.Validate(ctx, k8sCluster); err != nil {
return err
Expand Down Expand Up @@ -141,7 +141,7 @@ func (d *K8sDeployer) BatchDeploy(ctx context.Context, k8sClusters []*workloads.
return err
}

assignNodesFlists(k8sCluster)
assignNodesFlistsAndEntryPoints(k8sCluster)

if err := d.Validate(ctx, k8sCluster); err != nil {
return err
Expand Down Expand Up @@ -471,13 +471,18 @@ func (d *K8sDeployer) assignNodesIPs(k8sCluster *workloads.K8sCluster) error {
return nil
}

func assignNodesFlists(k *workloads.K8sCluster) {
func assignNodesFlistsAndEntryPoints(k *workloads.K8sCluster) {
if k.Flist == "" {
k.Flist = k.Master.Flist
}
if k.Entrypoint == "" {
k.Entrypoint = k.Master.Entrypoint
}

k.Master.Flist = k.Flist
k.Master.Entrypoint = k.Entrypoint
for i := range k.Workers {
k.Workers[i].Flist = k.Flist
k.Workers[i].Entrypoint = k.Entrypoint
}
}
2 changes: 1 addition & 1 deletion grid-client/deployer/k8s_deployer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ func TestK8sDeployer(t *testing.T) {
t.Run("test validate master reachable", func(t *testing.T) {
k8sMockValidation(d.tfPluginClient.Identity, cl, sub, ncPool, proxyCl, d)

assignNodesFlists(&k8sCluster)
assignNodesFlistsAndEntryPoints(&k8sCluster)
err = d.Validate(context.Background(), &k8sCluster)
assert.NoError(t, err)
})
Expand Down
1 change: 1 addition & 0 deletions grid-client/workloads/k8s.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ type K8sCluster struct {

Flist string `json:"flist"`
FlistChecksum string `json:"flist_checksum"`
Entrypoint string `json:"entry_point"`

// optional
SolutionType string
Expand Down
1 change: 1 addition & 0 deletions grid-client/workloads/k8s_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ func TestK8sNodeData(t *testing.T) {
NetworkName: "network",
Flist: flist,
FlistChecksum: "e71ee7421f45392fbbb92309182e3006",
Entrypoint: "/sbin/zinit init",
}
})

Expand Down

0 comments on commit 04933fb

Please sign in to comment.