diff --git a/.github/workflows/build_and_test.yaml b/.github/workflows/build_and_test.yaml index df574694a1..1cad2db02d 100644 --- a/.github/workflows/build_and_test.yaml +++ b/.github/workflows/build_and_test.yaml @@ -28,6 +28,13 @@ jobs: - uses: ./tools/github-actions/setup-deps - run: make -k gen-check + license-check: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: ./tools/github-actions/setup-deps + - run: make -k licensecheck + build-and-test: runs-on: ubuntu-latest needs: [lint, gen-check] diff --git a/.golangci.yml b/.golangci.yml new file mode 100644 index 0000000000..973f62f91c --- /dev/null +++ b/.golangci.yml @@ -0,0 +1,46 @@ +run: + deadline: 10m + +linters: + enable: + - bodyclose + - gofmt + - goimports + - revive + - gosec + - misspell + - scopelint + - unconvert + - unparam + - goheader + - gocritic + +linters-settings: + gofmt: + simplify: true + unparam: + check-exported: false + goheader: + # Note that because the format is different (this needs no comment markers), + # updating this text means also updating /tools/boilerplate.txt so that + # `make generate` will update the generated files correctly. + template: |- + Copyright Envoy Gateway Authors + SPDX-License-Identifier: Apache-2.0 + The full text of the Apache license is available in the LICENSE file at + the root of the repo. + +issues: + exclude-rules: + - path: zz_generated + linters: + - goimports + - linters: + - staticcheck + text: "SA1019:" + - path: test/e2e + linters: + - bodyclose + # Show the complete output + max-issues-per-linter: 0 + max-same-issues: 0 diff --git a/api/config/v1alpha1/envoygateway_types.go b/api/config/v1alpha1/envoygateway_types.go index f9f742b24b..08c24edafd 100644 --- a/api/config/v1alpha1/envoygateway_types.go +++ b/api/config/v1alpha1/envoygateway_types.go @@ -1,3 +1,8 @@ +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. + package v1alpha1 import ( diff --git a/api/config/v1alpha1/envoyproxy_types.go b/api/config/v1alpha1/envoyproxy_types.go index edaaa2aa30..2899b7c072 100644 --- a/api/config/v1alpha1/envoyproxy_types.go +++ b/api/config/v1alpha1/envoyproxy_types.go @@ -1,3 +1,8 @@ +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. + package v1alpha1 import ( diff --git a/api/config/v1alpha1/groupversion_info.go b/api/config/v1alpha1/groupversion_info.go index 992e6bd316..9a4070f623 100644 --- a/api/config/v1alpha1/groupversion_info.go +++ b/api/config/v1alpha1/groupversion_info.go @@ -1,3 +1,8 @@ +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. + // Package v1alpha1 contains API Schema definitions for the config v1alpha1 API group. // //+kubebuilder:object:generate=true diff --git a/api/config/v1alpha1/helpers.go b/api/config/v1alpha1/helpers.go index d3578fed74..6b1fa4c551 100644 --- a/api/config/v1alpha1/helpers.go +++ b/api/config/v1alpha1/helpers.go @@ -1,3 +1,8 @@ +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. + package v1alpha1 import ( diff --git a/api/config/v1alpha1/zz_generated.deepcopy.go b/api/config/v1alpha1/zz_generated.deepcopy.go index bc0ebd8c29..96aaf74522 100644 --- a/api/config/v1alpha1/zz_generated.deepcopy.go +++ b/api/config/v1alpha1/zz_generated.deepcopy.go @@ -1,6 +1,11 @@ //go:build !ignore_autogenerated // +build !ignore_autogenerated +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. + // Code generated by controller-gen. DO NOT EDIT. package v1alpha1 diff --git a/cmd/envoy-gateway/main.go b/cmd/envoy-gateway/main.go index 63a30e0885..f817151187 100644 --- a/cmd/envoy-gateway/main.go +++ b/cmd/envoy-gateway/main.go @@ -1,16 +1,7 @@ -// Copyright The Envoy Project Authors - -// 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. +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. package main diff --git a/internal/cmd/certgen.go b/internal/cmd/certgen.go index 70a425a12c..0db554d631 100644 --- a/internal/cmd/certgen.go +++ b/internal/cmd/certgen.go @@ -1,3 +1,8 @@ +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. + package cmd import ( diff --git a/internal/cmd/certgen_test.go b/internal/cmd/certgen_test.go index 009e4590f0..fedd07d223 100644 --- a/internal/cmd/certgen_test.go +++ b/internal/cmd/certgen_test.go @@ -1,3 +1,8 @@ +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. + package cmd import ( diff --git a/internal/cmd/root.go b/internal/cmd/root.go index b1a5e9820a..ae4c96eb8e 100644 --- a/internal/cmd/root.go +++ b/internal/cmd/root.go @@ -1,16 +1,7 @@ -// Copyright The Envoy Project Authors - -// 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. +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. package cmd diff --git a/internal/cmd/root_test.go b/internal/cmd/root_test.go index 27606c9895..da1c159227 100644 --- a/internal/cmd/root_test.go +++ b/internal/cmd/root_test.go @@ -1,16 +1,7 @@ -// Copyright The Envoy Project Authors - -// 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. +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. package cmd diff --git a/internal/cmd/server.go b/internal/cmd/server.go index 90e2c28cbd..87aaf21fa0 100644 --- a/internal/cmd/server.go +++ b/internal/cmd/server.go @@ -1,3 +1,8 @@ +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. + package cmd import ( diff --git a/internal/cmd/server_test.go b/internal/cmd/server_test.go index b9b5498e46..36b723968a 100644 --- a/internal/cmd/server_test.go +++ b/internal/cmd/server_test.go @@ -1,16 +1,7 @@ -// Copyright The Envoy Project Authors - -// 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. +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. package cmd diff --git a/internal/cmd/versions.go b/internal/cmd/versions.go index 2439be8836..b95cbade35 100644 --- a/internal/cmd/versions.go +++ b/internal/cmd/versions.go @@ -1,3 +1,8 @@ +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. + package cmd import ( diff --git a/internal/cmd/xdstest.go b/internal/cmd/xdstest.go index 9361c671ea..86ac81014b 100644 --- a/internal/cmd/xdstest.go +++ b/internal/cmd/xdstest.go @@ -1,3 +1,8 @@ +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. + package cmd import ( diff --git a/internal/crypto/certgen.go b/internal/crypto/certgen.go index 406a485552..cde67ab97f 100644 --- a/internal/crypto/certgen.go +++ b/internal/crypto/certgen.go @@ -1,3 +1,8 @@ +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. + package crypto import ( diff --git a/internal/crypto/certgen_test.go b/internal/crypto/certgen_test.go index 01dea266d3..9adbcd752f 100644 --- a/internal/crypto/certgen_test.go +++ b/internal/crypto/certgen_test.go @@ -1,3 +1,8 @@ +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. + package crypto import ( diff --git a/internal/envoygateway/config/config.go b/internal/envoygateway/config/config.go index c8f8562bec..162dcd1c05 100644 --- a/internal/envoygateway/config/config.go +++ b/internal/envoygateway/config/config.go @@ -1,3 +1,8 @@ +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. + package config import ( diff --git a/internal/envoygateway/config/decoder.go b/internal/envoygateway/config/decoder.go index 2ade5f6fb0..cb9f0e742d 100644 --- a/internal/envoygateway/config/decoder.go +++ b/internal/envoygateway/config/decoder.go @@ -1,3 +1,8 @@ +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. + package config import ( diff --git a/internal/envoygateway/config/decoder_test.go b/internal/envoygateway/config/decoder_test.go index 99a1c481d9..33b30385ad 100644 --- a/internal/envoygateway/config/decoder_test.go +++ b/internal/envoygateway/config/decoder_test.go @@ -1,3 +1,8 @@ +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. + package config import ( diff --git a/internal/envoygateway/scheme.go b/internal/envoygateway/scheme.go index bc7d577553..085d69eea8 100644 --- a/internal/envoygateway/scheme.go +++ b/internal/envoygateway/scheme.go @@ -1,3 +1,8 @@ +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. + package envoygateway import ( diff --git a/internal/gatewayapi/contexts.go b/internal/gatewayapi/contexts.go index cb5d56a227..c6c00ea590 100644 --- a/internal/gatewayapi/contexts.go +++ b/internal/gatewayapi/contexts.go @@ -1,3 +1,8 @@ +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. + package gatewayapi import ( diff --git a/internal/gatewayapi/contexts_test.go b/internal/gatewayapi/contexts_test.go index 5b84fdf379..b584df2629 100644 --- a/internal/gatewayapi/contexts_test.go +++ b/internal/gatewayapi/contexts_test.go @@ -1,3 +1,8 @@ +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. + package gatewayapi import ( diff --git a/internal/gatewayapi/helpers.go b/internal/gatewayapi/helpers.go index 70464b3e88..e621c101be 100644 --- a/internal/gatewayapi/helpers.go +++ b/internal/gatewayapi/helpers.go @@ -1,3 +1,8 @@ +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. + package gatewayapi import ( diff --git a/internal/gatewayapi/helpers_v1alpha2.go b/internal/gatewayapi/helpers_v1alpha2.go index c4b2153f2a..1dc934a27f 100644 --- a/internal/gatewayapi/helpers_v1alpha2.go +++ b/internal/gatewayapi/helpers_v1alpha2.go @@ -1,4 +1,13 @@ -// Portions of this code are based on code from Contour. +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. + +// This file contains code derived from Contour, +// https://github.com/projectcontour/contour +// and is provided here subject to the following: +// Copyright Project Contour Authors +// SPDX-License-Identifier: Apache-2.0 package gatewayapi diff --git a/internal/gatewayapi/runner/runner.go b/internal/gatewayapi/runner/runner.go index 804faf0b79..091b92bf6b 100644 --- a/internal/gatewayapi/runner/runner.go +++ b/internal/gatewayapi/runner/runner.go @@ -1,3 +1,8 @@ +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. + package runner import ( diff --git a/internal/gatewayapi/runner/runner_test.go b/internal/gatewayapi/runner/runner_test.go index 77cdfffa61..c6a84eb5fa 100644 --- a/internal/gatewayapi/runner/runner_test.go +++ b/internal/gatewayapi/runner/runner_test.go @@ -1,3 +1,8 @@ +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. + package runner import ( diff --git a/internal/gatewayapi/sort.go b/internal/gatewayapi/sort.go index ecf91bff90..6a7d1cc2a2 100644 --- a/internal/gatewayapi/sort.go +++ b/internal/gatewayapi/sort.go @@ -1,3 +1,8 @@ +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. + package gatewayapi import ( diff --git a/internal/gatewayapi/translator.go b/internal/gatewayapi/translator.go index 182d9c10ee..95cc8f2330 100644 --- a/internal/gatewayapi/translator.go +++ b/internal/gatewayapi/translator.go @@ -1,3 +1,8 @@ +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. + package gatewayapi import ( diff --git a/internal/gatewayapi/translator_test.go b/internal/gatewayapi/translator_test.go index b62664e1e8..a343623537 100644 --- a/internal/gatewayapi/translator_test.go +++ b/internal/gatewayapi/translator_test.go @@ -1,3 +1,8 @@ +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. + package gatewayapi import ( diff --git a/internal/infrastructure/kubernetes/configmap.go b/internal/infrastructure/kubernetes/configmap.go index ce24122cc5..4e8dcfec97 100644 --- a/internal/infrastructure/kubernetes/configmap.go +++ b/internal/infrastructure/kubernetes/configmap.go @@ -1,3 +1,8 @@ +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. + package kubernetes import ( diff --git a/internal/infrastructure/kubernetes/configmap_test.go b/internal/infrastructure/kubernetes/configmap_test.go index a240412cfd..3c7e466912 100644 --- a/internal/infrastructure/kubernetes/configmap_test.go +++ b/internal/infrastructure/kubernetes/configmap_test.go @@ -1,3 +1,8 @@ +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. + package kubernetes import ( diff --git a/internal/infrastructure/kubernetes/deployment.go b/internal/infrastructure/kubernetes/deployment.go index d3d19d3253..f031a41a6d 100644 --- a/internal/infrastructure/kubernetes/deployment.go +++ b/internal/infrastructure/kubernetes/deployment.go @@ -1,3 +1,8 @@ +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. + package kubernetes import ( diff --git a/internal/infrastructure/kubernetes/deployment_test.go b/internal/infrastructure/kubernetes/deployment_test.go index 4fd4a7e172..764b3ce9b9 100644 --- a/internal/infrastructure/kubernetes/deployment_test.go +++ b/internal/infrastructure/kubernetes/deployment_test.go @@ -1,3 +1,8 @@ +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. + package kubernetes import ( diff --git a/internal/infrastructure/kubernetes/infra.go b/internal/infrastructure/kubernetes/infra.go index 39e6eb4074..b52094118b 100644 --- a/internal/infrastructure/kubernetes/infra.go +++ b/internal/infrastructure/kubernetes/infra.go @@ -1,3 +1,8 @@ +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. + package kubernetes import ( diff --git a/internal/infrastructure/kubernetes/infra_test.go b/internal/infrastructure/kubernetes/infra_test.go index a13374468b..26f037a816 100644 --- a/internal/infrastructure/kubernetes/infra_test.go +++ b/internal/infrastructure/kubernetes/infra_test.go @@ -1,3 +1,8 @@ +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. + package kubernetes import ( diff --git a/internal/infrastructure/kubernetes/labels.go b/internal/infrastructure/kubernetes/labels.go index 3fe9edc246..263bb9d97d 100644 --- a/internal/infrastructure/kubernetes/labels.go +++ b/internal/infrastructure/kubernetes/labels.go @@ -1,3 +1,8 @@ +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. + package kubernetes import ( diff --git a/internal/infrastructure/kubernetes/labels_test.go b/internal/infrastructure/kubernetes/labels_test.go index 1ff33f8d23..621efaa872 100644 --- a/internal/infrastructure/kubernetes/labels_test.go +++ b/internal/infrastructure/kubernetes/labels_test.go @@ -1,3 +1,8 @@ +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. + package kubernetes import ( diff --git a/internal/infrastructure/kubernetes/service.go b/internal/infrastructure/kubernetes/service.go index fd93f81c08..8441aa978a 100644 --- a/internal/infrastructure/kubernetes/service.go +++ b/internal/infrastructure/kubernetes/service.go @@ -1,3 +1,8 @@ +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. + package kubernetes import ( diff --git a/internal/infrastructure/kubernetes/service_test.go b/internal/infrastructure/kubernetes/service_test.go index 679ea8af44..f1ea3d1a2c 100644 --- a/internal/infrastructure/kubernetes/service_test.go +++ b/internal/infrastructure/kubernetes/service_test.go @@ -1,3 +1,8 @@ +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. + package kubernetes import ( diff --git a/internal/infrastructure/kubernetes/serviceaccount.go b/internal/infrastructure/kubernetes/serviceaccount.go index 3a40f61822..97110c1d2c 100644 --- a/internal/infrastructure/kubernetes/serviceaccount.go +++ b/internal/infrastructure/kubernetes/serviceaccount.go @@ -1,3 +1,8 @@ +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. + package kubernetes import ( diff --git a/internal/infrastructure/kubernetes/serviceaccount_test.go b/internal/infrastructure/kubernetes/serviceaccount_test.go index d6299d0f12..c02719843a 100644 --- a/internal/infrastructure/kubernetes/serviceaccount_test.go +++ b/internal/infrastructure/kubernetes/serviceaccount_test.go @@ -1,3 +1,8 @@ +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. + package kubernetes import ( diff --git a/internal/infrastructure/manager.go b/internal/infrastructure/manager.go index 8ed44db7a3..a263dc1566 100644 --- a/internal/infrastructure/manager.go +++ b/internal/infrastructure/manager.go @@ -1,3 +1,8 @@ +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. + package infrastructure import ( diff --git a/internal/infrastructure/runner/runner.go b/internal/infrastructure/runner/runner.go index ce5413b7d8..cb9ec0d551 100644 --- a/internal/infrastructure/runner/runner.go +++ b/internal/infrastructure/runner/runner.go @@ -1,3 +1,8 @@ +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. + package runner import ( diff --git a/internal/ir/infra.go b/internal/ir/infra.go index 99d91f103a..28021eb50b 100644 --- a/internal/ir/infra.go +++ b/internal/ir/infra.go @@ -1,3 +1,8 @@ +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. + package ir import ( diff --git a/internal/ir/infra_test.go b/internal/ir/infra_test.go index 3a2f7f28b0..72524ea37a 100644 --- a/internal/ir/infra_test.go +++ b/internal/ir/infra_test.go @@ -1,3 +1,8 @@ +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. + package ir import ( diff --git a/internal/ir/xds.go b/internal/ir/xds.go index 3e98e648f5..def2bfd518 100644 --- a/internal/ir/xds.go +++ b/internal/ir/xds.go @@ -1,3 +1,8 @@ +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. + package ir import ( diff --git a/internal/ir/xds_test.go b/internal/ir/xds_test.go index 8a6710e264..32dd356cd1 100644 --- a/internal/ir/xds_test.go +++ b/internal/ir/xds_test.go @@ -1,3 +1,8 @@ +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. + package ir import ( diff --git a/internal/ir/zz_generated.deepcopy.go b/internal/ir/zz_generated.deepcopy.go index 16c3477e5b..0f26e03b50 100644 --- a/internal/ir/zz_generated.deepcopy.go +++ b/internal/ir/zz_generated.deepcopy.go @@ -1,6 +1,11 @@ //go:build !ignore_autogenerated // +build !ignore_autogenerated +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. + // Code generated by controller-gen. DO NOT EDIT. package ir diff --git a/internal/log/log.go b/internal/log/log.go index 54371fdb61..cd51d3a80e 100644 --- a/internal/log/log.go +++ b/internal/log/log.go @@ -1,3 +1,8 @@ +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. + package log import ( diff --git a/internal/message/types.go b/internal/message/types.go index 3386119247..e986d57626 100644 --- a/internal/message/types.go +++ b/internal/message/types.go @@ -1,3 +1,8 @@ +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. + package message import ( diff --git a/internal/message/types_test.go b/internal/message/types_test.go index 4b2faa409b..9525efac84 100644 --- a/internal/message/types_test.go +++ b/internal/message/types_test.go @@ -1,3 +1,8 @@ +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. + package message import ( diff --git a/internal/message/watchutil.go b/internal/message/watchutil.go index 40f22cb23f..4fccb9059d 100644 --- a/internal/message/watchutil.go +++ b/internal/message/watchutil.go @@ -1,3 +1,8 @@ +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. + package message import ( diff --git a/internal/message/watchutil_test.go b/internal/message/watchutil_test.go index abc0ccb5d2..873c8b2d53 100644 --- a/internal/message/watchutil_test.go +++ b/internal/message/watchutil_test.go @@ -1,3 +1,8 @@ +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. + package message_test import ( diff --git a/internal/provider/kubernetes/gateway.go b/internal/provider/kubernetes/gateway.go index 3a5a668681..f7f958da0a 100644 --- a/internal/provider/kubernetes/gateway.go +++ b/internal/provider/kubernetes/gateway.go @@ -1,5 +1,14 @@ -// Portions of this code are based on code from Contour, available at: -// https://github.com/projectcontour/contour/blob/main/internal/controller/gateway.go +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. + +// This file contains code derived from Contour, +// https://github.com/projectcontour/contour +// from the source file +// https://github.com/projectcontour/contour/blob/main/internal/controller/gateway.go// and is provided here subject to the following: +// Copyright Project Contour Authors +// SPDX-License-Identifier: Apache-2.0 package kubernetes diff --git a/internal/provider/kubernetes/gateway_test.go b/internal/provider/kubernetes/gateway_test.go index 8f4248e8cf..7d7e1fe253 100644 --- a/internal/provider/kubernetes/gateway_test.go +++ b/internal/provider/kubernetes/gateway_test.go @@ -1,3 +1,8 @@ +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. + package kubernetes import ( diff --git a/internal/provider/kubernetes/gatewayclass.go b/internal/provider/kubernetes/gatewayclass.go index 2f4d0f3189..8a360202bb 100644 --- a/internal/provider/kubernetes/gatewayclass.go +++ b/internal/provider/kubernetes/gatewayclass.go @@ -1,4 +1,9 @@ -// Portions of this code are based on code from Contour, available at: +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. + +// TODO Portions of this code are based on code from Contour, available at: // https://github.com/projectcontour/contour/blob/main/internal/controller/gatewayclass.go package kubernetes diff --git a/internal/provider/kubernetes/gatewayclass_test.go b/internal/provider/kubernetes/gatewayclass_test.go index a2e8497762..4200a2379e 100644 --- a/internal/provider/kubernetes/gatewayclass_test.go +++ b/internal/provider/kubernetes/gatewayclass_test.go @@ -1,3 +1,8 @@ +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. + package kubernetes import ( diff --git a/internal/provider/kubernetes/helpers.go b/internal/provider/kubernetes/helpers.go index 8ca309cecf..7c94208b20 100644 --- a/internal/provider/kubernetes/helpers.go +++ b/internal/provider/kubernetes/helpers.go @@ -1,3 +1,8 @@ +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. + package kubernetes import ( diff --git a/internal/provider/kubernetes/httproute.go b/internal/provider/kubernetes/httproute.go index 2c126a9e6d..e99ef92cbf 100644 --- a/internal/provider/kubernetes/httproute.go +++ b/internal/provider/kubernetes/httproute.go @@ -1,5 +1,15 @@ -// Portions of this code are based on code from Contour, available at: +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. + +// This file contains code derived from Contour, +// https://github.com/projectcontour/contour +// from the source file // https://github.com/projectcontour/contour/blob/main/internal/controller/httproute.go +// and is provided here subject to the following: +// Copyright Project Contour Authors +// SPDX-License-Identifier: Apache-2.0 package kubernetes diff --git a/internal/provider/kubernetes/httproute_test.go b/internal/provider/kubernetes/httproute_test.go index c504d31215..605213984d 100644 --- a/internal/provider/kubernetes/httproute_test.go +++ b/internal/provider/kubernetes/httproute_test.go @@ -1,3 +1,8 @@ +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. + package kubernetes import ( diff --git a/internal/provider/kubernetes/kubernetes.go b/internal/provider/kubernetes/kubernetes.go index cc5670a90b..0a6903e3d3 100644 --- a/internal/provider/kubernetes/kubernetes.go +++ b/internal/provider/kubernetes/kubernetes.go @@ -1,3 +1,8 @@ +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. + package kubernetes import ( diff --git a/internal/provider/kubernetes/kubernetes_test.go b/internal/provider/kubernetes/kubernetes_test.go index de375f061c..13202eed5e 100644 --- a/internal/provider/kubernetes/kubernetes_test.go +++ b/internal/provider/kubernetes/kubernetes_test.go @@ -1,6 +1,13 @@ //go:build integration // +build integration +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. + + + package kubernetes import ( diff --git a/internal/provider/kubernetes/rbac.go b/internal/provider/kubernetes/rbac.go index 4015f40550..8222daec3e 100644 --- a/internal/provider/kubernetes/rbac.go +++ b/internal/provider/kubernetes/rbac.go @@ -1,3 +1,8 @@ +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. + package kubernetes // +kubebuilder:rbac:groups="gateway.networking.k8s.io",resources=gatewayclasses;gateways;httproutes;tlsroutes;referencepolicies;referencegrants,verbs=get;list;watch;update diff --git a/internal/provider/kubernetes/secrets.go b/internal/provider/kubernetes/secrets.go index 3027ecb0dc..b3a0ae251d 100644 --- a/internal/provider/kubernetes/secrets.go +++ b/internal/provider/kubernetes/secrets.go @@ -1,3 +1,8 @@ +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. + package kubernetes import ( diff --git a/internal/provider/kubernetes/store.go b/internal/provider/kubernetes/store.go index 8d9be70e5c..3ecc514fda 100644 --- a/internal/provider/kubernetes/store.go +++ b/internal/provider/kubernetes/store.go @@ -1,3 +1,8 @@ +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. + package kubernetes import ( diff --git a/internal/provider/kubernetes/store_test.go b/internal/provider/kubernetes/store_test.go index 08bb2eb4c6..66c3c4bfdf 100644 --- a/internal/provider/kubernetes/store_test.go +++ b/internal/provider/kubernetes/store_test.go @@ -1,3 +1,8 @@ +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. + package kubernetes import ( diff --git a/internal/provider/kubernetes/tlsroute.go b/internal/provider/kubernetes/tlsroute.go index b9e43bb478..9cd3db39e9 100644 --- a/internal/provider/kubernetes/tlsroute.go +++ b/internal/provider/kubernetes/tlsroute.go @@ -1,5 +1,15 @@ -// Portions of this code are based on code from Contour, available at: +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. + +// This file contains code derived from Contour, +// https://github.com/projectcontour/contour +// from the source file // https://github.com/projectcontour/contour/blob/main/internal/controller/tlsroute.go +// and is provided here subject to the following: +// Copyright Project Contour Authors +// SPDX-License-Identifier: Apache-2.0 package kubernetes diff --git a/internal/provider/runner/runner.go b/internal/provider/runner/runner.go index b8678eb0ed..251acc50e9 100644 --- a/internal/provider/runner/runner.go +++ b/internal/provider/runner/runner.go @@ -1,3 +1,8 @@ +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. + package runner import ( diff --git a/internal/provider/runner/runner_test.go b/internal/provider/runner/runner_test.go index 44bf29c2a6..170df8182e 100644 --- a/internal/provider/runner/runner_test.go +++ b/internal/provider/runner/runner_test.go @@ -1,3 +1,8 @@ +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. + package runner import ( diff --git a/internal/provider/utils/utils.go b/internal/provider/utils/utils.go index f736356a5a..353e3ae08d 100644 --- a/internal/provider/utils/utils.go +++ b/internal/provider/utils/utils.go @@ -1,3 +1,8 @@ +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. + package utils import ( diff --git a/internal/status/conditions.go b/internal/status/conditions.go index 03dcffcc4a..f83873fe6c 100644 --- a/internal/status/conditions.go +++ b/internal/status/conditions.go @@ -1,5 +1,15 @@ -// Portions of this code are based on code from Contour, available at: +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. + +// This file contains code derived from Contour, +// https://github.com/projectcontour/contour +// from the source file // https://github.com/projectcontour/contour/blob/main/internal/status/gatewayclassconditions.go +// and is provided here subject to the following: +// Copyright Project Contour Authors +// SPDX-License-Identifier: Apache-2.0 package status diff --git a/internal/status/conditions_test.go b/internal/status/conditions_test.go index 6cc8a52cf9..ba2f2cd21f 100644 --- a/internal/status/conditions_test.go +++ b/internal/status/conditions_test.go @@ -1,5 +1,15 @@ -// Portions of this code are based on code from Contour, available at: +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. + +// This file contains code derived from Contour, +// https://github.com/projectcontour/contour +// from the source file // https://github.com/projectcontour/contour/blob/main/internal/status/gatewayclassconditions_test.go +// and is provided here subject to the following: +// Copyright Project Contour Authors +// SPDX-License-Identifier: Apache-2.0 package status diff --git a/internal/status/gateway.go b/internal/status/gateway.go index feb8ba7318..d802d09e7b 100644 --- a/internal/status/gateway.go +++ b/internal/status/gateway.go @@ -1,3 +1,8 @@ +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. + package status import ( diff --git a/internal/status/gatewayclass.go b/internal/status/gatewayclass.go index 41581b2290..2853c258a5 100644 --- a/internal/status/gatewayclass.go +++ b/internal/status/gatewayclass.go @@ -1,5 +1,15 @@ -// Portions of this code are based on code from Contour, available at: +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. + +// This file contains code derived from Contour, +// https://github.com/projectcontour/contour +// from the source file // https://github.com/projectcontour/contour/blob/main/internal/status/gatewayclass.go +// and is provided here subject to the following: +// Copyright Project Contour Authors +// SPDX-License-Identifier: Apache-2.0 package status diff --git a/internal/status/status.go b/internal/status/status.go index 373a19b394..58dca4b576 100644 --- a/internal/status/status.go +++ b/internal/status/status.go @@ -1,5 +1,15 @@ -// Portions of this code are based on code from Contour, available at: +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. + +// This file contains code derived from Contour, +// https://github.com/projectcontour/contour +// from the source file // https://github.com/projectcontour/contour/blob/main/internal/k8s/status.go +// and is provided here subject to the following: +// Copyright Project Contour Authors +// SPDX-License-Identifier: Apache-2.0 package status diff --git a/internal/utils/env/env.go b/internal/utils/env/env.go index 3a91d4b158..da55be76b8 100644 --- a/internal/utils/env/env.go +++ b/internal/utils/env/env.go @@ -1,3 +1,8 @@ +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. + package env import ( diff --git a/internal/utils/env/env_test.go b/internal/utils/env/env_test.go index 118d2e8108..357b69ef4d 100644 --- a/internal/utils/env/env_test.go +++ b/internal/utils/env/env_test.go @@ -1,3 +1,8 @@ +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. + package env import ( diff --git a/internal/utils/slice/slice.go b/internal/utils/slice/slice.go index ad88dfd32d..cc75f9f0e5 100644 --- a/internal/utils/slice/slice.go +++ b/internal/utils/slice/slice.go @@ -1,3 +1,8 @@ +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. + package slice // ContainsString checks if a given slice of strings contains the provided string. diff --git a/internal/utils/slice/slice_test.go b/internal/utils/slice/slice_test.go index 2ac94bab8c..8b76632e97 100644 --- a/internal/utils/slice/slice_test.go +++ b/internal/utils/slice/slice_test.go @@ -1,3 +1,8 @@ +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. + package slice import ( diff --git a/internal/xds/cache/logrwrapper.go b/internal/xds/cache/logrwrapper.go index 5c1f073284..a21324e4ba 100644 --- a/internal/xds/cache/logrwrapper.go +++ b/internal/xds/cache/logrwrapper.go @@ -1,3 +1,8 @@ +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. + package cache import ( diff --git a/internal/xds/cache/snapshotcache.go b/internal/xds/cache/snapshotcache.go index 82b41e29c9..255bbc591e 100644 --- a/internal/xds/cache/snapshotcache.go +++ b/internal/xds/cache/snapshotcache.go @@ -1,5 +1,15 @@ -// Portions of this code are based on code from Contour, available at: +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. + +// This file contains code derived from Contour, +// https://github.com/projectcontour/contour +// from the source file // https://github.com/projectcontour/contour/blob/main/internal/xds/v3/snapshotter.go +// and is provided here subject to the following: +// Copyright Project Contour Authors +// SPDX-License-Identifier: Apache-2.0 package cache diff --git a/internal/xds/server/runner/runner.go b/internal/xds/server/runner/runner.go index 38f359b653..42b65bd44f 100644 --- a/internal/xds/server/runner/runner.go +++ b/internal/xds/server/runner/runner.go @@ -1,3 +1,8 @@ +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. + package runner import ( diff --git a/internal/xds/server/runner/runner_test.go b/internal/xds/server/runner/runner_test.go index bcb62c2442..3d0a86c58d 100644 --- a/internal/xds/server/runner/runner_test.go +++ b/internal/xds/server/runner/runner_test.go @@ -1,3 +1,8 @@ +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. + package runner import ( diff --git a/internal/xds/translator/cluster.go b/internal/xds/translator/cluster.go index e63d283eb9..4f0c479f98 100644 --- a/internal/xds/translator/cluster.go +++ b/internal/xds/translator/cluster.go @@ -1,3 +1,8 @@ +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. + package translator import ( diff --git a/internal/xds/translator/listener.go b/internal/xds/translator/listener.go index 09fe0cd4d3..e811f22db1 100644 --- a/internal/xds/translator/listener.go +++ b/internal/xds/translator/listener.go @@ -1,3 +1,8 @@ +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. + package translator import ( diff --git a/internal/xds/translator/route.go b/internal/xds/translator/route.go index dc5acd70e4..ac4178e7b4 100644 --- a/internal/xds/translator/route.go +++ b/internal/xds/translator/route.go @@ -1,3 +1,8 @@ +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. + package translator import ( diff --git a/internal/xds/translator/runner/runner.go b/internal/xds/translator/runner/runner.go index 515436b708..49ee70254e 100644 --- a/internal/xds/translator/runner/runner.go +++ b/internal/xds/translator/runner/runner.go @@ -1,3 +1,8 @@ +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. + package runner import ( diff --git a/internal/xds/translator/runner/runner_test.go b/internal/xds/translator/runner/runner_test.go index b6649b1cf7..b7e7d8be03 100644 --- a/internal/xds/translator/runner/runner_test.go +++ b/internal/xds/translator/runner/runner_test.go @@ -1,3 +1,8 @@ +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. + package runner import ( diff --git a/internal/xds/translator/translator.go b/internal/xds/translator/translator.go index 630d002e32..7d6f45629b 100644 --- a/internal/xds/translator/translator.go +++ b/internal/xds/translator/translator.go @@ -1,3 +1,8 @@ +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. + package translator import ( diff --git a/internal/xds/translator/translator_test.go b/internal/xds/translator/translator_test.go index c968badfa8..ea61d19377 100644 --- a/internal/xds/translator/translator_test.go +++ b/internal/xds/translator/translator_test.go @@ -1,3 +1,8 @@ +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. + package translator import ( diff --git a/internal/xds/types/resourceversiontable.go b/internal/xds/types/resourceversiontable.go index 9aed4c728d..ebf323ab8f 100644 --- a/internal/xds/types/resourceversiontable.go +++ b/internal/xds/types/resourceversiontable.go @@ -1,3 +1,8 @@ +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. + package types import ( diff --git a/internal/xds/types/resourceversiontable_test.go b/internal/xds/types/resourceversiontable_test.go index e78402f526..2cb17be407 100644 --- a/internal/xds/types/resourceversiontable_test.go +++ b/internal/xds/types/resourceversiontable_test.go @@ -1,3 +1,8 @@ +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. + package types import ( diff --git a/test/conformance/conformance_test.go b/test/conformance/conformance_test.go index b3b748ca43..8c9730904d 100644 --- a/test/conformance/conformance_test.go +++ b/test/conformance/conformance_test.go @@ -1,6 +1,13 @@ //go:build conformance // +build conformance +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. + + + package conformance import ( diff --git a/tools/boilerplate/boilerplate.generatego.txt b/tools/boilerplate/boilerplate.generatego.txt new file mode 100644 index 0000000000..3f9e2deb71 --- /dev/null +++ b/tools/boilerplate/boilerplate.generatego.txt @@ -0,0 +1,5 @@ +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. + diff --git a/tools/boilerplate/boilerplate.go.txt b/tools/boilerplate/boilerplate.go.txt new file mode 100644 index 0000000000..3f9e2deb71 --- /dev/null +++ b/tools/boilerplate/boilerplate.go.txt @@ -0,0 +1,5 @@ +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. + diff --git a/tools/boilerplate/boilerplate.py b/tools/boilerplate/boilerplate.py new file mode 100755 index 0000000000..4741440808 --- /dev/null +++ b/tools/boilerplate/boilerplate.py @@ -0,0 +1,257 @@ +#!/usr/bin/env python + +# Copyright 2015 The Kubernetes Authors. +# +# 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. + +# This file is copied from https://github.com/kubernetes/kubernetes/blob/04c2b1fbdc1289c9a72eda87cf7072346e60d241/hack/boilerplate/boilerplate.py + +from __future__ import print_function + +import argparse +import datetime +import difflib +import glob +import os +import re +import sys + +parser = argparse.ArgumentParser() +parser.add_argument( + "filenames", + help="list of files to check, all files if unspecified", + nargs='*') + +rootdir = os.path.dirname(__file__) + "/../../" +rootdir = os.path.abspath(rootdir) +parser.add_argument( + "--rootdir", default=rootdir, help="root directory to examine") + +default_boilerplate_dir = os.path.join(rootdir, "tools/boilerplate") +parser.add_argument( + "--boilerplate-dir", default=default_boilerplate_dir) + +parser.add_argument( + "-v", "--verbose", + help="give verbose output regarding why a file does not pass", + action="store_true") + +args = parser.parse_args() + +verbose_out = sys.stderr if args.verbose else open("/dev/null", "w") + + +def get_refs(): + refs = {} + + for path in glob.glob(os.path.join(args.boilerplate_dir, "boilerplate.*.txt")): + extension = os.path.basename(path).split(".")[1] + + ref_file = open(path, 'r') + ref = ref_file.read().splitlines() + ref_file.close() + refs[extension] = ref + + return refs + + +def is_generated_file(filename, data, regexs): + for d in skipped_ungenerated_files: + if d in filename: + return False + + p = regexs["generated"] + return p.search(data) + + +def file_passes(filename, refs, regexs): + try: + f = open(filename, 'r') + except Exception as exc: + print("Unable to open %s: %s" % (filename, exc), file=verbose_out) + return False + + data = f.read() + f.close() + + # determine if the file is automatically generated + generated = is_generated_file(filename, data, regexs) + + basename = os.path.basename(filename) + extension = file_extension(filename) + if generated: + if extension == "go": + extension = "generatego" + elif extension == "bzl": + extension = "generatebzl" + + if extension != "": + ref = refs[extension] + else: + ref = refs[basename] + + # remove extra content from the top of files + if extension == "go" or extension == "generatego": + p = regexs["go_build_constraints"] + (data, found) = p.subn("", data, 1) + elif extension in ["sh", "py"]: + p = regexs["shebang"] + (data, found) = p.subn("", data, 1) + + data = data.splitlines() + + # if our test file is smaller than the reference it surely fails! + if len(ref) > len(data): + print('File %s smaller than reference (%d < %d)' % + (filename, len(data), len(ref)), + file=verbose_out) + return False + + # trim our file to the same number of lines as the reference file + data = data[:len(ref)] + + p = regexs["year"] + for d in data: + if p.search(d): + if generated: + print('File %s has the YEAR field, but it should not be in generated file' % + filename, file=verbose_out) + else: + print('File %s has the YEAR field, but missing the year of date' % + filename, file=verbose_out) + return False + + if not generated: + # Replace all occurrences of the regex "2014|2015|2016|2017|2018" with "YEAR" + p = regexs["date"] + for i, d in enumerate(data): + (data[i], found) = p.subn('YEAR', d) + if found != 0: + break + + # if we don't match the reference at this point, fail + if ref != data: + print("Header in %s does not match reference, diff:" % + filename, file=verbose_out) + if args.verbose: + print(file=verbose_out) + for line in difflib.unified_diff(ref, data, 'reference', filename, lineterm=''): + print(line, file=verbose_out) + print(file=verbose_out) + return False + + return True + + +def file_extension(filename): + return os.path.splitext(filename)[1].split(".")[-1].lower() + + +skipped_dirs = [ + 'cluster/env.sh', + '.git', + '_gopath', + 'hack/boilerplate/test', + '_output', + 'staging/src/k8s.io/kubectl/pkg/generated/bindata.go', + 'test/e2e/generated/bindata.go', + 'third_party', + 'vendor', + '.venv', +] + +# list all the files contain 'DO NOT EDIT', but are not generated +skipped_ungenerated_files = [ + 'hack/lib/swagger.sh', 'tools/boilerplate/boilerplate.py'] + + +def normalize_files(files): + newfiles = [] + for pathname in files: + if any(x in pathname for x in skipped_dirs): + continue + newfiles.append(pathname) + for i, pathname in enumerate(newfiles): + if not os.path.isabs(pathname): + newfiles[i] = os.path.join(args.rootdir, pathname) + return newfiles + + +def get_files(extensions): + files = [] + if len(args.filenames) > 0: + files = args.filenames + else: + for root, dirs, walkfiles in os.walk(args.rootdir): + # don't visit certain dirs. This is just a performance improvement + # as we would prune these later in normalize_files(). But doing it + # cuts down the amount of filesystem walking we do and cuts down + # the size of the file list + for d in skipped_dirs: + if d in dirs: + dirs.remove(d) + + for name in walkfiles: + pathname = os.path.join(root, name) + files.append(pathname) + + files = normalize_files(files) + outfiles = [] + for pathname in files: + basename = os.path.basename(pathname) + extension = file_extension(pathname) + if extension in extensions or basename in extensions: + outfiles.append(pathname) + return outfiles + + +def get_dates(): + years = datetime.datetime.now().year + return '(%s)' % '|'.join((str(year) for year in range(2014, years+1))) + + +def get_regexs(): + regexs = {} + # Search for "YEAR" which exists in the boilerplate, but shouldn't in the real thing + regexs["year"] = re.compile('YEAR') + # get_dates return 2014, 2015, 2016, 2017, or 2018 until the current year as a regex like: "(2014|2015|2016|2017|2018)"; + # company holder names can be anything + regexs["date"] = re.compile(get_dates()) + # strip the following build constraints/tags: + # //go:build + # // +build \n\n + regexs["go_build_constraints"] = re.compile( + r"^(//(go:build| \+build).*\n)+\n", re.MULTILINE) + # strip #!.* from scripts + regexs["shebang"] = re.compile(r"^(#!.*\n)\n*", re.MULTILINE) + # Search for generated files + regexs["generated"] = re.compile('DO NOT EDIT') + return regexs + + +def main(): + regexs = get_regexs() + refs = get_refs() + filenames = get_files(refs.keys()) + + for filename in filenames: + if not file_passes(filename, refs, regexs): + print(filename, file=sys.stdout) + + print("Verified %d file headers match boilerplate" % (len(filenames),), file=sys.stderr) + + return 0 + + +if __name__ == "__main__": + sys.exit(main()) diff --git a/tools/boilerplate/verify-boilerplate.sh b/tools/boilerplate/verify-boilerplate.sh new file mode 100755 index 0000000000..ab0c7d798f --- /dev/null +++ b/tools/boilerplate/verify-boilerplate.sh @@ -0,0 +1,38 @@ +#!/bin/bash + +# Copyright 2014 The Kubernetes Authors. +# +# 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. + +set -o errexit +set -o nounset +set -o pipefail + +SCRIPT_ROOT=$(dirname "${BASH_SOURCE}")/../.. + +boilerDir="${SCRIPT_ROOT}/tools/boilerplate" +boiler="${boilerDir}/boilerplate.py" + +files_need_boilerplate=($(${boiler} "$@" -v)) + +echo $SCRIPT_ROOT +echo $boilerDir + +# Run boilerplate check +if [[ ${#files_need_boilerplate[@]} -gt 0 ]]; then + for file in "${files_need_boilerplate[@]}"; do + echo "Boilerplate header is wrong for: ${file}" + done + + exit 1 +fi diff --git a/tools/make/kube.mk b/tools/make/kube.mk index 574366594c..c78929bf09 100644 --- a/tools/make/kube.mk +++ b/tools/make/kube.mk @@ -19,6 +19,8 @@ KUBE_INFRA_DIR := $(ROOT_DIR)/internal/infrastructure/kubernetes/config endif ##@ Kubernetes Development +YEAR := $(shell date +%Y) +CONTROLLERGEN_OBJECT_FLAGS := object:headerFile="$(ROOT_DIR)/tools/boilerplate/boilerplate.generatego.txt",year=$(YEAR) .PHONY: manifests manifests: $(tools/controller-gen) ## Generate WebhookConfiguration, ClusterRole and CustomResourceDefinition objects. @@ -26,7 +28,8 @@ manifests: $(tools/controller-gen) ## Generate WebhookConfiguration, ClusterRole .PHONY: generate generate: $(tools/controller-gen) ## Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations. - $(tools/controller-gen) object paths="./..." +# Note that the paths can't just be "./..." with the header file, or the tool will panic on run. Sorry. + $(tools/controller-gen) $(CONTROLLERGEN_OBJECT_FLAGS) paths="{$(ROOT_DIR)/api/config/...,$(ROOT_DIR)/internal/ir/...}" .PHONY: kube-test kube-test: manifests generate $(tools/setup-envtest) ## Run Kubernetes provider tests. diff --git a/tools/make/lint.mk b/tools/make/lint.mk index 9aca38fe94..465a2181a9 100644 --- a/tools/make/lint.mk +++ b/tools/make/lint.mk @@ -72,3 +72,7 @@ gen-check: generate manifests echo "\nERROR: Some files need to be updated, please run 'make generate' and 'make manifests' to include any changed files to your PR\n"; \ git diff --exit-code; \ fi + +.PHONY: licensecheck +licensecheck: ## Check license headers are present. + tools/boilerplate/verify-boilerplate.sh diff --git a/tools/src/controller-gen/pin.go b/tools/src/controller-gen/pin.go index 0eb2187c6e..5140b3786b 100644 --- a/tools/src/controller-gen/pin.go +++ b/tools/src/controller-gen/pin.go @@ -1,3 +1,8 @@ +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. + //go:build pin // +build pin diff --git a/tools/src/golangci-lint/pin.go b/tools/src/golangci-lint/pin.go index d250d0323e..1500aa4c7b 100644 --- a/tools/src/golangci-lint/pin.go +++ b/tools/src/golangci-lint/pin.go @@ -1,3 +1,8 @@ +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. + //go:build pin // +build pin diff --git a/tools/src/goversion/pin.go b/tools/src/goversion/pin.go index 662fbb00bd..83faf7ad75 100644 --- a/tools/src/goversion/pin.go +++ b/tools/src/goversion/pin.go @@ -1,3 +1,8 @@ +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. + //go:build pin // +build pin diff --git a/tools/src/kind/pin.go b/tools/src/kind/pin.go index 20964c929c..5180e16838 100644 --- a/tools/src/kind/pin.go +++ b/tools/src/kind/pin.go @@ -1,3 +1,8 @@ +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. + //go:build pin // +build pin diff --git a/tools/src/kustomize/pin.go b/tools/src/kustomize/pin.go index 71820da506..f871f2f9b9 100644 --- a/tools/src/kustomize/pin.go +++ b/tools/src/kustomize/pin.go @@ -1,6 +1,11 @@ +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. + //go:build pin // +build pin package ignore -import "sigs.k8s.io/kustomize/kustomize/v3" +import "sigs.k8s.io/kustomize/kustomize/v3" \ No newline at end of file diff --git a/tools/src/setup-envtest/pin.go b/tools/src/setup-envtest/pin.go index c1aef52f06..69d708e7ea 100644 --- a/tools/src/setup-envtest/pin.go +++ b/tools/src/setup-envtest/pin.go @@ -1,3 +1,8 @@ +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. + //go:build pin // +build pin