Skip to content

Commit

Permalink
add initial hiveutil
Browse files Browse the repository at this point in the history
first coutil -> hiveutil migration (right now only support aws-tag-deprovision subcommand)
  • Loading branch information
Joel Diaz committed Sep 20, 2018
1 parent efc39c6 commit ca98a4f
Show file tree
Hide file tree
Showing 3 changed files with 1,388 additions and 3 deletions.
10 changes: 7 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,17 @@ test: generate fmt vet manifests

# Builds all of hive's binaries (including utils).
.PHONY: build
build: manager
build: manager hiveutil


# Build manager binary
manager: generate fmt vet
go build -o bin/manager github.com/openshift/hive/cmd/manager

# Build hiveutil binary
hiveutil: fmt vet
go build -o bin/hiveutil github.com/openshift/hive/contrib/cmd/hiveutil

# Run against the configured Kubernetes cluster in ~/.kube/config
run: generate fmt vet
go run ./cmd/manager/main.go
Expand All @@ -36,11 +40,11 @@ manifests:

# Run go fmt against code
fmt:
go fmt ./pkg/... ./cmd/...
go fmt ./pkg/... ./cmd/... ./contrib/...

# Run go vet against code
vet:
go vet ./pkg/... ./cmd/...
go vet ./pkg/... ./cmd/... ./contrib/...

# Generate code
generate:
Expand Down
54 changes: 54 additions & 0 deletions contrib/cmd/hiveutil/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/*
Copyright 2018 The Kubernetes Authors.
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
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,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package main

import (
"fmt"
"os"

log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"

"github.com/openshift/hive/contrib/pkg/aws_tag_deprovision"
)

func main() {
log.SetOutput(os.Stdout)
log.SetLevel(log.DebugLevel)

cmd := NewCOUtilityCommand()

err := cmd.Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error occurred: %v\n", err)
os.Exit(1)
}
}

func NewCOUtilityCommand() *cobra.Command {
cmd := &cobra.Command{
Use: "hiveutil SUB-COMMAND",
Short: "Utilities for hive",
Long: "Contains various utilities for running and testing hive",
Run: func(cmd *cobra.Command, args []string) {
cmd.Usage()
},
}
cmd.AddCommand(aws_tag_deprovision.NewDeprovisionAWSWithTagsCommand())

return cmd
}
Loading

0 comments on commit ca98a4f

Please sign in to comment.