Skip to content

Commit

Permalink
Merge pull request #3429 from fluxcd/cli-notification-v1beta2
Browse files Browse the repository at this point in the history
Update CLI commands to Notification API v1beta2
  • Loading branch information
stefanprodan committed Dec 21, 2022
2 parents 2eced06 + f9e6908 commit 12e065c
Show file tree
Hide file tree
Showing 35 changed files with 42 additions and 40 deletions.
2 changes: 1 addition & 1 deletion cmd/flux/alert.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ package main
import (
"sigs.k8s.io/controller-runtime/pkg/client"

notificationv1 "github.com/fluxcd/notification-controller/api/v1beta1"
notificationv1 "github.com/fluxcd/notification-controller/api/v1beta2"
)

// notificationv1.Alert
Expand Down
2 changes: 1 addition & 1 deletion cmd/flux/alert_provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ package main
import (
"sigs.k8s.io/controller-runtime/pkg/client"

notificationv1 "github.com/fluxcd/notification-controller/api/v1beta1"
notificationv1 "github.com/fluxcd/notification-controller/api/v1beta2"
)

// notificationv1.Provider
Expand Down
2 changes: 1 addition & 1 deletion cmd/flux/create_alert.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import (
"k8s.io/apimachinery/pkg/util/wait"
"sigs.k8s.io/controller-runtime/pkg/client"

notificationv1 "github.com/fluxcd/notification-controller/api/v1beta1"
notificationv1 "github.com/fluxcd/notification-controller/api/v1beta2"
"github.com/fluxcd/pkg/apis/meta"

"github.com/fluxcd/flux2/internal/utils"
Expand Down
2 changes: 1 addition & 1 deletion cmd/flux/create_alertprovider.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import (
"k8s.io/apimachinery/pkg/util/wait"
"sigs.k8s.io/controller-runtime/pkg/client"

notificationv1 "github.com/fluxcd/notification-controller/api/v1beta1"
notificationv1 "github.com/fluxcd/notification-controller/api/v1beta2"
"github.com/fluxcd/pkg/apis/meta"

"github.com/fluxcd/flux2/internal/utils"
Expand Down
2 changes: 1 addition & 1 deletion cmd/flux/create_receiver.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import (
"k8s.io/apimachinery/pkg/util/wait"
"sigs.k8s.io/controller-runtime/pkg/client"

notificationv1 "github.com/fluxcd/notification-controller/api/v1beta1"
notificationv1 "github.com/fluxcd/notification-controller/api/v1beta2"
"github.com/fluxcd/pkg/apis/meta"

"github.com/fluxcd/flux2/internal/utils"
Expand Down
2 changes: 1 addition & 1 deletion cmd/flux/delete_alert.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ package main
import (
"github.com/spf13/cobra"

notificationv1 "github.com/fluxcd/notification-controller/api/v1beta1"
notificationv1 "github.com/fluxcd/notification-controller/api/v1beta2"
)

var deleteAlertCmd = &cobra.Command{
Expand Down
2 changes: 1 addition & 1 deletion cmd/flux/delete_alertprovider.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ package main
import (
"github.com/spf13/cobra"

notificationv1 "github.com/fluxcd/notification-controller/api/v1beta1"
notificationv1 "github.com/fluxcd/notification-controller/api/v1beta2"
)

var deleteAlertProviderCmd = &cobra.Command{
Expand Down
2 changes: 1 addition & 1 deletion cmd/flux/delete_receiver.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ package main
import (
"github.com/spf13/cobra"

notificationv1 "github.com/fluxcd/notification-controller/api/v1beta1"
notificationv1 "github.com/fluxcd/notification-controller/api/v1beta2"
)

var deleteReceiverCmd = &cobra.Command{
Expand Down
2 changes: 1 addition & 1 deletion cmd/flux/export_alert.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
"github.com/spf13/cobra"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

notificationv1 "github.com/fluxcd/notification-controller/api/v1beta1"
notificationv1 "github.com/fluxcd/notification-controller/api/v1beta2"
)

var exportAlertCmd = &cobra.Command{
Expand Down
2 changes: 1 addition & 1 deletion cmd/flux/export_alertprovider.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
"github.com/spf13/cobra"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

notificationv1 "github.com/fluxcd/notification-controller/api/v1beta1"
notificationv1 "github.com/fluxcd/notification-controller/api/v1beta2"
)

var exportAlertProviderCmd = &cobra.Command{
Expand Down
2 changes: 1 addition & 1 deletion cmd/flux/export_receiver.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
"github.com/spf13/cobra"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

notificationv1 "github.com/fluxcd/notification-controller/api/v1beta1"
notificationv1 "github.com/fluxcd/notification-controller/api/v1beta2"
)

var exportReceiverCmd = &cobra.Command{
Expand Down
2 changes: 1 addition & 1 deletion cmd/flux/get_alert.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
"github.com/spf13/cobra"
"k8s.io/apimachinery/pkg/runtime"

notificationv1 "github.com/fluxcd/notification-controller/api/v1beta1"
notificationv1 "github.com/fluxcd/notification-controller/api/v1beta2"
)

var getAlertCmd = &cobra.Command{
Expand Down
2 changes: 1 addition & 1 deletion cmd/flux/get_alertprovider.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
"github.com/spf13/cobra"
"k8s.io/apimachinery/pkg/runtime"

notificationv1 "github.com/fluxcd/notification-controller/api/v1beta1"
notificationv1 "github.com/fluxcd/notification-controller/api/v1beta2"
)

var getAlertProviderCmd = &cobra.Command{
Expand Down
2 changes: 1 addition & 1 deletion cmd/flux/get_all.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (

helmv2 "github.com/fluxcd/helm-controller/api/v2beta1"
kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1beta2"
notificationv1 "github.com/fluxcd/notification-controller/api/v1beta1"
notificationv1 "github.com/fluxcd/notification-controller/api/v1beta2"
)

var getAllCmd = &cobra.Command{
Expand Down
2 changes: 1 addition & 1 deletion cmd/flux/get_receiver.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
"github.com/spf13/cobra"
"k8s.io/apimachinery/pkg/runtime"

notificationv1 "github.com/fluxcd/notification-controller/api/v1beta1"
notificationv1 "github.com/fluxcd/notification-controller/api/v1beta2"
)

var getReceiverCmd = &cobra.Command{
Expand Down
2 changes: 1 addition & 1 deletion cmd/flux/receiver.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ package main
import (
"sigs.k8s.io/controller-runtime/pkg/client"

notificationv1 "github.com/fluxcd/notification-controller/api/v1beta1"
notificationv1 "github.com/fluxcd/notification-controller/api/v1beta2"
)

// notificationv1.Receiver
Expand Down
4 changes: 2 additions & 2 deletions cmd/flux/reconcile.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import (
"k8s.io/client-go/util/retry"
"sigs.k8s.io/controller-runtime/pkg/client"

"github.com/fluxcd/notification-controller/api/v1beta1"
notificationv1 "github.com/fluxcd/notification-controller/api/v1beta2"
"github.com/fluxcd/pkg/apis/meta"

"github.com/fluxcd/flux2/internal/utils"
Expand Down Expand Up @@ -111,7 +111,7 @@ func (reconcile reconcileCommand) run(cmd *cobra.Command, args []string) error {
}
logger.Successf("%s annotated", reconcile.kind)

if reconcile.kind == v1beta1.AlertKind || reconcile.kind == v1beta1.ReceiverKind {
if reconcile.kind == notificationv1.AlertKind || reconcile.kind == notificationv1.ReceiverKind {
if err = wait.PollImmediate(rootArgs.pollInterval, rootArgs.timeout,
isReconcileReady(ctx, kubeClient, namespacedName, reconcile.object)); err != nil {
return err
Expand Down
2 changes: 1 addition & 1 deletion cmd/flux/reconcile_alert.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ package main
import (
"github.com/spf13/cobra"

notificationv1 "github.com/fluxcd/notification-controller/api/v1beta1"
notificationv1 "github.com/fluxcd/notification-controller/api/v1beta2"
)

var reconcileAlertCmd = &cobra.Command{
Expand Down
2 changes: 1 addition & 1 deletion cmd/flux/reconcile_alertprovider.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (
"k8s.io/apimachinery/pkg/types"
"k8s.io/apimachinery/pkg/util/wait"

notificationv1 "github.com/fluxcd/notification-controller/api/v1beta1"
notificationv1 "github.com/fluxcd/notification-controller/api/v1beta2"
"github.com/fluxcd/pkg/apis/meta"

"github.com/fluxcd/flux2/internal/utils"
Expand Down
2 changes: 1 addition & 1 deletion cmd/flux/reconcile_receiver.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (
"k8s.io/apimachinery/pkg/types"
"k8s.io/apimachinery/pkg/util/wait"

notificationv1 "github.com/fluxcd/notification-controller/api/v1beta1"
notificationv1 "github.com/fluxcd/notification-controller/api/v1beta2"
"github.com/fluxcd/pkg/apis/meta"

"github.com/fluxcd/flux2/internal/utils"
Expand Down
2 changes: 1 addition & 1 deletion cmd/flux/resume_alert.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ package main
import (
"github.com/spf13/cobra"

notificationv1 "github.com/fluxcd/notification-controller/api/v1beta1"
notificationv1 "github.com/fluxcd/notification-controller/api/v1beta2"
)

var resumeAlertCmd = &cobra.Command{
Expand Down
2 changes: 1 addition & 1 deletion cmd/flux/resume_receiver.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ package main
import (
"github.com/spf13/cobra"

notificationv1 "github.com/fluxcd/notification-controller/api/v1beta1"
notificationv1 "github.com/fluxcd/notification-controller/api/v1beta2"
)

var resumeReceiverCmd = &cobra.Command{
Expand Down
2 changes: 1 addition & 1 deletion cmd/flux/suspend_alert.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ package main
import (
"github.com/spf13/cobra"

notificationv1 "github.com/fluxcd/notification-controller/api/v1beta1"
notificationv1 "github.com/fluxcd/notification-controller/api/v1beta2"
)

var suspendAlertCmd = &cobra.Command{
Expand Down
2 changes: 1 addition & 1 deletion cmd/flux/suspend_receiver.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ package main
import (
"github.com/spf13/cobra"

notificationv1 "github.com/fluxcd/notification-controller/api/v1beta1"
notificationv1 "github.com/fluxcd/notification-controller/api/v1beta2"
)

var suspendReceiverCmd = &cobra.Command{
Expand Down
2 changes: 1 addition & 1 deletion cmd/flux/testdata/export/alert.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
apiVersion: notification.toolkit.fluxcd.io/v1beta1
apiVersion: notification.toolkit.fluxcd.io/v1beta2
kind: Alert
metadata:
name: flux-system
Expand Down
6 changes: 3 additions & 3 deletions cmd/flux/testdata/export/objects.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ kind: Namespace
metadata:
name: {{ .fluxns }}
---
apiVersion: notification.toolkit.fluxcd.io/v1beta1
apiVersion: notification.toolkit.fluxcd.io/v1beta2
kind: Provider
metadata:
name: slack
Expand All @@ -14,7 +14,7 @@ spec:
channel: 'A channel with spacess'
address: https://hooks.slack.com/services/mock
---
apiVersion: notification.toolkit.fluxcd.io/v1beta1
apiVersion: notification.toolkit.fluxcd.io/v1beta2
kind: Alert
metadata:
name: flux-system
Expand Down Expand Up @@ -97,7 +97,7 @@ spec:
interval: 5m
prune: true
---
apiVersion: notification.toolkit.fluxcd.io/v1beta1
apiVersion: notification.toolkit.fluxcd.io/v1beta2
kind: Receiver
metadata:
name: flux-system
Expand Down
3 changes: 2 additions & 1 deletion cmd/flux/testdata/export/provider.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
---
apiVersion: notification.toolkit.fluxcd.io/v1beta1
apiVersion: notification.toolkit.fluxcd.io/v1beta2
kind: Provider
metadata:
name: slack
namespace: {{ .fluxns }}
spec:
address: https://hooks.slack.com/services/mock
channel: A channel with spacess
interval: 10m0s
type: slack

3 changes: 2 additions & 1 deletion cmd/flux/testdata/export/receiver.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
apiVersion: notification.toolkit.fluxcd.io/v1beta1
apiVersion: notification.toolkit.fluxcd.io/v1beta2
kind: Receiver
metadata:
name: flux-system
Expand All @@ -8,6 +8,7 @@ spec:
events:
- ping
- push
interval: 10m0s
resources:
- kind: GitRepository
name: flux-system
Expand Down
2 changes: 1 addition & 1 deletion internal/utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ import (
imageautov1 "github.com/fluxcd/image-automation-controller/api/v1beta1"
imagereflectv1 "github.com/fluxcd/image-reflector-controller/api/v1beta1"
kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1beta2"
notificationv1 "github.com/fluxcd/notification-controller/api/v1beta1"
notificationv1 "github.com/fluxcd/notification-controller/api/v1beta2"
"github.com/fluxcd/pkg/apis/meta"
runclient "github.com/fluxcd/pkg/runtime/client"
"github.com/fluxcd/pkg/version"
Expand Down
2 changes: 1 addition & 1 deletion pkg/uninstall/uninstall.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import (
autov1 "github.com/fluxcd/image-automation-controller/api/v1beta1"
imagev1 "github.com/fluxcd/image-reflector-controller/api/v1beta1"
kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1beta2"
notificationv1 "github.com/fluxcd/notification-controller/api/v1beta1"
notificationv1 "github.com/fluxcd/notification-controller/api/v1beta2"
sourcev1 "github.com/fluxcd/source-controller/api/v1beta2"
)

Expand Down
4 changes: 2 additions & 2 deletions rfcs/0001-authorization/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,8 @@ fields that are not restricted to the namespace of the containing object, listed
| | `.spec.targetNamespace` | This gives the namespace into which a Helm chart is installed (note: using impersonation) |
| | `.spec.storageNamespace` | This gives the namespace in which the record of a Helm install is created (note: using impersonation) |
| | `.spec.chart.spec.sourceRef` | This is a reference (in the created `HelmChart` object) that can include a namespace |
| **`alerts.notification.toolkit.fluxcd.io/v1beta1`** | `.spec.eventSources` | Items are references that can include a namespace |
| **`receivers.notification.toolkit.fluxcd.io/v1beta1`** | `.spec.resources` | Items in this field are references that can include a namespace |
| **`alerts.notification.toolkit.fluxcd.io/v1beta2`** | `.spec.eventSources` | Items are references that can include a namespace |
| **`receivers.notification.toolkit.fluxcd.io/v1beta2`** | `.spec.resources` | Items in this field are references that can include a namespace |
| **`imagepolicies.image.toolkit.fluxcd.io/v1beta1`** | `.spec.imageRepositoryRef` | This reference can include a namespace[1] |

[1] This particular cross-namespace reference is subject to additional access control; see "Access
Expand Down
2 changes: 1 addition & 1 deletion tests/azure/azure_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ import (
automationv1beta1 "github.com/fluxcd/image-automation-controller/api/v1beta1"
reflectorv1beta1 "github.com/fluxcd/image-reflector-controller/api/v1beta1"
kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1beta2"
notiv1beta1 "github.com/fluxcd/notification-controller/api/v1beta1"
notiv1beta1 "github.com/fluxcd/notification-controller/api/v1beta2"
eventv1 "github.com/fluxcd/pkg/apis/event/v1beta1"
"github.com/fluxcd/pkg/apis/meta"
sourcev1 "github.com/fluxcd/source-controller/api/v1beta2"
Expand Down
2 changes: 1 addition & 1 deletion tests/azure/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ require (
github.com/fluxcd/image-automation-controller/api v0.28.0
github.com/fluxcd/image-reflector-controller/api v0.23.1
github.com/fluxcd/kustomize-controller/api v0.32.0
github.com/fluxcd/notification-controller/api v0.30.0
github.com/fluxcd/notification-controller/api v0.30.1
github.com/fluxcd/pkg/apis/event v0.2.0
github.com/fluxcd/pkg/apis/meta v0.18.0
github.com/fluxcd/pkg/git v0.7.0
Expand Down
4 changes: 2 additions & 2 deletions tests/azure/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,8 @@ github.com/fluxcd/image-reflector-controller/api v0.23.1 h1:ysYzSDhFV5JPzrhTnyab
github.com/fluxcd/image-reflector-controller/api v0.23.1/go.mod h1:uomyKK0ZWFOsG40wqmCJvIN8OpAiPKFteXe+cdhB/Z0=
github.com/fluxcd/kustomize-controller/api v0.32.0 h1:5QGLV5xRI8S3tUFJNV+vVzy/pdl0d6Ua0AccWwGRKfs=
github.com/fluxcd/kustomize-controller/api v0.32.0/go.mod h1:t2pqIe1SMzdZIAG/aietrg3XpRXmpcubf0uxDJOryEA=
github.com/fluxcd/notification-controller/api v0.30.0 h1:m8wEBtPFcO9ZMSO0NLuONhIKDsiPFJ4ys3JYs4jlvCE=
github.com/fluxcd/notification-controller/api v0.30.0/go.mod h1:Ve4SE6jeiGlyItvHa7/UpTPOVC6ac5K76Frv1P7hqLw=
github.com/fluxcd/notification-controller/api v0.30.1 h1:7523fRatqKJPeZcJsR7D0PW/h5ND/DeNgHLzEfOFmA0=
github.com/fluxcd/notification-controller/api v0.30.1/go.mod h1:Ve4SE6jeiGlyItvHa7/UpTPOVC6ac5K76Frv1P7hqLw=
github.com/fluxcd/pkg/apis/acl v0.1.0 h1:EoAl377hDQYL3WqanWCdifauXqXbMyFuK82NnX6pH4Q=
github.com/fluxcd/pkg/apis/acl v0.1.0/go.mod h1:zfEZzz169Oap034EsDhmCAGgnWlcWmIObZjYMusoXS8=
github.com/fluxcd/pkg/apis/event v0.2.0 h1:cmAtkZfoEaNVYegI4SFM8XstdRAil3O9AoP+8fpbR34=
Expand Down
2 changes: 1 addition & 1 deletion tests/azure/util_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ import (
automationv1beta1 "github.com/fluxcd/image-automation-controller/api/v1beta1"
reflectorv1beta1 "github.com/fluxcd/image-reflector-controller/api/v1beta1"
kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1beta2"
notiv1beta1 "github.com/fluxcd/notification-controller/api/v1beta1"
notiv1beta1 "github.com/fluxcd/notification-controller/api/v1beta2"
"github.com/fluxcd/pkg/apis/meta"
"github.com/fluxcd/pkg/git"
"github.com/fluxcd/pkg/git/gogit"
Expand Down

0 comments on commit 12e065c

Please sign in to comment.