diff --git a/README.md b/README.md index 0395027..7870571 100644 --- a/README.md +++ b/README.md @@ -73,7 +73,7 @@ Persistent storage is implemented using [Ceph Object Storage](https://ceph.io/ce ### On Edge #### Gstreamer - Gstreamer AI plugin to run analytics on low resource devices @Aditya +Gstreamer is an open source multimedia framework for managing media files and real time streaming using camera. This project leverages gstreamer capabilities with CNN model based enchanced analytics from OpenVino toolkit by Intel. This can be used to perform HLS video streaming with various use cases such as object detection, classification, recognition and tracking. #### TensorFlow lite @@ -82,25 +82,29 @@ Persistent storage is implemented using [Ceph Object Storage](https://ceph.io/ce ## Command Reference -| Command1 (Tool) | Command2(Module) | Command3(Module command) | Argument (module input) | Flags | Function | -|-------------------|------------------|--------------------------|-------------------------------------|--------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------| -| ceph | destroy | None | None | None | Destroy the ceph object store instance on the cluster | -| ceph | user | None | `` | None | Create an Ceph Object Store User | -| ceph | secrets | None | `` | None | Return user secrets for ceph deployment | -| ceph | setup | None | None | None | Setup Ceph Object Storage via the Rook Operator | -| enmasse | destroy | None | None | None | Remove Enmasse from openshift cluster | -| enmasse | IoT | addDevice | ``, `` | None | Add a Device with specified ID to the Enmasse device registry for a specified messaging TenantSetup default Credentials | -| enmasse | IoT | project | None | --namespace | Make a new enmasse IoT project in the specified namespace, defaults to “myapp” | -| enmasse | setup | None | None | None | Download Enmasse Source, store in current directory. Setup Enmasse Setup IoT services | -| kafka | bridge | None | None | --namespace | Deploy kafka HTTP bridge Deploy nginx ingress to access bridge from outside the cluster (will be transitioned to a route) | -| kafka | destroy | None | None | --namespace | Destroy the kafka deployment located at the specified namespace | -| kafka | setup | None | None | --namespace | Setup a kafka cluster viat the strimzi operator at the specified namespace | -| knative | setup | None | None | --status=true/false | Setup Knative serverless on openshift clusterConfigures both Knative-Eventing and Knative-ServingSet --status=true to check on Knative deployment | -| knative | destroy | None | None | None | Remove Knative deployment from openshift cluster | -| knative | service | None | `` | --status=true/false--namespace | Deploy a knative service Set --status=true to check on Knative service deploymentDefault namespace is “knative-eventing” | -| knative | service | destroy | `` | --namespace | Remove a specified Knative service from the cluster at specified namespace Default namespace is “knative-eventing” | -| knative | source | None | `` | --namespace | Deploy a Knative Source at specified namespace Defaults to namespace “knative-eventing” | -| knative | source | destroy | `` | --namespace | Remove a specified knative source from the cluster from specified namespaceDefault namespace is “knative-eventing” | -| login | None | None | None | None | Login to your openshift cluster with the username and password | -| tensorflowServing | setup | None | None | --namespace | Deploy a tensorflow serving deployment and service Default namespace is “default” | -| tensorflowServing | destroy | None | None | --namesapce | Deploy a tensorflow serving deployment and serviceDefault namespace is “default” | \ No newline at end of file +| Command1 (Tool) | Command2(Module) | Command3(Module command) | Argument (module input) | Flags | Function | +|-------------------|------------------|--------------------------|-------------------------------------|--------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| | | | | | | +| ceph | destroy | None | None | None | Destroy the ceph object store instance on the cluster | +| ceph | user | None | `` | None | Create an Ceph Object Store User | +| ceph | secrets | None | `` | None | Return user secrets for ceph deployment | +| ceph | setup | None | None | None | Setup Ceph Object Storage via the Rook Operator | +| enmasse | destroy | None | None | None | Remove Enmasse from openshift cluster | +| enmasse | IoT | addDevice | ``, `` | None | Add a Device with specified ID to the Enmasse device registry for a specified messaging TenantSetup default Credentials | +| enmasse | IoT | project | None | --namespace | Make a new enmasse IoT project in the specified namespace, defaults to “myapp” | +| enmasse | setup | None | None | None | Download Enmasse Source, store in current directory. Setup Enmasse Setup IoT services | +| gstreamer | setup | None | None | --local=true/false | Deploy Gtsreamer with OpenVino Toolkit for video/audio streaming with analyticsSet local=True for deploying gstreamer locally | +| gstreamer | destroy | None | None | None | Destroy Gstreamer deployment | +| kafka | bridge | None | None | --namespace --route=true/false | Deploy kafka HTTP bridge Set route=True to deploy a route to access bridge from outside(only for Openshift Cluster)Default deploys nginx ingress to access bridge from outside the cluster | +| kafka | destroy | None | None | --namespace | Destroy the kafka deployment located at the specified namespace | +| kafka | setup | None | None | --namespace | Setup a kafka cluster viat the strimzi operator at the specified namespace | +| knative | setup | None | None | --status=true/false | Setup Knative serverless on openshift clusterConfigures both Knative-Eventing and Knative-ServingSet --status=true to check on Knative deployment | +| knative | destroy | None | None | None | Remove Knative deployment from openshift cluster | +| knative | service | None | `` | --status=true/false--namespace | Deploy a knative service Set --status=true to check on Knative service deploymentDefault namespace is “knative-eventing” | +| knative | service | destroy | `` | --namespace | Remove a specified Knative service from the cluster at specified namespace Default namespace is “knative-eventing” | +| knative | source | None | `` | --namespace | Deploy a Knative Source at specified namespace Defaults to namespace “knative-eventing” | +| knative | source | destroy | `` | --namespace | Remove a specified knative source from the cluster from specified namespaceDefault namespace is “knative-eventing” | +| login | None | None | None | None | Login to your openshift cluster with the username and password | +| tensorflowServing | setup | None | None | --namespace | Deploy a tensorflow serving deployment and service Default namespace is “default” | +| tensorflowServing | destroy | None | None | --namesapce | Deploy a tensorflow serving deployment and serviceDefault namespace is “default” | + diff --git a/cmd/ceph-destroy.go b/cmd/ceph-destroy.go index 0ca0115..7ce163c 100644 --- a/cmd/ceph-destroy.go +++ b/cmd/ceph-destroy.go @@ -62,7 +62,7 @@ func cephDestroy() { // destroyCmd represents the destroy command var cephDestroyCmd = &cobra.Command{ Use: "destroy", - Short: "A brief description of your command", + Short: "Destroy the Ceph cluster", Long: `A longer description that spans multiple lines and likely contains examples and usage of using your command. For example: diff --git a/cmd/ceph-secrets.go b/cmd/ceph-secrets.go index 589f3c0..c4cb3d6 100644 --- a/cmd/ceph-secrets.go +++ b/cmd/ceph-secrets.go @@ -44,7 +44,7 @@ func getCredentials(user string) { // secretsCmd represents the secrets command var cephSecretsCmd = &cobra.Command{ Use: "secrets", - Short: "A brief description of your command", + Short: "Get S3 secrets from ceph object storage", Long: `A longer description that spans multiple lines and likely contains examples and usage of using your command. For example: diff --git a/cmd/ceph-setup.go b/cmd/ceph-setup.go index c5be2a0..15075b7 100644 --- a/cmd/ceph-setup.go +++ b/cmd/ceph-setup.go @@ -16,13 +16,14 @@ limitations under the License. package cmd import ( + "time" + "github.com/IoTCLI/cmd/utils" log "github.com/sirupsen/logrus" "github.com/spf13/cobra" "k8s.io/cli-runtime/pkg/genericclioptions" "k8s.io/kubectl/pkg/cmd/apply" "k8s.io/kubectl/pkg/cmd/get" - "time" ) //Made from Instructions @https://opendatahub.io/docs/administration/advanced-installation/object-storage.html for installing @@ -81,7 +82,7 @@ func cephSetup() { // setupCmd represents the setup command var cephSetupCmd = &cobra.Command{ Use: "setup", - Short: "A brief description of your command", + Short: "Setup Ceph Object storage", Long: `A longer description that spans multiple lines and likely contains examples and usage of using your command. For example: diff --git a/cmd/ceph-user.go b/cmd/ceph-user.go index 82a0aba..803f1a3 100644 --- a/cmd/ceph-user.go +++ b/cmd/ceph-user.go @@ -16,13 +16,14 @@ limitations under the License. package cmd import ( + "io/ioutil" + "os" + "github.com/IoTCLI/cmd/utils" + log "github.com/sirupsen/logrus" "github.com/spf13/cobra" - "io/ioutil" "k8s.io/cli-runtime/pkg/genericclioptions" "k8s.io/kubectl/pkg/cmd/apply" - "log" - "os" ) func cephUser(user string) { diff --git a/cmd/ceph.go b/cmd/ceph.go index b190e6a..4a79005 100644 --- a/cmd/ceph.go +++ b/cmd/ceph.go @@ -24,13 +24,8 @@ import ( // cephCmd represents the ceph command var cephCmd = &cobra.Command{ Use: "ceph", - Short: "A brief description of your command", - Long: `A longer description that spans multiple lines and likely contains examples -and usage of using your command. For example: - -Cobra is a CLI library for Go that empowers applications. -This application is a tool to generate the needed files -to quickly create a Cobra application.`, + Short: "Deploy Ceph object storage", + Long: `Deploy Ceph object storage`, Run: func(cmd *cobra.Command, args []string) { fmt.Println("ceph called") }, diff --git a/cmd/enmasse-IoT-addDevice.go b/cmd/enmasse-IoT-addDevice.go index 1b78dfc..66056fd 100644 --- a/cmd/enmasse-IoT-addDevice.go +++ b/cmd/enmasse-IoT-addDevice.go @@ -21,13 +21,15 @@ import ( //"os" "bytes" "crypto/tls" - "github.com/spf13/cobra" "net/http" "strings" + "github.com/spf13/cobra" + //in package import "github.com/IoTCLI/cmd/utils" "k8s.io/cli-runtime/pkg/genericclioptions" + //"k8s.io/kubectl/pkg/cmd/" "k8s.io/kubectl/pkg/cmd/get" ) @@ -113,7 +115,7 @@ func device(tenant string, deviceID string) { // addDeviceCmd represents the addDevice command var addDeviceCmd = &cobra.Command{ Use: "addDevice", - Short: "A brief description of your command", + Short: "Add an IoT device to enmasse", Long: `A longer description that spans multiple lines and likely contains examples and usage of using your command. For example: diff --git a/cmd/enmasse-IoT-project.go b/cmd/enmasse-IoT-project.go index acb2ce0..401cd56 100644 --- a/cmd/enmasse-IoT-project.go +++ b/cmd/enmasse-IoT-project.go @@ -23,10 +23,8 @@ import ( "strings" "time" - "github.com/spf13/cobra" - - //in package import "github.com/IoTCLI/cmd/utils" + "github.com/spf13/cobra" "k8s.io/cli-runtime/pkg/genericclioptions" "k8s.io/kubectl/pkg/cmd/apply" "k8s.io/kubectl/pkg/cmd/get" @@ -118,7 +116,7 @@ func createProject() { // projectCmd represents the project command var enmasseIoTProjectCmd = &cobra.Command{ Use: "project", - Short: "A brief description of your command", + Short: "Setup enmasse project", Long: `A longer description that spans multiple lines and likely contains examples and usage of using your command. For example: diff --git a/cmd/enmasse-IoT.go b/cmd/enmasse-IoT.go index 67aece6..e4c3fb8 100644 --- a/cmd/enmasse-IoT.go +++ b/cmd/enmasse-IoT.go @@ -24,7 +24,7 @@ import ( // IoTCmd represents the IoT command var enmasseIoTCmd = &cobra.Command{ Use: "IoT", - Short: "A brief description of your command", + Short: "Setup Enmasse IoT project", Long: `A longer description that spans multiple lines and likely contains examples and usage of using your command. For example: diff --git a/cmd/enmasse-destroy.go b/cmd/enmasse-destroy.go index 0cb28b2..ed8ded1 100644 --- a/cmd/enmasse-destroy.go +++ b/cmd/enmasse-destroy.go @@ -59,7 +59,7 @@ func enmasseDestroy() { // destroyCmd represents the destroy command var enmasseDestroyCmd = &cobra.Command{ Use: "destroy", - Short: "A brief description of your command", + Short: "Destroy enmasse project", Long: `A longer description that spans multiple lines and likely contains examples and usage of using your command. For example: diff --git a/cmd/enmasse-setup.go b/cmd/enmasse-setup.go index 36dd7aa..bd81253 100644 --- a/cmd/enmasse-setup.go +++ b/cmd/enmasse-setup.go @@ -94,7 +94,7 @@ func enmasseSetup() { // setupCmd represents the setup command var enmasseSetupCmd = &cobra.Command{ Use: "setup", - Short: "A brief description of your command", + Short: "Setup Enmasse as a messaging backend", Long: `A longer description that spans multiple lines and likely contains examples and usage of using your command. For example: diff --git a/cmd/enmasse.go b/cmd/enmasse.go index 84dd526..8c40127 100644 --- a/cmd/enmasse.go +++ b/cmd/enmasse.go @@ -24,7 +24,7 @@ import ( // enmasseCmd represents the enmasse command var enmasseCmd = &cobra.Command{ Use: "enmasse", - Short: "A brief description of your command", + Short: "Setup Enmasse as a messaging backend", Long: `A longer description that spans multiple lines and likely contains examples and usage of using your command. For example: diff --git a/cmd/gstreamer-destroy.go b/cmd/gstreamer-destroy.go index cc32e8b..e400fb5 100644 --- a/cmd/gstreamer-destroy.go +++ b/cmd/gstreamer-destroy.go @@ -57,7 +57,7 @@ func gstreamerDestroy() { // destroyCmd represents the destroy command var gstreamerDestroyCmd = &cobra.Command{ Use: "destroy", - Short: "A brief description of your command", + Short: "Destroy gstreamer deployment", Long: `A longer description that spans multiple lines and likely contains examples and usage of using your command. For example: diff --git a/cmd/gstreamer-setup.go b/cmd/gstreamer-setup.go index b141de4..61e7969 100644 --- a/cmd/gstreamer-setup.go +++ b/cmd/gstreamer-setup.go @@ -17,6 +17,8 @@ package cmd import ( "fmt" + "os/exec" + log "github.com/sirupsen/logrus" "github.com/IoTCLI/cmd/utils" @@ -28,7 +30,7 @@ import ( // setupCmd represents the setup command var gstreamerSetupCmd = &cobra.Command{ Use: "setup", - Short: "A brief description of your command", + Short: "Setup Gstreamer with Openvino toolkit for video streaming and analytics", Long: `A longer descriptSion that spans multiple lines and likely contains examples and usage of using your command. For example: @@ -36,11 +38,50 @@ Cobra is a CLI library for Go that empowers applications. This application is a tool to generate the needed files to quickly create a Cobra application.`, Run: func(cmd *cobra.Command, args []string) { - fmt.Println(" gstreamer setup called") - gstreamerSetup() + log.Println("Gstreamer setup called") + fstatus, _ := cmd.Flags().GetBool("local") + if fstatus { // if status is true, + gstreamerLocalSetup() + } else { + gstreamerSetup() + } }, } +func gstreamerLocalSetup() { + + cmd := exec.Command("https://raw.githubusercontent.com/redhat-iot/iot-dev/master/scripts/gstreamer/startup.sh") + out, error := cmd.Output() + if error != nil { + println(error.Error()) + return + } else { + log.Println(string(out)) + } + + for { + fmt.Print("Press 'S' to stop the Gstreamer container: ") + var key string + fmt.Scanln(&key) + + if key == "s" { + cmd2 := exec.Command("/bin/sh", "-c", " docker kill gstreamer_container") + out2, error2 := cmd2.Output() + if error2 != nil { + println(error2.Error()) + return + } else { + log.Println(string(out2)) + } + fmt.Print("Container stopped: ") + + break + + } + } + +} + func gstreamerSetup() { //Make command options for Kafka Setup co := utils.NewCommandOptions() @@ -80,4 +121,5 @@ func init() { // Cobra supports local flags which will only run when this command // is called directly, e.g.: // setupCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle") + gstreamerSetupCmd.Flags().BoolP("local", "l", false, "Setup gstreamer locally") } diff --git a/cmd/gstreamer.go b/cmd/gstreamer.go index 6930f35..53368b3 100644 --- a/cmd/gstreamer.go +++ b/cmd/gstreamer.go @@ -17,13 +17,14 @@ package cmd import ( "fmt" + "github.com/spf13/cobra" ) // gstreamerCmd represents the gstreamer command var gstreamerCmd = &cobra.Command{ Use: "gstreamer", - Short: "A brief description of your command", + Short: "Setup Gstreamer with OpenVino toolkit for video streaming with analytics ", Long: `A longer description that spans multiple lines and likely contains examples and usage of using your command. For example: diff --git a/cmd/kafka-bridge-destroy.go b/cmd/kafka-bridge-destroy.go new file mode 100644 index 0000000..9e13004 --- /dev/null +++ b/cmd/kafka-bridge-destroy.go @@ -0,0 +1,130 @@ +/* +Copyright © 2020 NAME HERE + +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 cmd + +import ( + "log" + + "github.com/IoTCLI/cmd/utils" + "github.com/spf13/cobra" + "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/kubectl/pkg/cmd/delete" +) + +var ( + kafkaBridgeDestroyNamespaceFlag string +) + +func kafkaBridgeRouteDestroy() { + + //Make command options for Kafka Setup + co := utils.NewCommandOptions() + + //Fill in the commands that must be applied to + co.Commands = append(co.Commands, "https://raw.githubusercontent.com/redhat-iot/iot-dev/master/yamls/kafka/bridge/route.yaml") + co.Commands = append(co.Commands, "https://raw.githubusercontent.com/redhat-iot/iot-dev/master/yamls/kafka/bridge/kafka-bridge.yaml") + + // + IOStreams, _, out, _ := genericclioptions.NewTestIOStreams() + + co.SwitchContext(kafkaBridgeDestroyNamespaceFlag) + + log.Println("Destroy Kafka Bridge with route from cluster") + for _, command := range co.Commands { + cmd := delete.NewCmdDelete(co.CurrentFactory, IOStreams) + err := cmd.Flags().Set("filename", command) + if err != nil { + log.Fatal(err) + } + cmd.Run(cmd, []string{}) + log.Print(out.String()) + out.Reset() + } + //Remove tempfile when done +} + +func kafkaBridgeDestroy() { + + //Make command options for Kafka Setup + co := utils.NewCommandOptions() + + _ = utils.DownloadAndUncompress("oc.gz", "https://mirror.openshift.com/pub/openshift-v4/clients/ocp/latest/openshift-client-linux.tar.gz") + log.Println("oc Source folder: ", "oc") + + //Fill in the commands that must be applied to + co.Commands = append(co.Commands, "https://raw.githubusercontent.com/redhat-iot/iot-dev/master/yamls/kafka/bridge/kafka-bridge.yaml") + co.Commands = append(co.Commands, "https://raw.githubusercontent.com/kubernetes/ingress-nginx/nginx-0.30.0/deploy/static/mandatory.yaml") + co.Commands = append(co.Commands, "https://raw.githubusercontent.com/kubernetes/ingress-nginx/nginx-0.30.0/deploy/static/provider/cloud-generic.yaml") + co.Commands = append(co.Commands, "https://raw.githubusercontent.com/redhat-iot/iot-dev/master/yamls/kafka/bridge/ingress.yaml") + + // + IOStreams, _, out, _ := genericclioptions.NewTestIOStreams() + + co.SwitchContext(kafkaBridgeDestroyNamespaceFlag) + + log.Println("Destroy Kafka Bridge with ingress from cluster") + for _, command := range co.Commands { + cmd := delete.NewCmdDelete(co.CurrentFactory, IOStreams) + err := cmd.Flags().Set("filename", command) + if err != nil { + log.Fatal(err) + } + cmd.Run(cmd, []string{}) + log.Print(out.String()) + out.Reset() + } + //Remove tempfile when done +} + +// destroyCmd represents the destroy command +var kafkaBridgeDestroyCmd = &cobra.Command{ + Use: "destroy", + Short: "Destory the Kafka Bridge", + Long: `A longer description that spans multiple lines and likely contains examples +and usage of using your command. For example: + +Cobra is a CLI library for Go that empowers applications. +This application is a tool to generate the needed files +to quickly create a Cobra application.`, + Run: func(cmd *cobra.Command, args []string) { + fstatus, _ := cmd.Flags().GetBool("route") + if fstatus { // if status is true, call Kafka bridge destroy with route + log.Println("Kafka Bridge Destroy called") + kafkaBridgeRouteDestroy() + } else { + log.Println("Kafka Bridge Destroy called") + kafkaBridgeDestroy() + } + }, +} + +func init() { + kafkaBridgeCmd.AddCommand(kafkaBridgeDestroyCmd) + + // Here you will define your flags and configuration settings. + + // Cobra supports Persistent Flags which will work for this command + // and all subcommands, e.g.: + // destroyCmd.PersistentFlags().String("foo", "", "A help for foo") + + // Cobra supports local flags which will only run when this command + // is called directly, e.g.: + // destroyCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle") + + kafkaBridgeDestroyCmd.Flags().StringVarP(&kafkaBridgeDestroyNamespaceFlag, "namespace", "n", "kafka", "Option to specify namespace for kafka deletion, defaults to 'kafka'") + + kafkaBridgeDestroyCmd.Flags().BoolP("route", "r", false, "Destroy kafka bridge with route, defaults to destroying kafka bridge with ingress") +} diff --git a/cmd/kafka-bridge.go b/cmd/kafka-bridge.go index 8aaaffd..bc10c31 100644 --- a/cmd/kafka-bridge.go +++ b/cmd/kafka-bridge.go @@ -66,7 +66,7 @@ func kafkaBridge() { //Get Nginix controller and apply to cluster co.Commands = append(co.Commands, "https://raw.githubusercontent.com/kubernetes/ingress-nginx/nginx-0.30.0/deploy/static/mandatory.yaml") co.Commands = append(co.Commands, "https://raw.githubusercontent.com/kubernetes/ingress-nginx/nginx-0.30.0/deploy/static/provider/cloud-generic.yaml") - //Seutp the K8s ingress resource + //Setup the K8s ingress resource co.Commands = append(co.Commands, "https://raw.githubusercontent.com/redhat-iot/iot-dev/master/yamls/kafka/bridge/ingress.yaml") @@ -93,7 +93,7 @@ func kafkaBridge() { // bridgeCmd represents the bridge command var kafkaBridgeCmd = &cobra.Command{ Use: "bridge", - Short: "A brief description of your command", + Short: "Setup Kafka bridge to send data over to the Kafka cluster", Long: `A longer description that spans multiple lines and likely contains examples and usage of using your command. For example: @@ -101,8 +101,16 @@ Cobra is a CLI library for Go that empowers applications. This application is a tool to generate the needed files to quickly create a Cobra application.`, Run: func(cmd *cobra.Command, args []string) { - log.Println("Kafka Http Bridge called") - kafkaBridgeRoute() + + fstatus, _ := cmd.Flags().GetBool("route") + if fstatus { // if status is true, call addFloat + log.Println("Kafka Http Bridge called using Route") + kafkaBridgeRoute() + } else { + log.Println("Kafka Http Bridge called using Ingress") + kafkaBridge() + } + }, } @@ -119,4 +127,6 @@ func init() { // is called directly, e.g.: // bridgeCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle") kafkaBridgeCmd.Flags().StringVarP(&kafkaBridgeNamespaceFlag, "namespace", "n", "kafka", "Option to specify namespace for kafka deletion, defaults to 'kafka'") + + kafkaBridgeCmd.Flags().BoolP("route", "r", false, "Setup kafka bridge using route, defaults to using ingress") } diff --git a/cmd/kafka-destroy.go b/cmd/kafka-destroy.go index b54af80..3c116e5 100644 --- a/cmd/kafka-destroy.go +++ b/cmd/kafka-destroy.go @@ -32,9 +32,6 @@ func kafkaDestroy() { //Make command options for Kafka Setup co := utils.NewCommandOptions() - _ = utils.DownloadAndUncompress("oc.gz", "https://mirror.openshift.com/pub/openshift-v4/clients/ocp/latest/openshift-client-linux.tar.gz") - log.Println("oc Source folder: ", "oc") - //Fill in the commands that must be applied to co.Commands = append(co.Commands, "https://raw.githubusercontent.com/redhat-iot/iot-dev/master/yamls/kafka/setup/kafka.yaml") co.Commands = append(co.Commands, "https://github.com/strimzi/strimzi-kafka-operator/releases/download/0.17.0/strimzi-cluster-operator-0.17.0.yaml") @@ -63,7 +60,7 @@ func kafkaDestroy() { // destroyCmd represents the destroy command var kafkaDestroyCmd = &cobra.Command{ Use: "destroy", - Short: "A brief description of your command", + Short: "Destroy the Kafka cluster along with Strimzi operator", Long: `A longer description that spans multiple lines and likely contains examples and usage of using your command. For example: diff --git a/cmd/kafka.go b/cmd/kafka.go index 7b64987..965e842 100644 --- a/cmd/kafka.go +++ b/cmd/kafka.go @@ -24,7 +24,7 @@ import ( // kafkaCmd represents the kafka command var kafkaCmd = &cobra.Command{ Use: "kafka", - Short: "A brief description of your command", + Short: "Setup kafka as the messaging backend", Long: `A longer description that spans multiple lines and likely contains examples and usage of using your command. For example: diff --git a/cmd/knative-destroy.go b/cmd/knative-destroy.go index 7f147a3..56a0f66 100644 --- a/cmd/knative-destroy.go +++ b/cmd/knative-destroy.go @@ -23,6 +23,7 @@ import ( //in package import "github.com/IoTCLI/cmd/utils" "k8s.io/cli-runtime/pkg/genericclioptions" + //"k8s.io/kubectl/pkg/cmd/" "k8s.io/kubectl/pkg/cmd/delete" ) @@ -75,7 +76,7 @@ func destroyKnative() { // destroyCmd represents the destroy command var knativeDestroyCmd = &cobra.Command{ Use: "destroy", - Short: "A brief description of your command", + Short: "Destroy Knative serving and eventing", Long: `A longer description that spans multiple lines and likely contains examples and usage of using your command. For example: diff --git a/cmd/knative-service.go b/cmd/knative-service.go index 729ce3a..d7b4281 100644 --- a/cmd/knative-service.go +++ b/cmd/knative-service.go @@ -17,15 +17,16 @@ package cmd import ( b64 "encoding/base64" + "io/ioutil" + "os" + "strings" + "github.com/IoTCLI/cmd/utils" log "github.com/sirupsen/logrus" "github.com/spf13/cobra" - "io/ioutil" "k8s.io/cli-runtime/pkg/genericclioptions" "k8s.io/kubectl/pkg/cmd/apply" "k8s.io/kubectl/pkg/cmd/get" - "os" - "strings" ) var ( @@ -197,7 +198,7 @@ func logs(name string) { // serviceCmd represents the service command var knativeServiceCmd = &cobra.Command{ Use: "service", - Short: "A brief description of your command", + Short: "Setup Knative service for video analtytics", Long: `A longer description that spans multiple lines and likely contains examples and usage of using your command. For example: diff --git a/cmd/knative-setup.go b/cmd/knative-setup.go index 68ebcdd..964fea4 100644 --- a/cmd/knative-setup.go +++ b/cmd/knative-setup.go @@ -16,19 +16,22 @@ limitations under the License. package cmd import ( - log "github.com/sirupsen/logrus" "strconv" + log "github.com/sirupsen/logrus" + "github.com/spf13/cobra" //in package import "github.com/IoTCLI/cmd/utils" "k8s.io/cli-runtime/pkg/genericclioptions" + //"k8s.io/kubectl/pkg/cmd/" - "k8s.io/kubectl/pkg/cmd/apply" - "k8s.io/kubectl/pkg/cmd/get" "strings" "time" + + "k8s.io/kubectl/pkg/cmd/apply" + "k8s.io/kubectl/pkg/cmd/get" ) //var setupStatus = false @@ -209,7 +212,7 @@ func knativeStatus() { // setupCmd represents the setup command var knativeSetupCmd = &cobra.Command{ Use: "setup", - Short: "A brief description of your command", + Short: "Setup Knative serving and eventing for serverless application", Long: `A longer description that spans multiple lines and likely contains examples and usage of using your command. For example: diff --git a/cmd/knative-source-destroy.go b/cmd/knative-source-destroy.go index b0bc5d2..e98ce75 100644 --- a/cmd/knative-source-destroy.go +++ b/cmd/knative-source-destroy.go @@ -25,6 +25,7 @@ import ( //in package import "github.com/IoTCLI/cmd/utils" "k8s.io/cli-runtime/pkg/genericclioptions" + //"k8s.io/kubectl/pkg/cmd/" "k8s.io/kubectl/pkg/cmd/delete" ) @@ -67,7 +68,7 @@ func desContainerSource(source string) { // destroyCmd represents the destroy command var knativeSourceDestroyCmd = &cobra.Command{ Use: "destroy", - Short: "A brief description of your command", + Short: "Destroy Knative Source eployment", Long: `A longer description that spans multiple lines and likely contains examples and usage of using your command. For example: diff --git a/cmd/knative.go b/cmd/knative.go index e74fc0a..9802418 100644 --- a/cmd/knative.go +++ b/cmd/knative.go @@ -24,7 +24,7 @@ import ( // knativeCmd represents the knative command var knativeCmd = &cobra.Command{ Use: "knative", - Short: "A brief description of your command", + Short: "Setup Knative serving and eventing for serverless application", Long: `A longer description that spans multiple lines and likely contains examples and usage of using your command. For example: diff --git a/cmd/login.go b/cmd/login.go index 5aadffc..4512182 100644 --- a/cmd/login.go +++ b/cmd/login.go @@ -17,12 +17,13 @@ package cmd import ( "fmt" + "os" + "os/exec" + "github.com/IoTCLI/cmd/utils" log "github.com/sirupsen/logrus" "github.com/spf13/cobra" "golang.org/x/crypto/ssh/terminal" - "os" - "os/exec" ) func login() { @@ -56,7 +57,7 @@ func login() { // loginCmd represents the login command var loginCmd = &cobra.Command{ Use: "login", - Short: "A brief description of your command", + Short: "Login to the Openshift Cluster", Long: `A longer description that spans multiple lines and likely contains examples and usage of using your command. For example: diff --git a/cmd/root.go b/cmd/root.go index 1c2bb69..93105b0 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -17,12 +17,13 @@ package cmd import ( "fmt" + "io" + "os" + homedir "github.com/mitchellh/go-homedir" log "github.com/sirupsen/logrus" "github.com/spf13/cobra" "github.com/spf13/viper" - "io" - "os" ) var cfgFile string @@ -32,13 +33,9 @@ var dryRun string // rootCmd represents the base command when called without any subcommands var rootCmd = &cobra.Command{ Use: "IoTCLI", - Short: "A brief description of your application", - Long: `A longer description that spans multiple lines and likely contains -examples and usage of using your application. For example: - -Cobra is a CLI library for Go that empowers applications. -This application is a tool to generate the needed files -to quickly create a Cobra application.`, + Short: "Setting up Cloud native Egde Applications with various messaging backends", + Long: `Setting up Cloud native Egde Applications with various messaging backends. +Allows user to track the IoTDevices, setup various messaging backends like Kafka or Enmasse, deploy gstreamer analytics as smart edge device etc`, // Uncomment the following line if your bare application // has an action associated with it: // Run: func(cmd *cobra.Command, args []string) { }, diff --git a/cmd/tensorflowServing-destroy.go b/cmd/tensorflowServing-destroy.go index 1d047f7..7878141 100644 --- a/cmd/tensorflowServing-destroy.go +++ b/cmd/tensorflowServing-destroy.go @@ -52,7 +52,7 @@ func tensorflowServingDestroy() { // tensorflowServingDestroyCmd represents the tensorflowServingDestroy command var tensorflowServingDestroyCmd = &cobra.Command{ Use: "destroy", - Short: "A brief description of your command", + Short: "Destroy the deployed tensorflow service", Long: `A longer description that spans multiple lines and likely contains examples and usage of using your command. For example: diff --git a/cmd/tensorflowServing-setup.go b/cmd/tensorflowServing-setup.go index 0eb0776..9249177 100644 --- a/cmd/tensorflowServing-setup.go +++ b/cmd/tensorflowServing-setup.go @@ -51,7 +51,7 @@ func tensorflowServingSetup() { // tensorflowServingSetupCmd represents the tensorflowServingSetup command var tensorflowServingSetupCmd = &cobra.Command{ Use: "setup", - Short: "A brief description of your command", + Short: "Setup tensorflow service for analtyics", Long: `A longer description that spans multiple lines and likely contains examples and usage of using your command. For example: diff --git a/cmd/tensorflowServing.go b/cmd/tensorflowServing.go index ae9a49e..e022a4c 100644 --- a/cmd/tensorflowServing.go +++ b/cmd/tensorflowServing.go @@ -28,7 +28,7 @@ var ( // tensorflowServingCmd represents the tensorflowServing command var tensorflowServingCmd = &cobra.Command{ Use: "tensorflowServing", - Short: "A brief description of your command", + Short: "Setup a tensorflow service for analytics", Long: `A longer description that spans multiple lines and likely contains examples and usage of using your command. For example: diff --git a/scripts/gstreamer/startup.sh b/scripts/gstreamer/startup.sh new file mode 100755 index 0000000..31b6b3a --- /dev/null +++ b/scripts/gstreamer/startup.sh @@ -0,0 +1,23 @@ +#!/bin/bash +#echo "hello world" + +xhost local:root + +docker run -it --name gstreamer_container --privileged --net=host \ +\ +-v ~/.Xauthority:/root/.Xauthority \ +-v /tmp/.X11-unix:/tmp/.X11-unix \ +-e DISPLAY=$DISPLAY \ +-e HTTP_PROXY=$HTTP_PROXY \ +-e HTTPS_PROXY=$HTTPS_PROXY \ +-e http_proxy=$http_proxy \ +-e https_proxy=$https_proxy \ +\ +-v ~/gva/data/models/intel:/root/intel_models:ro \ +-v ~/gva/data/models/common:/root/common_models:ro \ +-e MODELS_PATH=/root/intel_models:/root/common_models \ +\ +-v ~/gva/data/video:/root/video-examples:ro \ +-e VIDEO_EXAMPLES_DIR=/root/video-examples \ +\ +adi6496/gst-video-analytics:latest \ No newline at end of file diff --git a/yamls/kafka/kafka-event-source.yaml b/yamls/kafka/kafka-event-source.yaml index 10780c7..1562252 100644 --- a/yamls/kafka/kafka-event-source.yaml +++ b/yamls/kafka/kafka-event-source.yaml @@ -10,4 +10,9 @@ spec: ref: apiVersion: serving.knative.dev/v1 kind: Service - name: event-display #video-service \ No newline at end of file + name: event-display #video-service + + + + + \ No newline at end of file