Implement get all for sources and images
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
This commit is contained in:
@@ -38,9 +38,9 @@ mentioned in YAMLs in a git repository.`,
|
|||||||
--git-repo-ref=flux-system \
|
--git-repo-ref=flux-system \
|
||||||
--git-repo-path="./clusters/my-cluster" \
|
--git-repo-path="./clusters/my-cluster" \
|
||||||
--checkout-branch=main \
|
--checkout-branch=main \
|
||||||
--author-name=flux \
|
--author-name=flux \
|
||||||
--author-email=flux@example.com \
|
--author-email=flux@example.com \
|
||||||
--commit-template="{{range .Updated.Images}}{{println .}}{{end}}"
|
--commit-template="{{range .Updated.Images}}{{println .}}{{end}}"
|
||||||
|
|
||||||
# Configure image updates to push changes to a different branch, if the branch doesn't exists it will be created
|
# Configure image updates to push changes to a different branch, if the branch doesn't exists it will be created
|
||||||
flux create image update flux-system \
|
flux create image update flux-system \
|
||||||
@@ -48,9 +48,9 @@ mentioned in YAMLs in a git repository.`,
|
|||||||
--git-repo-path="./clusters/my-cluster" \
|
--git-repo-path="./clusters/my-cluster" \
|
||||||
--checkout-branch=main \
|
--checkout-branch=main \
|
||||||
--push-branch=image-updates \
|
--push-branch=image-updates \
|
||||||
--author-name=flux \
|
--author-name=flux \
|
||||||
--author-email=flux@example.com \
|
--author-email=flux@example.com \
|
||||||
--commit-template="{{range .Updated.Images}}{{println .}}{{end}}"
|
--commit-template="{{range .Updated.Images}}{{println .}}{{end}}"
|
||||||
`,
|
`,
|
||||||
RunE: createImageUpdateRun,
|
RunE: createImageUpdateRun,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,7 +18,9 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
apimeta "k8s.io/apimachinery/pkg/api/meta"
|
apimeta "k8s.io/apimachinery/pkg/api/meta"
|
||||||
@@ -32,8 +34,8 @@ import (
|
|||||||
|
|
||||||
var getCmd = &cobra.Command{
|
var getCmd = &cobra.Command{
|
||||||
Use: "get",
|
Use: "get",
|
||||||
Short: "Get sources and resources",
|
Short: "Get the resources and their status",
|
||||||
Long: "The get sub-commands print the statuses of sources and resources.",
|
Long: "The get sub-commands print the statuses of Flux resources.",
|
||||||
}
|
}
|
||||||
|
|
||||||
type GetFlags struct {
|
type GetFlags struct {
|
||||||
@@ -50,7 +52,7 @@ func init() {
|
|||||||
|
|
||||||
type summarisable interface {
|
type summarisable interface {
|
||||||
listAdapter
|
listAdapter
|
||||||
summariseItem(i int, includeNamespace bool) []string
|
summariseItem(i int, includeNamespace bool, includeKind bool) []string
|
||||||
headers(includeNamespace bool) []string
|
headers(includeNamespace bool) []string
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -63,11 +65,17 @@ func statusAndMessage(conditions []metav1.Condition) (string, string) {
|
|||||||
return string(metav1.ConditionFalse), "waiting to be reconciled"
|
return string(metav1.ConditionFalse), "waiting to be reconciled"
|
||||||
}
|
}
|
||||||
|
|
||||||
func nameColumns(item named, includeNamespace bool) []string {
|
func nameColumns(item named, includeNamespace bool, includeKind bool) []string {
|
||||||
if includeNamespace {
|
name := item.GetName()
|
||||||
return []string{item.GetNamespace(), item.GetName()}
|
if includeKind {
|
||||||
|
name = fmt.Sprintf("%s/%s",
|
||||||
|
strings.ToLower(item.GetObjectKind().GroupVersionKind().Kind),
|
||||||
|
item.GetName())
|
||||||
}
|
}
|
||||||
return []string{item.GetName()}
|
if includeNamespace {
|
||||||
|
return []string{item.GetNamespace(), name}
|
||||||
|
}
|
||||||
|
return []string{name}
|
||||||
}
|
}
|
||||||
|
|
||||||
var namespaceHeader = []string{"Namespace"}
|
var namespaceHeader = []string{"Namespace"}
|
||||||
@@ -100,17 +108,25 @@ func (get getCommand) run(cmd *cobra.Command, args []string) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getAll := cmd.Use == "all"
|
||||||
|
|
||||||
if get.list.len() == 0 {
|
if get.list.len() == 0 {
|
||||||
logger.Failuref("no %s objects found in %s namespace", get.kind, rootArgs.namespace)
|
if !getAll {
|
||||||
|
logger.Failuref("no %s objects found in %s namespace", get.kind, rootArgs.namespace)
|
||||||
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
header := get.list.headers(getArgs.allNamespaces)
|
header := get.list.headers(getArgs.allNamespaces)
|
||||||
var rows [][]string
|
var rows [][]string
|
||||||
for i := 0; i < get.list.len(); i++ {
|
for i := 0; i < get.list.len(); i++ {
|
||||||
row := get.list.summariseItem(i, getArgs.allNamespaces)
|
row := get.list.summariseItem(i, getArgs.allNamespaces, getAll)
|
||||||
rows = append(rows, row)
|
rows = append(rows, row)
|
||||||
}
|
}
|
||||||
utils.PrintTable(os.Stdout, header, rows)
|
utils.PrintTable(os.Stdout, header, rows)
|
||||||
|
|
||||||
|
if getAll {
|
||||||
|
fmt.Println()
|
||||||
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,11 +42,11 @@ func init() {
|
|||||||
getCmd.AddCommand(getHelmReleaseCmd)
|
getCmd.AddCommand(getHelmReleaseCmd)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a helmReleaseListAdapter) summariseItem(i int, includeNamespace bool) []string {
|
func (a helmReleaseListAdapter) summariseItem(i int, includeNamespace bool, includeKind bool) []string {
|
||||||
item := a.Items[i]
|
item := a.Items[i]
|
||||||
revision := item.Status.LastAppliedRevision
|
revision := item.Status.LastAppliedRevision
|
||||||
status, msg := statusAndMessage(item.Status.Conditions)
|
status, msg := statusAndMessage(item.Status.Conditions)
|
||||||
return append(nameColumns(&item, includeNamespace),
|
return append(nameColumns(&item, includeNamespace, includeKind),
|
||||||
status, msg, revision, strings.Title(strconv.FormatBool(item.Spec.Suspend)))
|
status, msg, revision, strings.Title(strconv.FormatBool(item.Spec.Suspend)))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
66
cmd/flux/get_image_all.go
Normal file
66
cmd/flux/get_image_all.go
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2021 The Flux 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 (
|
||||||
|
autov1 "github.com/fluxcd/image-automation-controller/api/v1alpha1"
|
||||||
|
imagev1 "github.com/fluxcd/image-reflector-controller/api/v1alpha1"
|
||||||
|
"github.com/spf13/cobra"
|
||||||
|
)
|
||||||
|
|
||||||
|
var getImageAllCmd = &cobra.Command{
|
||||||
|
Use: "all",
|
||||||
|
Short: "Get all image statuses",
|
||||||
|
Long: "The get image sub-commands print the statuses of all image objects.",
|
||||||
|
Example: ` # List all image objects in a namespace
|
||||||
|
flux get images all --namespace=flux-system
|
||||||
|
|
||||||
|
# List all image objects in all namespaces
|
||||||
|
flux get images all --all-namespaces
|
||||||
|
`,
|
||||||
|
RunE: func(cmd *cobra.Command, args []string) error {
|
||||||
|
c := getCommand{
|
||||||
|
apiType: imageRepositoryType,
|
||||||
|
list: imageRepositoryListAdapter{&imagev1.ImageRepositoryList{}},
|
||||||
|
}
|
||||||
|
if err := c.run(cmd, args); err != nil {
|
||||||
|
logger.Failuref(err.Error())
|
||||||
|
}
|
||||||
|
|
||||||
|
c = getCommand{
|
||||||
|
apiType: imagePolicyType,
|
||||||
|
list: &imagePolicyListAdapter{&imagev1.ImagePolicyList{}},
|
||||||
|
}
|
||||||
|
if err := c.run(cmd, args); err != nil {
|
||||||
|
logger.Failuref(err.Error())
|
||||||
|
}
|
||||||
|
|
||||||
|
c = getCommand{
|
||||||
|
apiType: imageUpdateAutomationType,
|
||||||
|
list: &imageUpdateAutomationListAdapter{&autov1.ImageUpdateAutomationList{}},
|
||||||
|
}
|
||||||
|
if err := c.run(cmd, args); err != nil {
|
||||||
|
logger.Failuref(err.Error())
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
getImageCmd.AddCommand(getImageAllCmd)
|
||||||
|
}
|
||||||
@@ -42,10 +42,10 @@ func init() {
|
|||||||
getImageCmd.AddCommand(getImagePolicyCmd)
|
getImageCmd.AddCommand(getImagePolicyCmd)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s imagePolicyListAdapter) summariseItem(i int, includeNamespace bool) []string {
|
func (s imagePolicyListAdapter) summariseItem(i int, includeNamespace bool, includeKind bool) []string {
|
||||||
item := s.Items[i]
|
item := s.Items[i]
|
||||||
status, msg := statusAndMessage(item.Status.Conditions)
|
status, msg := statusAndMessage(item.Status.Conditions)
|
||||||
return append(nameColumns(&item, includeNamespace), status, msg, item.Status.LatestImage)
|
return append(nameColumns(&item, includeNamespace, includeKind), status, msg, item.Status.LatestImage)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s imagePolicyListAdapter) headers(includeNamespace bool) []string {
|
func (s imagePolicyListAdapter) headers(includeNamespace bool) []string {
|
||||||
|
|||||||
@@ -46,14 +46,14 @@ func init() {
|
|||||||
getImageCmd.AddCommand(getImageRepositoryCmd)
|
getImageCmd.AddCommand(getImageRepositoryCmd)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s imageRepositoryListAdapter) summariseItem(i int, includeNamespace bool) []string {
|
func (s imageRepositoryListAdapter) summariseItem(i int, includeNamespace bool, includeKind bool) []string {
|
||||||
item := s.Items[i]
|
item := s.Items[i]
|
||||||
status, msg := statusAndMessage(item.Status.Conditions)
|
status, msg := statusAndMessage(item.Status.Conditions)
|
||||||
var lastScan string
|
var lastScan string
|
||||||
if item.Status.LastScanResult != nil {
|
if item.Status.LastScanResult != nil {
|
||||||
lastScan = item.Status.LastScanResult.ScanTime.Time.Format(time.RFC3339)
|
lastScan = item.Status.LastScanResult.ScanTime.Time.Format(time.RFC3339)
|
||||||
}
|
}
|
||||||
return append(nameColumns(&item, includeNamespace),
|
return append(nameColumns(&item, includeNamespace, includeKind),
|
||||||
status, msg, lastScan, strings.Title(strconv.FormatBool(item.Spec.Suspend)))
|
status, msg, lastScan, strings.Title(strconv.FormatBool(item.Spec.Suspend)))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -46,14 +46,14 @@ func init() {
|
|||||||
getImageCmd.AddCommand(getImageUpdateCmd)
|
getImageCmd.AddCommand(getImageUpdateCmd)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s imageUpdateAutomationListAdapter) summariseItem(i int, includeNamespace bool) []string {
|
func (s imageUpdateAutomationListAdapter) summariseItem(i int, includeNamespace bool, includeKind bool) []string {
|
||||||
item := s.Items[i]
|
item := s.Items[i]
|
||||||
status, msg := statusAndMessage(item.Status.Conditions)
|
status, msg := statusAndMessage(item.Status.Conditions)
|
||||||
var lastRun string
|
var lastRun string
|
||||||
if item.Status.LastAutomationRunTime != nil {
|
if item.Status.LastAutomationRunTime != nil {
|
||||||
lastRun = item.Status.LastAutomationRunTime.Time.Format(time.RFC3339)
|
lastRun = item.Status.LastAutomationRunTime.Time.Format(time.RFC3339)
|
||||||
}
|
}
|
||||||
return append(nameColumns(&item, includeNamespace), status, msg, lastRun, strings.Title(strconv.FormatBool(item.Spec.Suspend)))
|
return append(nameColumns(&item, includeNamespace, includeKind), status, msg, lastRun, strings.Title(strconv.FormatBool(item.Spec.Suspend)))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s imageUpdateAutomationListAdapter) headers(includeNamespace bool) []string {
|
func (s imageUpdateAutomationListAdapter) headers(includeNamespace bool) []string {
|
||||||
@@ -42,11 +42,11 @@ func init() {
|
|||||||
getCmd.AddCommand(getKsCmd)
|
getCmd.AddCommand(getKsCmd)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a kustomizationListAdapter) summariseItem(i int, includeNamespace bool) []string {
|
func (a kustomizationListAdapter) summariseItem(i int, includeNamespace bool, includeKind bool) []string {
|
||||||
item := a.Items[i]
|
item := a.Items[i]
|
||||||
revision := item.Status.LastAppliedRevision
|
revision := item.Status.LastAppliedRevision
|
||||||
status, msg := statusAndMessage(item.Status.Conditions)
|
status, msg := statusAndMessage(item.Status.Conditions)
|
||||||
return append(nameColumns(&item, includeNamespace),
|
return append(nameColumns(&item, includeNamespace, includeKind),
|
||||||
status, msg, revision, strings.Title(strconv.FormatBool(item.Spec.Suspend)))
|
status, msg, revision, strings.Title(strconv.FormatBool(item.Spec.Suspend)))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
73
cmd/flux/get_source_all.go
Normal file
73
cmd/flux/get_source_all.go
Normal file
@@ -0,0 +1,73 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2021 The Flux 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 (
|
||||||
|
sourcev1 "github.com/fluxcd/source-controller/api/v1beta1"
|
||||||
|
"github.com/spf13/cobra"
|
||||||
|
)
|
||||||
|
|
||||||
|
var getSourceAllCmd = &cobra.Command{
|
||||||
|
Use: "all",
|
||||||
|
Short: "Get all source statuses",
|
||||||
|
Long: "The get sources all command print the statuses of all sources.",
|
||||||
|
Example: ` # List all sources in a namespace
|
||||||
|
flux get sources all --namespace=flux-system
|
||||||
|
|
||||||
|
# List all sources in all namespaces
|
||||||
|
flux get sources all --all-namespaces
|
||||||
|
`,
|
||||||
|
RunE: func(cmd *cobra.Command, args []string) error {
|
||||||
|
c := getCommand{
|
||||||
|
apiType: bucketType,
|
||||||
|
list: &bucketListAdapter{&sourcev1.BucketList{}},
|
||||||
|
}
|
||||||
|
if err := c.run(cmd, args); err != nil {
|
||||||
|
logger.Failuref(err.Error())
|
||||||
|
}
|
||||||
|
|
||||||
|
c = getCommand{
|
||||||
|
apiType: gitRepositoryType,
|
||||||
|
list: &gitRepositoryListAdapter{&sourcev1.GitRepositoryList{}},
|
||||||
|
}
|
||||||
|
if err := c.run(cmd, args); err != nil {
|
||||||
|
logger.Failuref(err.Error())
|
||||||
|
}
|
||||||
|
|
||||||
|
c = getCommand{
|
||||||
|
apiType: helmRepositoryType,
|
||||||
|
list: &helmRepositoryListAdapter{&sourcev1.HelmRepositoryList{}},
|
||||||
|
}
|
||||||
|
if err := c.run(cmd, args); err != nil {
|
||||||
|
logger.Failuref(err.Error())
|
||||||
|
}
|
||||||
|
|
||||||
|
c = getCommand{
|
||||||
|
apiType: helmChartType,
|
||||||
|
list: &helmChartListAdapter{&sourcev1.HelmChartList{}},
|
||||||
|
}
|
||||||
|
if err := c.run(cmd, args); err != nil {
|
||||||
|
logger.Failuref(err.Error())
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
getSourceCmd.AddCommand(getSourceAllCmd)
|
||||||
|
}
|
||||||
@@ -44,14 +44,14 @@ func init() {
|
|||||||
getSourceCmd.AddCommand(getSourceBucketCmd)
|
getSourceCmd.AddCommand(getSourceBucketCmd)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *bucketListAdapter) summariseItem(i int, includeNamespace bool) []string {
|
func (a *bucketListAdapter) summariseItem(i int, includeNamespace bool, includeKind bool) []string {
|
||||||
item := a.Items[i]
|
item := a.Items[i]
|
||||||
var revision string
|
var revision string
|
||||||
if item.GetArtifact() != nil {
|
if item.GetArtifact() != nil {
|
||||||
revision = item.GetArtifact().Revision
|
revision = item.GetArtifact().Revision
|
||||||
}
|
}
|
||||||
status, msg := statusAndMessage(item.Status.Conditions)
|
status, msg := statusAndMessage(item.Status.Conditions)
|
||||||
return append(nameColumns(&item, includeNamespace),
|
return append(nameColumns(&item, includeNamespace, includeKind),
|
||||||
status, msg, revision, strings.Title(strconv.FormatBool(item.Spec.Suspend)))
|
status, msg, revision, strings.Title(strconv.FormatBool(item.Spec.Suspend)))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -44,14 +44,14 @@ func init() {
|
|||||||
getSourceCmd.AddCommand(getSourceHelmChartCmd)
|
getSourceCmd.AddCommand(getSourceHelmChartCmd)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *helmChartListAdapter) summariseItem(i int, includeNamespace bool) []string {
|
func (a *helmChartListAdapter) summariseItem(i int, includeNamespace bool, includeKind bool) []string {
|
||||||
item := a.Items[i]
|
item := a.Items[i]
|
||||||
var revision string
|
var revision string
|
||||||
if item.GetArtifact() != nil {
|
if item.GetArtifact() != nil {
|
||||||
revision = item.GetArtifact().Revision
|
revision = item.GetArtifact().Revision
|
||||||
}
|
}
|
||||||
status, msg := statusAndMessage(item.Status.Conditions)
|
status, msg := statusAndMessage(item.Status.Conditions)
|
||||||
return append(nameColumns(&item, includeNamespace),
|
return append(nameColumns(&item, includeNamespace, includeKind),
|
||||||
status, msg, revision, strings.Title(strconv.FormatBool(item.Spec.Suspend)))
|
status, msg, revision, strings.Title(strconv.FormatBool(item.Spec.Suspend)))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -44,14 +44,14 @@ func init() {
|
|||||||
getSourceCmd.AddCommand(getSourceGitCmd)
|
getSourceCmd.AddCommand(getSourceGitCmd)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *gitRepositoryListAdapter) summariseItem(i int, includeNamespace bool) []string {
|
func (a *gitRepositoryListAdapter) summariseItem(i int, includeNamespace bool, includeKind bool) []string {
|
||||||
item := a.Items[i]
|
item := a.Items[i]
|
||||||
var revision string
|
var revision string
|
||||||
if item.GetArtifact() != nil {
|
if item.GetArtifact() != nil {
|
||||||
revision = item.GetArtifact().Revision
|
revision = item.GetArtifact().Revision
|
||||||
}
|
}
|
||||||
status, msg := statusAndMessage(item.Status.Conditions)
|
status, msg := statusAndMessage(item.Status.Conditions)
|
||||||
return append(nameColumns(&item, includeNamespace),
|
return append(nameColumns(&item, includeNamespace, includeKind),
|
||||||
status, msg, revision, strings.Title(strconv.FormatBool(item.Spec.Suspend)))
|
status, msg, revision, strings.Title(strconv.FormatBool(item.Spec.Suspend)))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -44,14 +44,14 @@ func init() {
|
|||||||
getSourceCmd.AddCommand(getSourceHelmCmd)
|
getSourceCmd.AddCommand(getSourceHelmCmd)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *helmRepositoryListAdapter) summariseItem(i int, includeNamespace bool) []string {
|
func (a *helmRepositoryListAdapter) summariseItem(i int, includeNamespace bool, includeKind bool) []string {
|
||||||
item := a.Items[i]
|
item := a.Items[i]
|
||||||
var revision string
|
var revision string
|
||||||
if item.GetArtifact() != nil {
|
if item.GetArtifact() != nil {
|
||||||
revision = item.GetArtifact().Revision
|
revision = item.GetArtifact().Revision
|
||||||
}
|
}
|
||||||
status, msg := statusAndMessage(item.Status.Conditions)
|
status, msg := statusAndMessage(item.Status.Conditions)
|
||||||
return append(nameColumns(&item, includeNamespace),
|
return append(nameColumns(&item, includeNamespace, includeKind),
|
||||||
status, msg, revision, strings.Title(strconv.FormatBool(item.Spec.Suspend)))
|
status, msg, revision, strings.Title(strconv.FormatBool(item.Spec.Suspend)))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ limitations under the License.
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||||
"sigs.k8s.io/controller-runtime/pkg/client"
|
"sigs.k8s.io/controller-runtime/pkg/client"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -62,6 +63,7 @@ func (c universalAdapter) asClientObject() client.Object {
|
|||||||
type named interface {
|
type named interface {
|
||||||
GetName() string
|
GetName() string
|
||||||
GetNamespace() string
|
GetNamespace() string
|
||||||
|
GetObjectKind() schema.ObjectKind
|
||||||
SetName(string)
|
SetName(string)
|
||||||
SetNamespace(string)
|
SetNamespace(string)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ func (a helmChartAdapter) asClientObject() client.Object {
|
|||||||
return a.HelmChart
|
return a.HelmChart
|
||||||
}
|
}
|
||||||
|
|
||||||
// sourcev1.ImagePolicyList
|
// sourcev1.HelmChartList
|
||||||
|
|
||||||
type helmChartListAdapter struct {
|
type helmChartListAdapter struct {
|
||||||
*sourcev1.HelmChartList
|
*sourcev1.HelmChartList
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ Command line utility for assembling Kubernetes CD pipelines the GitOps way.
|
|||||||
* [flux create](flux_create.md) - Create or update sources and resources
|
* [flux create](flux_create.md) - Create or update sources and resources
|
||||||
* [flux delete](flux_delete.md) - Delete sources and resources
|
* [flux delete](flux_delete.md) - Delete sources and resources
|
||||||
* [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 the resources and their status
|
||||||
* [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 Flux 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
|
||||||
|
|||||||
@@ -20,9 +20,9 @@ flux create image update [name] [flags]
|
|||||||
--git-repo-ref=flux-system \
|
--git-repo-ref=flux-system \
|
||||||
--git-repo-path="./clusters/my-cluster" \
|
--git-repo-path="./clusters/my-cluster" \
|
||||||
--checkout-branch=main \
|
--checkout-branch=main \
|
||||||
--author-name=flux \
|
--author-name=flux \
|
||||||
--author-email=flux@example.com \
|
--author-email=flux@example.com \
|
||||||
--commit-template="{{range .Updated.Images}}{{println .}}{{end}}"
|
--commit-template="{{range .Updated.Images}}{{println .}}{{end}}"
|
||||||
|
|
||||||
# Configure image updates to push changes to a different branch, if the branch doesn't exists it will be created
|
# Configure image updates to push changes to a different branch, if the branch doesn't exists it will be created
|
||||||
flux create image update flux-system \
|
flux create image update flux-system \
|
||||||
@@ -30,9 +30,9 @@ flux create image update [name] [flags]
|
|||||||
--git-repo-path="./clusters/my-cluster" \
|
--git-repo-path="./clusters/my-cluster" \
|
||||||
--checkout-branch=main \
|
--checkout-branch=main \
|
||||||
--push-branch=image-updates \
|
--push-branch=image-updates \
|
||||||
--author-name=flux \
|
--author-name=flux \
|
||||||
--author-email=flux@example.com \
|
--author-email=flux@example.com \
|
||||||
--commit-template="{{range .Updated.Images}}{{println .}}{{end}}"
|
--commit-template="{{range .Updated.Images}}{{println .}}{{end}}"
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
## flux get
|
## flux get
|
||||||
|
|
||||||
Get sources and resources
|
Get the resources and their status
|
||||||
|
|
||||||
### Synopsis
|
### Synopsis
|
||||||
|
|
||||||
The get sub-commands print the statuses of sources and resources.
|
The get sub-commands print the statuses of Flux resources.
|
||||||
|
|
||||||
### Options
|
### Options
|
||||||
|
|
||||||
|
|||||||
@@ -37,5 +37,5 @@ flux get alert-providers [flags]
|
|||||||
|
|
||||||
### SEE ALSO
|
### SEE ALSO
|
||||||
|
|
||||||
* [flux get](flux_get.md) - Get sources and resources
|
* [flux get](flux_get.md) - Get the resources and their status
|
||||||
|
|
||||||
|
|||||||
@@ -37,5 +37,5 @@ flux get alerts [flags]
|
|||||||
|
|
||||||
### SEE ALSO
|
### SEE ALSO
|
||||||
|
|
||||||
* [flux get](flux_get.md) - Get sources and resources
|
* [flux get](flux_get.md) - Get the resources and their status
|
||||||
|
|
||||||
|
|||||||
@@ -37,5 +37,5 @@ flux get helmreleases [flags]
|
|||||||
|
|
||||||
### SEE ALSO
|
### SEE ALSO
|
||||||
|
|
||||||
* [flux get](flux_get.md) - Get sources and resources
|
* [flux get](flux_get.md) - Get the resources and their status
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,8 @@ The get image sub-commands print the status of image automation objects.
|
|||||||
|
|
||||||
### SEE ALSO
|
### SEE ALSO
|
||||||
|
|
||||||
* [flux get](flux_get.md) - Get sources and resources
|
* [flux get](flux_get.md) - Get the resources and their status
|
||||||
|
* [flux get images all](flux_get_images_all.md) - Get all image statuses
|
||||||
* [flux get images policy](flux_get_images_policy.md) - Get ImagePolicy status
|
* [flux get images policy](flux_get_images_policy.md) - Get ImagePolicy status
|
||||||
* [flux get images repository](flux_get_images_repository.md) - Get ImageRepository status
|
* [flux get images repository](flux_get_images_repository.md) - Get ImageRepository status
|
||||||
* [flux get images update](flux_get_images_update.md) - Get ImageUpdateAutomation status
|
* [flux get images update](flux_get_images_update.md) - Get ImageUpdateAutomation status
|
||||||
|
|||||||
44
docs/cmd/flux_get_images_all.md
Normal file
44
docs/cmd/flux_get_images_all.md
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
## flux get images all
|
||||||
|
|
||||||
|
Get all image statuses
|
||||||
|
|
||||||
|
### Synopsis
|
||||||
|
|
||||||
|
The get image sub-commands print the statuses of all image objects.
|
||||||
|
|
||||||
|
```
|
||||||
|
flux get images all [flags]
|
||||||
|
```
|
||||||
|
|
||||||
|
### Examples
|
||||||
|
|
||||||
|
```
|
||||||
|
# List all image objects in a namespace
|
||||||
|
flux get images all --namespace=flux-system
|
||||||
|
|
||||||
|
# List all image objects in all namespaces
|
||||||
|
flux get images all --all-namespaces
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
### Options
|
||||||
|
|
||||||
|
```
|
||||||
|
-h, --help help for all
|
||||||
|
```
|
||||||
|
|
||||||
|
### Options inherited from parent commands
|
||||||
|
|
||||||
|
```
|
||||||
|
-A, --all-namespaces list the requested object(s) across all namespaces
|
||||||
|
--context string kubernetes context to use
|
||||||
|
--kubeconfig string path to the kubeconfig file (default "~/.kube/config")
|
||||||
|
-n, --namespace string the namespace scope for this operation (default "flux-system")
|
||||||
|
--timeout duration timeout for this operation (default 5m0s)
|
||||||
|
--verbose print generated objects
|
||||||
|
```
|
||||||
|
|
||||||
|
### SEE ALSO
|
||||||
|
|
||||||
|
* [flux get images](flux_get_images.md) - Get image automation object status
|
||||||
|
|
||||||
@@ -37,5 +37,5 @@ flux get kustomizations [flags]
|
|||||||
|
|
||||||
### SEE ALSO
|
### SEE ALSO
|
||||||
|
|
||||||
* [flux get](flux_get.md) - Get sources and resources
|
* [flux get](flux_get.md) - Get the resources and their status
|
||||||
|
|
||||||
|
|||||||
@@ -37,5 +37,5 @@ flux get receivers [flags]
|
|||||||
|
|
||||||
### SEE ALSO
|
### SEE ALSO
|
||||||
|
|
||||||
* [flux get](flux_get.md) - Get sources and resources
|
* [flux get](flux_get.md) - Get the resources and their status
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,8 @@ The get source sub-commands print the statuses of the sources.
|
|||||||
|
|
||||||
### SEE ALSO
|
### SEE ALSO
|
||||||
|
|
||||||
* [flux get](flux_get.md) - Get sources and resources
|
* [flux get](flux_get.md) - Get the resources and their status
|
||||||
|
* [flux get sources all](flux_get_sources_all.md) - Get all source statuses
|
||||||
* [flux get sources bucket](flux_get_sources_bucket.md) - Get Bucket source statuses
|
* [flux get sources bucket](flux_get_sources_bucket.md) - Get Bucket source statuses
|
||||||
* [flux get sources chart](flux_get_sources_chart.md) - Get HelmChart statuses
|
* [flux get sources chart](flux_get_sources_chart.md) - Get HelmChart statuses
|
||||||
* [flux get sources git](flux_get_sources_git.md) - Get GitRepository source statuses
|
* [flux get sources git](flux_get_sources_git.md) - Get GitRepository source statuses
|
||||||
|
|||||||
44
docs/cmd/flux_get_sources_all.md
Normal file
44
docs/cmd/flux_get_sources_all.md
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
## flux get sources all
|
||||||
|
|
||||||
|
Get all source statuses
|
||||||
|
|
||||||
|
### Synopsis
|
||||||
|
|
||||||
|
The get sources all command print the statuses of all sources.
|
||||||
|
|
||||||
|
```
|
||||||
|
flux get sources all [flags]
|
||||||
|
```
|
||||||
|
|
||||||
|
### Examples
|
||||||
|
|
||||||
|
```
|
||||||
|
# List all sources in a namespace
|
||||||
|
flux get sources all --namespace=flux-system
|
||||||
|
|
||||||
|
# List all sources in all namespaces
|
||||||
|
flux get sources all --all-namespaces
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
### Options
|
||||||
|
|
||||||
|
```
|
||||||
|
-h, --help help for all
|
||||||
|
```
|
||||||
|
|
||||||
|
### Options inherited from parent commands
|
||||||
|
|
||||||
|
```
|
||||||
|
-A, --all-namespaces list the requested object(s) across all namespaces
|
||||||
|
--context string kubernetes context to use
|
||||||
|
--kubeconfig string path to the kubeconfig file (default "~/.kube/config")
|
||||||
|
-n, --namespace string the namespace scope for this operation (default "flux-system")
|
||||||
|
--timeout duration timeout for this operation (default 5m0s)
|
||||||
|
--verbose print generated objects
|
||||||
|
```
|
||||||
|
|
||||||
|
### SEE ALSO
|
||||||
|
|
||||||
|
* [flux get sources](flux_get_sources.md) - Get source statuses
|
||||||
|
|
||||||
@@ -148,6 +148,7 @@ nav:
|
|||||||
- Get kustomizations: cmd/flux_get_kustomizations.md
|
- Get kustomizations: cmd/flux_get_kustomizations.md
|
||||||
- Get helmreleases: cmd/flux_get_helmreleases.md
|
- Get helmreleases: cmd/flux_get_helmreleases.md
|
||||||
- Get sources: cmd/flux_get_sources.md
|
- Get sources: cmd/flux_get_sources.md
|
||||||
|
- Get sources all: cmd/flux_get_sources_all.md
|
||||||
- Get sources git: cmd/flux_get_sources_git.md
|
- Get sources git: cmd/flux_get_sources_git.md
|
||||||
- Get sources helm: cmd/flux_get_sources_helm.md
|
- Get sources helm: cmd/flux_get_sources_helm.md
|
||||||
- Get sources chart: cmd/flux_get_sources_chart.md
|
- Get sources chart: cmd/flux_get_sources_chart.md
|
||||||
@@ -157,6 +158,7 @@ nav:
|
|||||||
- Get alert providers: cmd/flux_get_alert-providers.md
|
- Get alert providers: cmd/flux_get_alert-providers.md
|
||||||
- Get receivers: cmd/flux_get_receivers.md
|
- Get receivers: cmd/flux_get_receivers.md
|
||||||
- Get images: cmd/flux_get_images.md
|
- Get images: cmd/flux_get_images.md
|
||||||
|
- Get images all: cmd/flux_get_images_all.md
|
||||||
- Get images policy: cmd/flux_get_images_policy.md
|
- Get images policy: cmd/flux_get_images_policy.md
|
||||||
- Get images repository: cmd/flux_get_images_repository.md
|
- Get images repository: cmd/flux_get_images_repository.md
|
||||||
- Get images update: cmd/flux_get_images_update.md
|
- Get images update: cmd/flux_get_images_update.md
|
||||||
|
|||||||
Reference in New Issue
Block a user