1
0
Fork 0
mirror of https://github.com/arangodb/kube-arangodb.git synced 2024-12-14 11:57:37 +00:00

[Bugfix] Allow missing monitoring CRD (#985)

This commit is contained in:
Adam Janikowski 2022-05-13 17:30:14 +03:00 committed by GitHub
parent 5f283cd8ed
commit 42292581f6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 9 additions and 6 deletions

View file

@ -3,6 +3,7 @@
## [master](https://github.com/arangodb/kube-arangodb/tree/master) (N/A)
- (Bugfix) Fix arangosync members state inspection
- (Feature) (ACS) Improve Reconciliation Loop
- (Bugfix) Allow missing Monitoring CRD
## [1.2.12](https://github.com/arangodb/kube-arangodb/tree/1.2.12) (2022-05-10)
- (Feature) Add CoreV1 Endpoints Inspector

View file

@ -65,7 +65,6 @@ import (
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil"
"github.com/arangodb/kube-arangodb/pkg/util/kclient"
"github.com/arangodb/kube-arangodb/pkg/util/trigger"
apierrors "k8s.io/apimachinery/pkg/api/errors"
)
// Config holds configuration settings for a Deployment
@ -593,7 +592,7 @@ func (d *Deployment) lookForServiceMonitorCRD() {
var err error
if d.GetScope().IsNamespaced() {
_, err = d.currentState.ServiceMonitor().V1()
if apierrors.IsForbidden(err) {
if k8sutil.IsForbiddenOrNotFound(err) {
return
}
} else {

View file

@ -37,7 +37,6 @@ import (
"github.com/rs/zerolog/log"
core "k8s.io/api/core/v1"
policy "k8s.io/api/policy/v1beta1"
apierrors "k8s.io/apimachinery/pkg/api/errors"
meta "k8s.io/apimachinery/pkg/apis/meta/v1"
)
@ -240,7 +239,7 @@ func ensurePvcsAnnotations(patch PatchFunc, cachedStatus inspectorInterface.Insp
func ensureServiceMonitorsAnnotations(patch PatchFunc, cachedStatus inspectorInterface.Inspector, kind, name, namespace string, spec api.DeploymentSpec) error {
i, err := cachedStatus.ServiceMonitor().V1()
if err != nil {
if apierrors.IsForbidden(err) {
if k8sutil.IsForbiddenOrNotFound(err) {
return nil
}
return err

View file

@ -26,11 +26,11 @@ import (
"github.com/arangodb/kube-arangodb/pkg/util/globals"
"github.com/arangodb/kube-arangodb/pkg/util/errors"
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil"
inspectorInterface "github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector"
monitoring "github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1"
core "k8s.io/api/core/v1"
policy "k8s.io/api/policy/v1beta1"
apierrors "k8s.io/apimachinery/pkg/api/errors"
meta "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types"
)
@ -152,7 +152,7 @@ func (r *Resources) EnsureServiceMonitorsLabels(ctx context.Context, cachedStatu
changed := false
i, err := cachedStatus.ServiceMonitor().V1()
if err != nil {
if apierrors.IsForbidden(err) {
if k8sutil.IsForbiddenOrNotFound(err) {
return nil
}
return err

View file

@ -48,3 +48,7 @@ func IsNotFound(err error) bool {
func IsInvalid(err error) bool {
return apierrors.IsInvalid(errors.Cause(err))
}
func IsForbiddenOrNotFound(err error) bool {
return apierrors.IsNotFound(err) || apierrors.IsForbidden(err)
}