Sets the flux cli `suspend` command `--reason` flag to an empty string

as default and changes the flux resource suspend behavior to only apply
the suspend reason annotation when a non-empty reason is provided.

Signed-off-by: Travis Mattera <travis@mattera.io>
pull/4232/head
Travis Mattera 2 years ago
parent 59c759e885
commit 0ba9db560b
No known key found for this signature in database
GPG Key ID: 6E9A8A6A0A74CA52

@ -43,7 +43,7 @@ var suspendArgs SuspendFlags
func init() {
suspendCmd.PersistentFlags().BoolVarP(&suspendArgs.all, "all", "", false,
"suspend all resources in that namespace")
suspendCmd.PersistentFlags().StringVarP(&suspendArgs.reason, "reason", "r", "suspended",
suspendCmd.PersistentFlags().StringVarP(&suspendArgs.reason, "reason", "r", "",
"set a reason for why the resource is suspended, the reason will show up under the suspend.toolkit.fluxcd.io/reason annotation")
rootCmd.AddCommand(suspendCmd)
}

@ -49,7 +49,9 @@ func (obj alertAdapter) isSuspended() bool {
func (obj alertAdapter) setSuspended(reason string) {
obj.Alert.Spec.Suspend = true
obj.Alert.Annotations[SuspendReasonAnnotation] = reason
if reason != "" {
obj.Alert.Annotations[SuspendReasonAnnotation] = reason
}
}
func (a alertListAdapter) item(i int) suspendable {

@ -50,7 +50,9 @@ func (obj helmReleaseAdapter) isSuspended() bool {
func (obj helmReleaseAdapter) setSuspended(reason string) {
obj.HelmRelease.Spec.Suspend = true
obj.HelmRelease.Annotations[SuspendReasonAnnotation] = reason
if reason != "" {
obj.HelmRelease.Annotations[SuspendReasonAnnotation] = reason
}
}
func (a helmReleaseListAdapter) item(i int) suspendable {

@ -49,7 +49,9 @@ func (obj imageRepositoryAdapter) isSuspended() bool {
func (obj imageRepositoryAdapter) setSuspended(reason string) {
obj.ImageRepository.Spec.Suspend = true
obj.ImageRepository.Annotations[SuspendReasonAnnotation] = reason
if reason != "" {
obj.ImageRepository.Annotations[SuspendReasonAnnotation] = reason
}
}
func (a imageRepositoryListAdapter) item(i int) suspendable {

@ -49,7 +49,9 @@ func (update imageUpdateAutomationAdapter) isSuspended() bool {
func (update imageUpdateAutomationAdapter) setSuspended(reason string) {
update.ImageUpdateAutomation.Spec.Suspend = true
update.ImageUpdateAutomation.Annotations[SuspendReasonAnnotation] = reason
if reason != "" {
update.ImageUpdateAutomation.Annotations[SuspendReasonAnnotation] = reason
}
}
func (a imageUpdateAutomationListAdapter) item(i int) suspendable {

@ -50,7 +50,9 @@ func (obj kustomizationAdapter) isSuspended() bool {
func (obj kustomizationAdapter) setSuspended(reason string) {
obj.Kustomization.Spec.Suspend = true
obj.Kustomization.Annotations[SuspendReasonAnnotation] = reason
if reason != "" {
obj.Kustomization.Annotations[SuspendReasonAnnotation] = reason
}
}
func (a kustomizationListAdapter) item(i int) suspendable {

@ -49,7 +49,9 @@ func (obj receiverAdapter) isSuspended() bool {
func (obj receiverAdapter) setSuspended(reason string) {
obj.Receiver.Spec.Suspend = true
obj.Receiver.Annotations[SuspendReasonAnnotation] = reason
if reason != "" {
obj.Receiver.Annotations[SuspendReasonAnnotation] = reason
}
}
func (a receiverListAdapter) item(i int) suspendable {

@ -49,7 +49,9 @@ func (obj bucketAdapter) isSuspended() bool {
func (obj bucketAdapter) setSuspended(reason string) {
obj.Bucket.Spec.Suspend = true
obj.Bucket.Annotations[SuspendReasonAnnotation] = reason
if reason != "" {
obj.Bucket.Annotations[SuspendReasonAnnotation] = reason
}
}
func (a bucketListAdapter) item(i int) suspendable {

@ -49,7 +49,9 @@ func (obj helmChartAdapter) isSuspended() bool {
func (obj helmChartAdapter) setSuspended(reason string) {
obj.HelmChart.Spec.Suspend = true
obj.HelmChart.Annotations[SuspendReasonAnnotation] = reason
if reason != "" {
obj.HelmChart.Annotations[SuspendReasonAnnotation] = reason
}
}
func (a helmChartListAdapter) item(i int) suspendable {

@ -49,7 +49,9 @@ func (obj gitRepositoryAdapter) isSuspended() bool {
func (obj gitRepositoryAdapter) setSuspended(reason string) {
obj.GitRepository.Spec.Suspend = true
obj.GitRepository.Annotations[SuspendReasonAnnotation] = reason
if reason != "" {
obj.GitRepository.Annotations[SuspendReasonAnnotation] = reason
}
}
func (a gitRepositoryListAdapter) item(i int) suspendable {

@ -49,7 +49,9 @@ func (obj helmRepositoryAdapter) isSuspended() bool {
func (obj helmRepositoryAdapter) setSuspended(reason string) {
obj.HelmRepository.Spec.Suspend = true
obj.HelmRepository.Annotations[SuspendReasonAnnotation] = reason
if reason != "" {
obj.HelmRepository.Annotations[SuspendReasonAnnotation] = reason
}
}
func (a helmRepositoryListAdapter) item(i int) suspendable {

@ -49,7 +49,9 @@ func (obj ociRepositoryAdapter) isSuspended() bool {
func (obj ociRepositoryAdapter) setSuspended(reason string) {
obj.OCIRepository.Spec.Suspend = true
obj.OCIRepository.Annotations[SuspendReasonAnnotation] = reason
if reason != "" {
obj.OCIRepository.Annotations[SuspendReasonAnnotation] = reason
}
}
func (a ociRepositoryListAdapter) item(i int) suspendable {

Loading…
Cancel
Save