diff --git a/images/kube-api-proxy/go.mod b/images/kube-api-proxy/go.mod index 7c9317371..4121397d2 100644 --- a/images/kube-api-proxy/go.mod +++ b/images/kube-api-proxy/go.mod @@ -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 diff --git a/images/kube-api-proxy/pkg/rewriter/app.go b/images/kube-api-proxy/pkg/rewriter/app.go index ca11413d8..ead7de303 100644 --- a/images/kube-api-proxy/pkg/rewriter/app.go +++ b/images/kube-api-proxy/pkg/rewriter/app.go @@ -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 ( diff --git a/images/kube-api-proxy/pkg/rewriter/core.go b/images/kube-api-proxy/pkg/rewriter/core.go index e2d847675..7965c7ca9 100644 --- a/images/kube-api-proxy/pkg/rewriter/core.go +++ b/images/kube-api-proxy/pkg/rewriter/core.go @@ -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 ( diff --git a/images/kube-api-proxy/pkg/rewriter/map.go b/images/kube-api-proxy/pkg/rewriter/map.go index 3e8382b7f..482860835 100644 --- a/images/kube-api-proxy/pkg/rewriter/map.go +++ b/images/kube-api-proxy/pkg/rewriter/map.go @@ -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 ( diff --git a/images/kube-api-proxy/pkg/rewriter/policy.go b/images/kube-api-proxy/pkg/rewriter/policy.go index e030a06e4..5d7755553 100644 --- a/images/kube-api-proxy/pkg/rewriter/policy.go +++ b/images/kube-api-proxy/pkg/rewriter/policy.go @@ -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 ( diff --git a/images/kube-api-proxy/pkg/rewriter/rbac.go b/images/kube-api-proxy/pkg/rewriter/rbac.go index fe135bee3..1d928076c 100644 --- a/images/kube-api-proxy/pkg/rewriter/rbac.go +++ b/images/kube-api-proxy/pkg/rewriter/rbac.go @@ -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) { diff --git a/images/kube-api-proxy/pkg/rewriter/resource_test.go b/images/kube-api-proxy/pkg/rewriter/resource_test.go index 09ad94068..05201aff9 100644 --- a/images/kube-api-proxy/pkg/rewriter/resource_test.go +++ b/images/kube-api-proxy/pkg/rewriter/resource_test.go @@ -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) {