Skip to content

Commit

Permalink
gracefully handling RBAC failures for GatewayAPI
Browse files Browse the repository at this point in the history
  • Loading branch information
networkop committed Jan 14, 2022
1 parent 5793b49 commit 64c4087
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions kubernetes.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
core "k8s.io/api/core/v1"
networking "k8s.io/api/networking/v1"
"k8s.io/apimachinery/pkg/api/errors"
apierrors "k8s.io/apimachinery/pkg/api/errors"
meta "k8s.io/apimachinery/pkg/api/meta"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
Expand Down Expand Up @@ -163,6 +164,10 @@ func existGatewayCRDs(ctx context.Context, c *gatewayClient.Clientset) bool {
log.Infof("GatewayAPI CRDs are not found. Not syncing GatewayAPI resources.")
return false
}
if apierrors.IsForbidden(err) {
log.Infof("access to `gateway.networking.k8s.io` is forbidden, please check RBAC. Not syncing GatewayAPI resources.")
return false
}
if err == nil {
return true
}
Expand Down

0 comments on commit 64c4087

Please sign in to comment.