Skip to content

Commit

Permalink
removes psp RBAC
Browse files Browse the repository at this point in the history
  • Loading branch information
f41gh7 committed Jul 3, 2024
1 parent cad1737 commit 0eb2fa1
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 42 deletions.
9 changes: 0 additions & 9 deletions internal/controller/operator/factory/k8stools/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,6 @@ func SetKubernetesVersionWithDefaults(vi *version.Info, defaultMinor, defaultMaj
return nil
}

// IsPSPSupported check if PodSecurityPolicy is supported by kubernetes API server
// https://kubernetes.io/docs/reference/using-api/deprecation-guide/#psp-v125
func IsPSPSupported() bool {
if ServerMajorVersion == 1 && ServerMinorVersion <= 24 {
return true
}
return false
}

// IsPDBV1APISupported check if new v1 API is supported by kubernetes API server
// deprecated since 1.21
// https://kubernetes.io/docs/reference/using-api/deprecation-guide/#poddisruptionbudget-v125
Expand Down
32 changes: 0 additions & 32 deletions internal/controller/operator/factory/k8stools/version_test.go
Original file line number Diff line number Diff line change
@@ -1,33 +1 @@
package k8stools

import "testing"

func TestIsPSPSupported(t *testing.T) {
tests := []struct {
name string
want bool
major uint64
minor uint64
}{
{
name: "yes",
major: 1,
minor: 22,
want: true,
},
{
name: "no",
major: 1,
minor: 25,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
ServerMinorVersion = tt.minor
ServerMajorVersion = tt.major
if got := IsPSPSupported(); got != tt.want {
t.Errorf("IsPSPSupported() = %v, want %v", got, tt.want)
}
})
}
}
1 change: 0 additions & 1 deletion internal/controller/operator/vmagent_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ type VMAgentReconciler struct {
// +kubebuilder:rbac:groups="",resources=namespaces,verbs=get;watch;list
// +kubebuilder:rbac:groups="rbac.authorization.k8s.io",resources=clusterrolebindings,verbs=get;create,update;list
// +kubebuilder:rbac:groups="rbac.authorization.k8s.io",resources=clusterroles,verbs=get;create,update;list
// +kubebuilder:rbac:groups="policy",resources=podsecuritypolicies,verbs=get;create,update;list
// +kubebuilder:rbac:groups="",resources=serviceaccounts,verbs=get;create,update;list
func (r *VMAgentReconciler) Reconcile(ctx context.Context, req ctrl.Request) (result ctrl.Result, err error) {
reqLogger := r.Log.WithValues("vmagent", req.NamespacedName)
Expand Down

0 comments on commit 0eb2fa1

Please sign in to comment.