Skip to content

Commit

Permalink
++ fixes after rebase
Browse files Browse the repository at this point in the history
Signed-off-by: Ivan Mikheykin <[email protected]>
  • Loading branch information
diafour committed Jun 17, 2024
1 parent 9adc6e6 commit 6bd3bae
Show file tree
Hide file tree
Showing 7 changed files with 94 additions and 18 deletions.
1 change: 0 additions & 1 deletion images/kube-api-proxy/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/emicklei/go-restful/v3 v3.9.0 // indirect
github.com/evanphx/json-patch/v5 v5.6.0 // indirect
github.com/fsnotify/fsnotify v1.7.0 // indirect
github.com/go-logr/logr v1.2.4 // indirect
github.com/go-openapi/jsonpointer v0.19.6 // indirect
github.com/go-openapi/jsonreference v0.20.2 // indirect
Expand Down
16 changes: 16 additions & 0 deletions images/kube-api-proxy/pkg/rewriter/app.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*
Copyright 2024 Flant JSC
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package rewriter

const (
Expand Down
16 changes: 16 additions & 0 deletions images/kube-api-proxy/pkg/rewriter/core.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*
Copyright 2024 Flant JSC
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package rewriter

const (
Expand Down
16 changes: 16 additions & 0 deletions images/kube-api-proxy/pkg/rewriter/map.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*
Copyright 2024 Flant JSC
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package rewriter

import (
Expand Down
16 changes: 16 additions & 0 deletions images/kube-api-proxy/pkg/rewriter/policy.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*
Copyright 2024 Flant JSC
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package rewriter

const (
Expand Down
28 changes: 12 additions & 16 deletions images/kube-api-proxy/pkg/rewriter/rbac.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,22 +24,18 @@ import (
)

const (
ClusterRoleKind = "ClusterRole"
ClusterRoleListKind = "ClusterRoleList"
RoleKind = "Role"
RoleListKind = "RoleList"
RoleBindingKind = "RoleBinding"
RoleBindingListKind = "RoleBindingList"
PodDisruptionBudgetKind = "PodDisruptionBudget"
PodDisruptionBudgetListKind = "PodDisruptionBudgetList"
ControllerRevisionKind = "ControllerRevision"
ControllerRevisionListKind = "ControllerRevisionList"
DeploymentKind = "Deployment"
DeploymentListKind = "DeploymentList"
ClusterRoleBindingKind = "ClusterRoleBinding"
ClusterRoleBindingListKind = "ClusterRoleBindingList"
APIServiceKind = "APIService"
APIServiceListKind = "APIServiceList"
ClusterRoleKind = "ClusterRole"
ClusterRoleListKind = "ClusterRoleList"
RoleKind = "Role"
RoleListKind = "RoleList"
RoleBindingKind = "RoleBinding"
RoleBindingListKind = "RoleBindingList"
ControllerRevisionKind = "ControllerRevision"
ControllerRevisionListKind = "ControllerRevisionList"
ClusterRoleBindingKind = "ClusterRoleBinding"
ClusterRoleBindingListKind = "ClusterRoleBindingList"
APIServiceKind = "APIService"
APIServiceListKind = "APIServiceList"
)

func RewriteClusterRoleOrList(rules *RewriteRules, obj []byte, action Action) ([]byte, error) {
Expand Down
19 changes: 18 additions & 1 deletion images/kube-api-proxy/pkg/rewriter/resource_test.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,29 @@
/*
Copyright 2024 Flant JSC
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package rewriter

import (
"encoding/json"
"testing"

"github.com/stretchr/testify/require"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"sigs.k8s.io/controller-runtime/pkg/client"
"testing"
)

func TestRewriteMetadata(t *testing.T) {
Expand Down

0 comments on commit 6bd3bae

Please sign in to comment.