Skip to content

Commit

Permalink
Move sparkctl to cmd directory (kubeflow#2347)
Browse files Browse the repository at this point in the history
* Move spark-operator

Signed-off-by: Yi Chen <[email protected]>

* Move sparkctl to cmd directory

Signed-off-by: Yi Chen <[email protected]>

* Remove unnecessary app package/directory

Signed-off-by: Yi Chen <[email protected]>

---------

Signed-off-by: Yi Chen <[email protected]>
  • Loading branch information
ChenYi015 authored Dec 6, 2024
1 parent 5dd91c4 commit 2375a30
Show file tree
Hide file tree
Showing 21 changed files with 30 additions and 51 deletions.
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -173,12 +173,12 @@ override LDFLAGS += \
.PHONY: build-operator
build-operator: ## Build Spark operator.
echo "Building spark-operator binary..."
go build -o $(SPARK_OPERATOR) -ldflags '${LDFLAGS}' cmd/main.go
go build -o $(SPARK_OPERATOR) -ldflags '${LDFLAGS}' cmd/operator/main.go

.PHONY: build-sparkctl
build-sparkctl: ## Build sparkctl binary.
echo "Building sparkctl binary..."
CGO_ENABLED=0 go build -o $(SPARKCTL) -buildvcs=false sparkctl/main.go
CGO_ENABLED=0 go build -o $(SPARKCTL) -buildvcs=false cmd/sparkctl/main.go

.PHONY: install-sparkctl
install-sparkctl: build-sparkctl ## Install sparkctl binary.
Expand All @@ -191,7 +191,7 @@ clean: ## Clean spark-operator and sparktcl binaries.
rm -f $(SPARKCTL)

.PHONY: build-api-docs
build-api-docs: gen-crd-api-reference-docs ## Build api documentaion.
build-api-docs: gen-crd-api-reference-docs ## Build api documentation.
$(GEN_CRD_API_REFERENCE_DOCS) \
-config hack/api-docs/config.json \
-api-dir github.com/kubeflow/spark-operator/api/v1beta2 \
Expand Down
31 changes: 0 additions & 31 deletions cmd/main.go

This file was deleted.

14 changes: 12 additions & 2 deletions cmd/operator/root.go → cmd/operator/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
Expand All @@ -14,9 +14,12 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

package operator
package main

import (
"fmt"
"os"

"github.com/spf13/cobra"

"github.com/kubeflow/spark-operator/cmd/operator/controller"
Expand All @@ -37,3 +40,10 @@ func NewCommand() *cobra.Command {
command.AddCommand(version.NewCommand())
return command
}

func main() {
if err := NewCommand().Execute(); err != nil {
fmt.Fprintf(os.Stderr, "%v\n", err)
os.Exit(1)
}
}
File renamed without changes.
2 changes: 1 addition & 1 deletion sparkctl/cmd/client.go → cmd/sparkctl/app/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

package cmd
package app

import (
"context"
Expand Down
2 changes: 1 addition & 1 deletion sparkctl/cmd/create.go → cmd/sparkctl/app/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

package cmd
package app

import (
"context"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

package cmd
package app

import (
"strings"
Expand Down
2 changes: 1 addition & 1 deletion sparkctl/cmd/delete.go → cmd/sparkctl/app/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

package cmd
package app

import (
"context"
Expand Down
2 changes: 1 addition & 1 deletion sparkctl/cmd/event.go → cmd/sparkctl/app/event.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

package cmd
package app

import (
"context"
Expand Down
2 changes: 1 addition & 1 deletion sparkctl/cmd/forward.go → cmd/sparkctl/app/forward.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

package cmd
package app

import (
"context"
Expand Down
2 changes: 1 addition & 1 deletion sparkctl/cmd/gcs.go → cmd/sparkctl/app/gcs.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

package cmd
package app

import (
"fmt"
Expand Down
2 changes: 1 addition & 1 deletion sparkctl/cmd/list.go → cmd/sparkctl/app/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

package cmd
package app

import (
"context"
Expand Down
2 changes: 1 addition & 1 deletion sparkctl/cmd/log.go → cmd/sparkctl/app/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

package cmd
package app

import (
"context"
Expand Down
2 changes: 1 addition & 1 deletion sparkctl/cmd/root.go → cmd/sparkctl/app/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

package cmd
package app

import (
"fmt"
Expand Down
2 changes: 1 addition & 1 deletion sparkctl/cmd/s3.go → cmd/sparkctl/app/s3.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

package cmd
package app

import (
"context"
Expand Down
2 changes: 1 addition & 1 deletion sparkctl/cmd/status.go → cmd/sparkctl/app/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

package cmd
package app

import (
"fmt"
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion sparkctl/cmd/utils.go → cmd/sparkctl/app/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

package cmd
package app

import (
"time"
Expand Down
4 changes: 2 additions & 2 deletions sparkctl/main.go → cmd/sparkctl/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ package main
import (
_ "k8s.io/client-go/plugin/pkg/client/auth"

"github.com/kubeflow/spark-operator/sparkctl/cmd"
"github.com/kubeflow/spark-operator/cmd/sparkctl/app"
)

func main() {
cmd.Execute()
app.Execute()
}

0 comments on commit 2375a30

Please sign in to comment.