Update flux logs examples
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
This commit is contained in:
committed by
Hidde Beydals
parent
043d37921b
commit
185252ba48
@@ -21,38 +21,37 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/fluxcd/flux2/internal/flags"
|
|
||||||
"github.com/fluxcd/flux2/internal/utils"
|
|
||||||
"github.com/spf13/cobra"
|
|
||||||
"html/template"
|
"html/template"
|
||||||
"io"
|
"io"
|
||||||
|
"os"
|
||||||
|
"strings"
|
||||||
|
"sync"
|
||||||
|
|
||||||
|
"github.com/spf13/cobra"
|
||||||
corev1 "k8s.io/api/core/v1"
|
corev1 "k8s.io/api/core/v1"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
"k8s.io/client-go/kubernetes"
|
"k8s.io/client-go/kubernetes"
|
||||||
"k8s.io/client-go/rest"
|
"k8s.io/client-go/rest"
|
||||||
"os"
|
|
||||||
"strings"
|
"github.com/fluxcd/flux2/internal/flags"
|
||||||
"sync"
|
"github.com/fluxcd/flux2/internal/utils"
|
||||||
)
|
)
|
||||||
|
|
||||||
var logsCmd = &cobra.Command{
|
var logsCmd = &cobra.Command{
|
||||||
Use: "logs",
|
Use: "logs",
|
||||||
Short: "Display formatted logs for toolkit components",
|
Short: "Display formatted logs for Flux components",
|
||||||
Long: "The logs command displays formatted logs from various toolkit components.",
|
Long: "The logs command displays formatted logs from various Flux components.",
|
||||||
Example: `# Get logs from toolkit components
|
Example: ` # Print the reconciliation logs of all Flux custom resources in your cluster
|
||||||
flux logs
|
flux logs --all-namespaces
|
||||||
|
|
||||||
# Stream logs from toolkit components
|
# Stream logs for a particular log level
|
||||||
flux logs --follow
|
flux logs --follow --level=error --all-namespaces
|
||||||
|
|
||||||
# Get logs from toolkit components in a particular namespace
|
# Filter logs by kind, name and namespace
|
||||||
flux logs --flux-namespace my-namespace
|
flux logs --kind=Kustomization --name=podinfo --namespace=default
|
||||||
|
|
||||||
# Get logs for a particular log level
|
# Print logs when Flux is installed in a different namespace than flux-system
|
||||||
flux logs --level=info
|
flux logs --flux-namespace=my-namespace
|
||||||
|
|
||||||
# Filter logs by kind, name, or namespace
|
|
||||||
flux logs --kind=kustomization --name podinfo --namespace default
|
|
||||||
`,
|
`,
|
||||||
RunE: logsCmdRun,
|
RunE: logsCmdRun,
|
||||||
}
|
}
|
||||||
@@ -75,9 +74,9 @@ func init() {
|
|||||||
logsCmd.Flags().Var(&logsArgs.logLevel, "level", logsArgs.logLevel.Description())
|
logsCmd.Flags().Var(&logsArgs.logLevel, "level", logsArgs.logLevel.Description())
|
||||||
logsCmd.Flags().StringVarP(&logsArgs.kind, "kind", "", logsArgs.kind, "displays errors of a particular toolkit kind e.g GitRepository")
|
logsCmd.Flags().StringVarP(&logsArgs.kind, "kind", "", logsArgs.kind, "displays errors of a particular toolkit kind e.g GitRepository")
|
||||||
logsCmd.Flags().StringVarP(&logsArgs.name, "name", "", logsArgs.name, "specifies the name of the object logs to be displayed")
|
logsCmd.Flags().StringVarP(&logsArgs.name, "name", "", logsArgs.name, "specifies the name of the object logs to be displayed")
|
||||||
logsCmd.Flags().BoolVarP(&logsArgs.follow, "follow", "f", logsArgs.follow, "Specifies if the logs should be streamed")
|
logsCmd.Flags().BoolVarP(&logsArgs.follow, "follow", "f", logsArgs.follow, "specifies if the logs should be streamed")
|
||||||
logsCmd.Flags().Int64VarP(&logsArgs.tail, "tail", "", logsArgs.tail, "lines of recent log file to display")
|
logsCmd.Flags().Int64VarP(&logsArgs.tail, "tail", "", logsArgs.tail, "lines of recent log file to display")
|
||||||
logsCmd.Flags().StringVarP(&logsArgs.fluxNamespace, "flux-namespace", "", rootArgs.defaults.Namespace, "the namespace where the Flux components are running.")
|
logsCmd.Flags().StringVarP(&logsArgs.fluxNamespace, "flux-namespace", "", rootArgs.defaults.Namespace, "the namespace where the Flux components are running")
|
||||||
logsCmd.Flags().BoolVarP(&logsArgs.allNamespaces, "all-namespaces", "A", false, "displays logs for objects across all namespaces")
|
logsCmd.Flags().BoolVarP(&logsArgs.allNamespaces, "all-namespaces", "A", false, "displays logs for objects across all namespaces")
|
||||||
rootCmd.AddCommand(logsCmd)
|
rootCmd.AddCommand(logsCmd)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ Command line utility for assembling Kubernetes CD pipelines the GitOps way.
|
|||||||
* [flux export](flux_export.md) - Export resources in YAML format
|
* [flux export](flux_export.md) - Export resources in YAML format
|
||||||
* [flux get](flux_get.md) - Get sources and resources
|
* [flux get](flux_get.md) - Get sources and resources
|
||||||
* [flux install](flux_install.md) - Install or upgrade Flux
|
* [flux install](flux_install.md) - Install or upgrade Flux
|
||||||
* [flux logs](flux_logs.md) - Display formatted logs for toolkit components
|
* [flux logs](flux_logs.md) - Display formatted logs for Flux components
|
||||||
* [flux reconcile](flux_reconcile.md) - Reconcile sources and resources
|
* [flux reconcile](flux_reconcile.md) - Reconcile sources and resources
|
||||||
* [flux resume](flux_resume.md) - Resume suspended resources
|
* [flux resume](flux_resume.md) - Resume suspended resources
|
||||||
* [flux suspend](flux_suspend.md) - Suspend resources
|
* [flux suspend](flux_suspend.md) - Suspend resources
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
## flux logs
|
## flux logs
|
||||||
|
|
||||||
Display formatted logs for toolkit components
|
Display formatted logs for Flux components
|
||||||
|
|
||||||
### Synopsis
|
### Synopsis
|
||||||
|
|
||||||
The logs command displays formatted logs from various toolkit components.
|
The logs command displays formatted logs from various Flux components.
|
||||||
|
|
||||||
```
|
```
|
||||||
flux logs [flags]
|
flux logs [flags]
|
||||||
@@ -13,20 +13,17 @@ flux logs [flags]
|
|||||||
### Examples
|
### Examples
|
||||||
|
|
||||||
```
|
```
|
||||||
# Get logs from toolkit components
|
# Print the reconciliation logs of all Flux custom resources in your cluster
|
||||||
flux logs
|
flux logs --all-namespaces
|
||||||
|
|
||||||
# Stream logs from toolkit components
|
# Stream logs for a particular log level
|
||||||
flux logs --follow
|
flux logs --follow --level=error --all-namespaces
|
||||||
|
|
||||||
# Get logs from toolkit components in a particular namespace
|
# Filter logs by kind, name and namespace
|
||||||
flux logs --flux-namespace my-namespace
|
flux logs --kind=Kustomization --name=podinfo --namespace=default
|
||||||
|
|
||||||
# Get logs for a particular log level
|
# Print logs when Flux is installed in a different namespace than flux-system
|
||||||
flux logs --level=info
|
flux logs --flux-namespace=my-namespace
|
||||||
|
|
||||||
# Filter logs by kind, name, or namespace
|
|
||||||
flux logs --kind=kustomization --name podinfo --namespace default
|
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -34,8 +31,8 @@ flux logs [flags]
|
|||||||
|
|
||||||
```
|
```
|
||||||
-A, --all-namespaces displays logs for objects across all namespaces
|
-A, --all-namespaces displays logs for objects across all namespaces
|
||||||
--flux-namespace string the namespace where the Flux components are running. (default "flux-system")
|
--flux-namespace string the namespace where the Flux components are running (default "flux-system")
|
||||||
-f, --follow Specifies if the logs should be streamed
|
-f, --follow specifies if the logs should be streamed
|
||||||
-h, --help help for logs
|
-h, --help help for logs
|
||||||
--kind string displays errors of a particular toolkit kind e.g GitRepository
|
--kind string displays errors of a particular toolkit kind e.g GitRepository
|
||||||
--level logLevel log level, available options are: (debug, info, error)
|
--level logLevel log level, available options are: (debug, info, error)
|
||||||
|
|||||||
Reference in New Issue
Block a user