Update all the references of NC v1beta2 to v1beta3
Signed-off-by: Sunny <darkowlzz@protonmail.com>
This commit is contained in:
@@ -19,7 +19,7 @@ package main
|
||||
import (
|
||||
"sigs.k8s.io/controller-runtime/pkg/client"
|
||||
|
||||
notificationv1 "github.com/fluxcd/notification-controller/api/v1beta2"
|
||||
notificationv1 "github.com/fluxcd/notification-controller/api/v1beta3"
|
||||
)
|
||||
|
||||
// notificationv1.Alert
|
||||
|
||||
@@ -19,7 +19,7 @@ package main
|
||||
import (
|
||||
"sigs.k8s.io/controller-runtime/pkg/client"
|
||||
|
||||
notificationv1 "github.com/fluxcd/notification-controller/api/v1beta2"
|
||||
notificationv1 "github.com/fluxcd/notification-controller/api/v1beta3"
|
||||
)
|
||||
|
||||
// notificationv1.Provider
|
||||
|
||||
@@ -28,7 +28,7 @@ import (
|
||||
"sigs.k8s.io/controller-runtime/pkg/client"
|
||||
|
||||
notificationv1 "github.com/fluxcd/notification-controller/api/v1"
|
||||
notificationv1b2 "github.com/fluxcd/notification-controller/api/v1beta2"
|
||||
notificationv1b3 "github.com/fluxcd/notification-controller/api/v1beta3"
|
||||
"github.com/fluxcd/pkg/apis/meta"
|
||||
|
||||
"github.com/fluxcd/flux2/v2/internal/utils"
|
||||
@@ -96,13 +96,13 @@ func createAlertCmdRun(cmd *cobra.Command, args []string) error {
|
||||
logger.Generatef("generating Alert")
|
||||
}
|
||||
|
||||
alert := notificationv1b2.Alert{
|
||||
alert := notificationv1b3.Alert{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: name,
|
||||
Namespace: *kubeconfigArgs.Namespace,
|
||||
Labels: sourceLabels,
|
||||
},
|
||||
Spec: notificationv1b2.AlertSpec{
|
||||
Spec: notificationv1b3.AlertSpec{
|
||||
ProviderRef: meta.LocalObjectReference{
|
||||
Name: alertArgs.providerRef,
|
||||
},
|
||||
@@ -140,13 +140,13 @@ func createAlertCmdRun(cmd *cobra.Command, args []string) error {
|
||||
}
|
||||
|
||||
func upsertAlert(ctx context.Context, kubeClient client.Client,
|
||||
alert *notificationv1b2.Alert) (types.NamespacedName, error) {
|
||||
alert *notificationv1b3.Alert) (types.NamespacedName, error) {
|
||||
namespacedName := types.NamespacedName{
|
||||
Namespace: alert.GetNamespace(),
|
||||
Name: alert.GetName(),
|
||||
}
|
||||
|
||||
var existing notificationv1b2.Alert
|
||||
var existing notificationv1b3.Alert
|
||||
err := kubeClient.Get(ctx, namespacedName, &existing)
|
||||
if err != nil {
|
||||
if errors.IsNotFound(err) {
|
||||
|
||||
@@ -27,7 +27,7 @@ import (
|
||||
"k8s.io/apimachinery/pkg/util/wait"
|
||||
"sigs.k8s.io/controller-runtime/pkg/client"
|
||||
|
||||
notificationv1 "github.com/fluxcd/notification-controller/api/v1beta2"
|
||||
notificationv1 "github.com/fluxcd/notification-controller/api/v1beta3"
|
||||
"github.com/fluxcd/pkg/apis/meta"
|
||||
|
||||
"github.com/fluxcd/flux2/v2/internal/utils"
|
||||
|
||||
@@ -19,7 +19,7 @@ package main
|
||||
import (
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
notificationv1 "github.com/fluxcd/notification-controller/api/v1beta2"
|
||||
notificationv1 "github.com/fluxcd/notification-controller/api/v1beta3"
|
||||
)
|
||||
|
||||
var deleteAlertCmd = &cobra.Command{
|
||||
|
||||
@@ -19,7 +19,7 @@ package main
|
||||
import (
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
notificationv1 "github.com/fluxcd/notification-controller/api/v1beta2"
|
||||
notificationv1 "github.com/fluxcd/notification-controller/api/v1beta3"
|
||||
)
|
||||
|
||||
var deleteAlertProviderCmd = &cobra.Command{
|
||||
|
||||
@@ -44,7 +44,7 @@ import (
|
||||
imagev1 "github.com/fluxcd/image-reflector-controller/api/v1beta2"
|
||||
kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1"
|
||||
notificationv1 "github.com/fluxcd/notification-controller/api/v1"
|
||||
notificationv1b2 "github.com/fluxcd/notification-controller/api/v1beta2"
|
||||
notificationv1b3 "github.com/fluxcd/notification-controller/api/v1beta3"
|
||||
sourcev1 "github.com/fluxcd/source-controller/api/v1"
|
||||
sourcev1b2 "github.com/fluxcd/source-controller/api/v1beta2"
|
||||
|
||||
@@ -426,14 +426,14 @@ var fluxKindMap = refMap{
|
||||
},
|
||||
field: []string{"spec", "chart", "spec", "sourceRef"},
|
||||
},
|
||||
notificationv1b2.AlertKind: {
|
||||
gvk: notificationv1b2.GroupVersion.WithKind(notificationv1b2.AlertKind),
|
||||
kind: notificationv1b2.ProviderKind,
|
||||
notificationv1b3.AlertKind: {
|
||||
gvk: notificationv1b3.GroupVersion.WithKind(notificationv1b3.AlertKind),
|
||||
kind: notificationv1b3.ProviderKind,
|
||||
crossNamespaced: false,
|
||||
field: []string{"spec", "providerRef"},
|
||||
},
|
||||
notificationv1.ReceiverKind: {gvk: notificationv1.GroupVersion.WithKind(notificationv1.ReceiverKind)},
|
||||
notificationv1b2.ProviderKind: {gvk: notificationv1b2.GroupVersion.WithKind(notificationv1b2.ProviderKind)},
|
||||
notificationv1b3.ProviderKind: {gvk: notificationv1b3.GroupVersion.WithKind(notificationv1b3.ProviderKind)},
|
||||
imagev1.ImagePolicyKind: {
|
||||
gvk: imagev1.GroupVersion.WithKind(imagev1.ImagePolicyKind),
|
||||
kind: imagev1.ImageRepositoryKind,
|
||||
|
||||
@@ -118,7 +118,7 @@ spec:
|
||||
name: podinfo-chart
|
||||
version: '*'
|
||||
---
|
||||
apiVersion: notification.toolkit.fluxcd.io/v1beta2
|
||||
apiVersion: notification.toolkit.fluxcd.io/v1beta3
|
||||
kind: Alert
|
||||
metadata:
|
||||
name: webapp
|
||||
@@ -131,7 +131,7 @@ spec:
|
||||
providerRef:
|
||||
name: slack
|
||||
---
|
||||
apiVersion: notification.toolkit.fluxcd.io/v1beta2
|
||||
apiVersion: notification.toolkit.fluxcd.io/v1beta3
|
||||
kind: Provider
|
||||
metadata:
|
||||
name: slack
|
||||
|
||||
@@ -20,7 +20,7 @@ import (
|
||||
"github.com/spf13/cobra"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
|
||||
notificationv1 "github.com/fluxcd/notification-controller/api/v1beta2"
|
||||
notificationv1 "github.com/fluxcd/notification-controller/api/v1beta3"
|
||||
)
|
||||
|
||||
var exportAlertCmd = &cobra.Command{
|
||||
|
||||
@@ -20,7 +20,7 @@ import (
|
||||
"github.com/spf13/cobra"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
|
||||
notificationv1 "github.com/fluxcd/notification-controller/api/v1beta2"
|
||||
notificationv1 "github.com/fluxcd/notification-controller/api/v1beta3"
|
||||
)
|
||||
|
||||
var exportAlertProviderCmd = &cobra.Command{
|
||||
|
||||
@@ -26,7 +26,7 @@ import (
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
|
||||
notificationv1 "github.com/fluxcd/notification-controller/api/v1beta2"
|
||||
notificationv1 "github.com/fluxcd/notification-controller/api/v1beta3"
|
||||
)
|
||||
|
||||
var getAlertCmd = &cobra.Command{
|
||||
@@ -92,6 +92,5 @@ func (s alertListAdapter) headers(includeNamespace bool) []string {
|
||||
}
|
||||
|
||||
func (s alertListAdapter) statusSelectorMatches(i int, conditionType, conditionStatus string) bool {
|
||||
item := s.Items[i]
|
||||
return statusMatches(conditionType, conditionStatus, item.Status.Conditions)
|
||||
return false
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ import (
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
|
||||
notificationv1 "github.com/fluxcd/notification-controller/api/v1beta2"
|
||||
notificationv1 "github.com/fluxcd/notification-controller/api/v1beta3"
|
||||
)
|
||||
|
||||
var getAlertProviderCmd = &cobra.Command{
|
||||
@@ -88,6 +88,5 @@ func (s alertProviderListAdapter) headers(includeNamespace bool) []string {
|
||||
}
|
||||
|
||||
func (s alertProviderListAdapter) statusSelectorMatches(i int, conditionType, conditionStatus string) bool {
|
||||
item := s.Items[i]
|
||||
return statusMatches(conditionType, conditionStatus, item.Status.Conditions)
|
||||
return false
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ import (
|
||||
helmv2 "github.com/fluxcd/helm-controller/api/v2beta1"
|
||||
kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1"
|
||||
notificationv1 "github.com/fluxcd/notification-controller/api/v1"
|
||||
notificationv1b2 "github.com/fluxcd/notification-controller/api/v1beta2"
|
||||
notificationv1b3 "github.com/fluxcd/notification-controller/api/v1beta3"
|
||||
)
|
||||
|
||||
var getAllCmd = &cobra.Command{
|
||||
@@ -63,11 +63,11 @@ var getAllCmd = &cobra.Command{
|
||||
},
|
||||
{
|
||||
apiType: alertProviderType,
|
||||
list: alertProviderListAdapter{¬ificationv1b2.ProviderList{}},
|
||||
list: alertProviderListAdapter{¬ificationv1b3.ProviderList{}},
|
||||
},
|
||||
{
|
||||
apiType: alertType,
|
||||
list: &alertListAdapter{¬ificationv1b2.AlertList{}},
|
||||
list: &alertListAdapter{¬ificationv1b3.AlertList{}},
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@@ -34,6 +34,7 @@ import (
|
||||
"github.com/fluxcd/flux2/v2/internal/utils"
|
||||
"github.com/google/go-cmp/cmp"
|
||||
"github.com/mattn/go-shellwords"
|
||||
"k8s.io/apimachinery/pkg/api/errors"
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
|
||||
k8syaml "k8s.io/apimachinery/pkg/util/yaml"
|
||||
"k8s.io/client-go/tools/clientcmd"
|
||||
@@ -112,7 +113,8 @@ func (m *testEnvKubeManager) CreateObjects(clientObjects []*unstructured.Unstruc
|
||||
}
|
||||
obj.SetResourceVersion(createObj.GetResourceVersion())
|
||||
err = m.client.Status().Update(context.Background(), obj)
|
||||
if err != nil {
|
||||
// Updating status of static objects results in not found error.
|
||||
if err != nil && !errors.IsNotFound(err) {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ package main
|
||||
import (
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
notificationv1 "github.com/fluxcd/notification-controller/api/v1beta2"
|
||||
notificationv1 "github.com/fluxcd/notification-controller/api/v1beta3"
|
||||
)
|
||||
|
||||
var resumeAlertCmd = &cobra.Command{
|
||||
@@ -44,7 +44,7 @@ func init() {
|
||||
}
|
||||
|
||||
func (obj alertAdapter) getObservedGeneration() int64 {
|
||||
return obj.Alert.Status.ObservedGeneration
|
||||
return 0
|
||||
}
|
||||
|
||||
func (obj alertAdapter) setUnsuspended() {
|
||||
|
||||
@@ -19,7 +19,7 @@ package main
|
||||
import (
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
notificationv1 "github.com/fluxcd/notification-controller/api/v1beta2"
|
||||
notificationv1 "github.com/fluxcd/notification-controller/api/v1beta3"
|
||||
)
|
||||
|
||||
var resumeAlertProviderCmd = &cobra.Command{
|
||||
@@ -44,7 +44,7 @@ func init() {
|
||||
}
|
||||
|
||||
func (obj alertProviderAdapter) getObservedGeneration() int64 {
|
||||
return obj.Provider.Status.ObservedGeneration
|
||||
return 0
|
||||
}
|
||||
|
||||
func (obj alertProviderAdapter) setUnsuspended() {
|
||||
|
||||
@@ -32,7 +32,7 @@ import (
|
||||
imagev1 "github.com/fluxcd/image-reflector-controller/api/v1beta2"
|
||||
kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1"
|
||||
notificationv1 "github.com/fluxcd/notification-controller/api/v1"
|
||||
notificationv1b2 "github.com/fluxcd/notification-controller/api/v1beta2"
|
||||
notificationv1b3 "github.com/fluxcd/notification-controller/api/v1beta3"
|
||||
sourcev1 "github.com/fluxcd/source-controller/api/v1"
|
||||
sourcev1b2 "github.com/fluxcd/source-controller/api/v1beta2"
|
||||
|
||||
@@ -111,14 +111,14 @@ func runStatsCmd(cmd *cobra.Command, args []string) error {
|
||||
Group: helmv2.GroupVersion.Group,
|
||||
},
|
||||
{
|
||||
Kind: notificationv1b2.AlertKind,
|
||||
Version: notificationv1b2.GroupVersion.Version,
|
||||
Group: notificationv1b2.GroupVersion.Group,
|
||||
Kind: notificationv1b3.AlertKind,
|
||||
Version: notificationv1b3.GroupVersion.Version,
|
||||
Group: notificationv1b3.GroupVersion.Group,
|
||||
},
|
||||
{
|
||||
Kind: notificationv1b2.ProviderKind,
|
||||
Version: notificationv1b2.GroupVersion.Version,
|
||||
Group: notificationv1b2.GroupVersion.Group,
|
||||
Kind: notificationv1b3.ProviderKind,
|
||||
Version: notificationv1b3.GroupVersion.Version,
|
||||
Group: notificationv1b3.GroupVersion.Group,
|
||||
},
|
||||
{
|
||||
Kind: notificationv1.ReceiverKind,
|
||||
|
||||
@@ -19,7 +19,7 @@ package main
|
||||
import (
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
notificationv1 "github.com/fluxcd/notification-controller/api/v1beta2"
|
||||
notificationv1 "github.com/fluxcd/notification-controller/api/v1beta3"
|
||||
)
|
||||
|
||||
var suspendAlertCmd = &cobra.Command{
|
||||
|
||||
@@ -19,7 +19,7 @@ package main
|
||||
import (
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
notificationv1 "github.com/fluxcd/notification-controller/api/v1beta2"
|
||||
notificationv1 "github.com/fluxcd/notification-controller/api/v1beta3"
|
||||
)
|
||||
|
||||
var suspendAlertProviderCmd = &cobra.Command{
|
||||
|
||||
2
cmd/flux/testdata/export/alert.yaml
vendored
2
cmd/flux/testdata/export/alert.yaml
vendored
@@ -1,5 +1,5 @@
|
||||
---
|
||||
apiVersion: notification.toolkit.fluxcd.io/v1beta2
|
||||
apiVersion: notification.toolkit.fluxcd.io/v1beta3
|
||||
kind: Alert
|
||||
metadata:
|
||||
name: flux-system
|
||||
|
||||
4
cmd/flux/testdata/export/objects.yaml
vendored
4
cmd/flux/testdata/export/objects.yaml
vendored
@@ -4,7 +4,7 @@ kind: Namespace
|
||||
metadata:
|
||||
name: {{ .fluxns }}
|
||||
---
|
||||
apiVersion: notification.toolkit.fluxcd.io/v1beta2
|
||||
apiVersion: notification.toolkit.fluxcd.io/v1beta3
|
||||
kind: Provider
|
||||
metadata:
|
||||
name: slack
|
||||
@@ -14,7 +14,7 @@ spec:
|
||||
channel: 'A channel with spacess'
|
||||
address: https://hooks.slack.com/services/mock
|
||||
---
|
||||
apiVersion: notification.toolkit.fluxcd.io/v1beta2
|
||||
apiVersion: notification.toolkit.fluxcd.io/v1beta3
|
||||
kind: Alert
|
||||
metadata:
|
||||
name: flux-system
|
||||
|
||||
2
cmd/flux/testdata/export/provider.yaml
vendored
2
cmd/flux/testdata/export/provider.yaml
vendored
@@ -1,5 +1,5 @@
|
||||
---
|
||||
apiVersion: notification.toolkit.fluxcd.io/v1beta2
|
||||
apiVersion: notification.toolkit.fluxcd.io/v1beta3
|
||||
kind: Provider
|
||||
metadata:
|
||||
name: slack
|
||||
|
||||
Reference in New Issue
Block a user