Skip to content

Commit

Permalink
Add app info sub-command
Browse files Browse the repository at this point in the history
Add app info sub-command to show post install instructions for an app and the app homepage link, so that users don't have to unnecessarily install again to see them, which was the only way till now to see post install instructions.

This commit adds info for nginx-ingress, cert-manager, metrics-server, tiller, linkerd, cron-connector, kafka-connector, minio, postgresql, kubernetes-dashboard, istio, abd crossplane

Fixes: #133

Signed-off-by: wingkwong <[email protected]>
  • Loading branch information
wingkwong authored and alexellis committed Feb 4, 2020
1 parent d5bdd33 commit 3a35061
Show file tree
Hide file tree
Showing 12 changed files with 181 additions and 139 deletions.
25 changes: 13 additions & 12 deletions cmd/apps/certmanager_app.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,21 +116,22 @@ func MakeInstallCertManager() *cobra.Command {
return fmt.Errorf("Error applying templated YAML files, error: %s", applyRes.Stderr)
}

fmt.Println(`=======================================================================
= cert-manager has been installed. =
=======================================================================
# Get started with cert-manager here:
# https://docs.cert-manager.io/en/latest/tutorials/acme/http-validation.html
# Check cert-manager's logs with:
kubectl logs -n cert-manager deploy/cert-manager -f
` + pkg.ThanksForUsing)
fmt.Println(certManagerInstallMsg)

return nil
}

return certManager
}

const CertManagerInfoMsg = `# Get started with cert-manager here:
# https://docs.cert-manager.io/en/latest/tutorials/acme/http-validation.html
# Check cert-manager's logs with:
kubectl logs -n cert-manager deploy/cert-manager -f`

const certManagerInstallMsg = `=======================================================================
= cert-manager has been installed. =
=======================================================================` +
"\n\n" + CertManagerInfoMsg + "\n\n" + pkg.ThanksForUsing
25 changes: 13 additions & 12 deletions cmd/apps/cronconnector_app.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,15 @@ func MakeInstallCronConnector() *cobra.Command {
return err
}

fmt.Println(`=======================================================================
= cron-connector has been installed. =
=======================================================================
fmt.Println(cronConnectorInstallMsg)

# Example usage to trigger nodeinfo every 5 minutes:
return nil
}

return command
}

const CronConnectorInfoMsg = `# Example usage to trigger nodeinfo every 5 minutes:
faas-cli store deploy nodeinfo \
--annotation schedule="*/5 * * * *" \
Expand All @@ -133,12 +137,9 @@ kubectl logs deploy/cron-connector -n openfaas -f
# Find out more on the project homepage:
# https://github.com/openfaas-incubator/cron-connector/
# https://github.com/openfaas-incubator/cron-connector/`

` + pkg.ThanksForUsing)

return nil
}

return command
}
const cronConnectorInstallMsg = `=======================================================================
= cron-connector has been installed. =
=======================================================================` +
"\n\n" + CronConnectorInfoMsg + "\n\n" + pkg.ThanksForUsing
24 changes: 12 additions & 12 deletions cmd/apps/crossplane_app.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,21 +129,21 @@ schedule workloads to any Kubernetes cluster`,
}
}

fmt.Println(`
=======================================================================
= Crossplane has been installed. =
=======================================================================
fmt.Println(crossplaneInstallMsg)
return nil
}

return crossplane
}

Get started by installing a stack for your favorite provider:
const CrossplanInfoMsg = `# Get started by installing a stack for your favorite provider:
* stack-gcp: https://crossplane.io/docs/master/install-crossplane.html#gcp-stack
* stack-aws: https://crossplane.io/docs/master/install-crossplane.html#aws-stack
* stack-azure: https://crossplane.io/docs/master/install-crossplane.html#azure-stack
Learn more about Crossplane: https://crossplaneio.github.io/docs/
Learn more about Crossplane: https://crossplaneio.github.io/docs/`

` + pkg.ThanksForUsing)
return nil
}

return crossplane
}
const crossplaneInstallMsg = `=======================================================================
= Crossplane has been installed. =
=======================================================================` +
"\n\n" + CrossplanInfoMsg + "\n\n" + pkg.ThanksForUsing
6 changes: 3 additions & 3 deletions cmd/apps/istio_app.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,13 +141,13 @@ func MakeInstallIstio() *cobra.Command {
return istio
}

const istioInfoMsg = `# Find out more at:
const IstioInfoMsg = `# Find out more at:
# https://github.com/istio/`

const istioPostInstallMsg = `=======================================================================
= Istio has been installed. =
=======================================================================` +
"\n\n" + istioInfoMsg + "\n\n" + pkg.ThanksForUsing
"\n\n" + IstioInfoMsg + "\n\n" + pkg.ThanksForUsing

func writeIstioValues() (string, error) {
out := `#
Expand Down Expand Up @@ -212,4 +212,4 @@ global:

writeTo := path.Join(os.TempDir(), "istio-values.yaml")
return writeTo, ioutil.WriteFile(writeTo, []byte(out), 0600)
}
}
26 changes: 14 additions & 12 deletions cmd/apps/kafkaconnector_app.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,22 +131,24 @@ func MakeInstallKafkaConnector() *cobra.Command {
return err
}

fmt.Println(`=======================================================================
= kafka-connector has been installed. =
=======================================================================
fmt.Println(kafkaConnectorInstallMsg)

# View the connector's logs:
return nil
}

kubectl logs deploy/kafka-connector -n openfaas -f
return command
}

# Find out more on the project homepage:

# https://github.com/openfaas-incubator/kafka-connector/
const KafkaConnectorInfoMsg = `# View the connector's logs:
` + pkg.ThanksForUsing)
kubectl logs deploy/kafka-connector -n openfaas -f
return nil
}
# Find out more on the project homepage:
return command
}
# https://github.com/openfaas-incubator/kafka-connector/`

const kafkaConnectorInstallMsg = `=======================================================================
= kafka-connector has been installed. =
=======================================================================` +
"\n\n" + KafkaConnectorInfoMsg + "\n\n" + pkg.ThanksForUsing
26 changes: 14 additions & 12 deletions cmd/apps/kubernetes_dashboard_app.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,16 @@ func MakeInstallKubernetesDashboard() *cobra.Command {
return err
}

fmt.Println(`=======================================================================
= Kubernetes Dashboard has been installed. =
=======================================================================
fmt.Println(KubernetesDashboardInfoMsg)

#To create the Service Account and the ClusterRoleBinding
return nil
}

return kubeDashboard
}


const KubernetesDashboardInfoMsg = `# To create the Service Account and the ClusterRoleBinding
# @See https://github.com/kubernetes/dashboard/blob/master/docs/user/access-control/creating-sample-user.md#creating-sample-user
cat <<EOF | kubectl apply -f -
Expand Down Expand Up @@ -72,12 +77,9 @@ kubectl proxy
kubectl -n kubernetes-dashboard describe secret $(kubectl -n kubernetes-dashboard get secret | grep admin-user-token | awk '{print $1}')
# Once Proxying you can navigate to the below
http://localhost:8001/api/v1/namespaces/kubernetes-dashboard/services/https:kubernetes-dashboard:/proxy/#/login
http://localhost:8001/api/v1/namespaces/kubernetes-dashboard/services/https:kubernetes-dashboard:/proxy/#/login`

` + pkg.ThanksForUsing)

return nil
}

return kubeDashboard
}
const KubernetesDashboardInstallMsg = `=======================================================================
= Kubernetes Dashboard has been installed. =
=======================================================================` +
"\n\n" + KubernetesDashboardInfoMsg + "\n\n" + pkg.ThanksForUsing
28 changes: 27 additions & 1 deletion cmd/apps/linkerd_app.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func MakeInstallLinkerd() *cobra.Command {
arch := getNodeArchitecture()
fmt.Printf("Node architecture: %q\n", arch)

userPath, err := config.InitUserDir()
userPath, err := getUserPath()
if err != nil {
return err
}
Expand Down Expand Up @@ -164,3 +164,29 @@ func linkerdCli(parts ...string) (execute.ExecResult, error) {

return res, nil
}

func getUserPath() (string, error) {
userPath, err := config.InitUserDir()
return userPath, err
}

func getExportPath() string {
userPath, _ := getUserPath()
return path.Join(userPath, "bin/")
}

var LinkerdInfoMsg = `# Get the linkerd-cli
curl -sL https://run.linkerd.io/install | sh
# Find out more at:
# https://linkerd.io
# To use the Linkerd CLI set this path:
export PATH=$PATH:` + getExportPath() + `
linkerd --help`

var linkerdInstallMsg = `=======================================================================
= Linkerd has been installed. =
=======================================================================` +
"\n\n" + LinkerdInfoMsg + "\n\n" + pkg.ThanksForUsing
25 changes: 14 additions & 11 deletions cmd/apps/minio_app.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,11 +137,16 @@ func MakeInstallMinio() *cobra.Command {
return err
}

fmt.Println(`=======================================================================
= minio has been installed. =
=======================================================================
fmt.Println(minioInstallMsg)
return nil
}

return minio
}

var _, clientOS = env.GetClientArch()

# Forward the minio port to your machine
var MinioInfoMsg = `# Forward the minio port to your machine
kubectl port-forward -n default svc/minio 9000:9000 &
# Get the access and secret key to gain access to minio
Expand All @@ -158,11 +163,9 @@ mc config host add minio http://127.0.0.1:9000 $ACCESSKEY $SECRETKEY
# List buckets
mc ls minio
# Find out more at: https://min.io
# Find out more at: https://min.io`

` + pkg.ThanksForUsing)
return nil
}

return minio
}
var minioInstallMsg = `=======================================================================
= Minio has been installed. =
=======================================================================` +
"\n\n" + MinioInfoMsg + "\n\n" + pkg.ThanksForUsing
24 changes: 12 additions & 12 deletions cmd/apps/nginx_app.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,12 +122,15 @@ func MakeInstallNginx() *cobra.Command {
return err
}

fmt.Println(`=======================================================================
= nginx-ingress has been installed. =
=======================================================================
fmt.Println(nginxIngressInstallMsg)

return nil
}

# If you're using a local environment such as "minikube" or "KinD",
return nginx
}

const NginxIngressInfoMsg = `# If you're using a local environment such as "minikube" or "KinD",
# then try the inlets operator with "k3sup app install inlets-operator"
# If you're using a managed Kubernetes service, then you'll find
Expand All @@ -136,12 +139,9 @@ func MakeInstallNginx() *cobra.Command {
kubectl get svc nginx-ingress-controller
# Find out more at:
# https://github.com/helm/charts/tree/master/stable/nginx-ingress
` + pkg.ThanksForUsing)
# https://github.com/helm/charts/tree/master/stable/nginx-ingress`

return nil
}

return nginx
}
const nginxIngressInstallMsg = `=======================================================================
= nginx-ingress has been installed. =
=======================================================================` +
"\n\n" + NginxIngressInfoMsg + "\n\n" + pkg.ThanksForUsing
Loading

0 comments on commit 3a35061

Please sign in to comment.