diff --git a/Makefile b/Makefile index 37399af56..cec777434 100644 --- a/Makefile +++ b/Makefile @@ -44,7 +44,7 @@ download-kubeconfigs: read SHOOT; \ echo "enter cluster provider(gcp|aws|azure|vsphere|openstack|alicloud|metal|equinix-metal)"; \ read PROVIDER; \ - ./hack/local_setup.sh --SEED $$SEED --SHOOT $$SHOOT --PROJECT $$PROJECT --PROVIDER $$PROVIDER + ./hack/local_setup.sh --seed $$SEED --shoot $$SHOOT --project $$PROJECT --provider $$PROVIDER .PHONY: local-mcm-up local-mcm-up: download-kubeconfigs @@ -163,3 +163,7 @@ CONTROLLER_GEN=$(GOBIN)/controller-gen else CONTROLLER_GEN=$(shell which controller-gen) endif + +.PHONY: add-license-headers +add-license-headers: $(GO_ADD_LICENSE) + @./hack/add_license_headers.sh diff --git a/hack/add_license_headers.sh b/hack/add_license_headers.sh new file mode 100755 index 000000000..1aefbb10d --- /dev/null +++ b/hack/add_license_headers.sh @@ -0,0 +1,33 @@ +#!/usr/bin/env bash +# Copyright 2023 SAP SE or an SAP affiliate company +# +# 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 -e + +echo "> Adding Apache License header to all go files where it is not present" + +# Uses the tool https://github.com/google/addlicense +YEAR="$(date +%Y)" +addlicense \ + -c "SAP SE or an SAP affiliate company" \ + -y "${YEAR}" \ + -l apache \ + -ignore ".idea/**" \ + -ignore ".vscode/**" \ + -ignore "vendor/**" \ + -ignore "**/*.md" \ + -ignore "**/*.yaml" \ + -ignore "**/Dockerfile" \ + . \ No newline at end of file diff --git a/hack/admin-kube-config-request-template.json b/hack/admin-kube-config-request-template.json new file mode 100644 index 000000000..58d70a74c --- /dev/null +++ b/hack/admin-kube-config-request-template.json @@ -0,0 +1,7 @@ +{ + "apiVersion": "authentication.gardener.cloud/v1alpha1", + "kind": "AdminKubeconfigRequest", + "spec": { + "expirationSeconds": ${expiry_seconds} + } +} \ No newline at end of file diff --git a/hack/api-reference/generate-spec-doc.sh b/hack/api-reference/generate-spec-doc.sh index 166f5c074..3940ae4c1 100755 --- a/hack/api-reference/generate-spec-doc.sh +++ b/hack/api-reference/generate-spec-doc.sh @@ -1,3 +1,17 @@ +# Copyright 2023 SAP SE or an SAP affiliate company +# +# 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. + cd ./hack/api-reference ./gen-crd-api-reference-docs -config "providerspec-config.json" -api-dir "../../pkg/apis/machine/v1alpha1" -out-file="../../docs/documents/apis.md" sed 's/?id=//g' ../../docs/documents/apis.md > ../../docs/documents/apis-1.md diff --git a/hack/local_restore.sh b/hack/local_restore.sh new file mode 100755 index 000000000..6aa1af8d7 --- /dev/null +++ b/hack/local_restore.sh @@ -0,0 +1,93 @@ +#!/usr/bin/env bash +# Copyright 2023 SAP SE or an SAP affiliate company +# +# 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 restores MCM deployment and removes the annotation dependency-watchdog.gardener.cloud/ignore-scaling +# This script should be called once you are done using local_setup.sh +############################################################################################################## + +declare SHOOT PROJECT +declare LANDSCAPE_NAME="dev" + +function create_usage() { + usage=$(printf '%s\n' " + Usage: $(basename $0) [Options] + Options: + -t | --shoot (Required) Name of the Gardener Shoot Cluster + -p | --project (Required) Name of the Gardener Project + -l | --landscape (Optional) Name of the landscape. Defaults to dev + ") + echo "${usage}" +} + +function parse_flags() { + while test $# -gt 0; do + case "$1" in + --shoot | -t) + shift + SHOOT="$1" + ;; + --project | -p) + shift + PROJECT="$1" + ;; + --landscape | -l) + shift + LANDSCAPE_NAME="$1" + ;; + --help | -h) + shift + echo "${USAGE}" + exit 0 + ;; + esac + shift + done +} + +function validate_args() { + if [[ -z "${SHOOT}" ]]; then + echo -e "Shoot has not been passed. Please provide Shoot either by specifying --shoot or -t argument" + exit 1 + fi + if [[ -z "${PROJECT}" ]]; then + echo -e "Project name has not been passed. Please provide Project name either by specifying --project or -p argument" + exit 1 + fi +} + +function restore_mcm_deployment() { + local virtual_garden_cluster="sap-landscape-${LANDSCAPE_NAME}" + gardenctl target --garden "${virtual_garden_cluster}" --project "${PROJECT}" --shoot "${SHOOT}" --control-plane + eval "$(gardenctl kubectl-env zsh)" + echo "removing annotation dependency-watchdog.gardener.cloud/ignore-scaling from mcm deployment..." + kubectl annotate --overwrite=true deployment/machine-controller-manager dependency-watchdog.gardener.cloud/ignore-scaling- + echo "scaling up mcm deployment to 1..." + kubectl scale deployment/machine-controller-manager --replicas=1 +} + +function main() { + parse_flags "$@" + validate_args + restore_mcm_deployment +} + +USAGE=$(create_usage) +main "$@" \ No newline at end of file diff --git a/hack/local_setup.sh b/hack/local_setup.sh index a7615faca..0bb0962ad 100755 --- a/hack/local_setup.sh +++ b/hack/local_setup.sh @@ -1,150 +1,224 @@ -# /* -# Copyright (c) YEAR SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file - +#!/usr/bin/env bash +# Copyright 2023 SAP SE or an SAP affiliate company +# # 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. -# */ - - -# THE SCRIPT SHOULD BE RUN WHILE IN THE `machine-controller-manager/hack` FOLDER & IT ASSUMES THAT IN THE PARENT DIRECTORY OF MCM THE MCM PROVIDER IS ALSO PRESENT -# THE SCRIPT ALSO ASSUMES THAT THERE THE `machine-controller-manager-provider-/dev/kubeconfigs` FOLDER EXISTS. - -#HOW TO CALL -################################################################################################ - -# ./local_setup.sh --PROJECT --SEED --SHOOT --PROVIDER - -################################################################################################ -#!/usr/bin/env bash set -o errexit set -o nounset set -o pipefail -declare SEED -declare SHOOT -declare PROJECT -declare PROVIDER -declare CURRENT_DIR -declare PROJECT_ROOT -declare KUBECONFIG_PATH -declare PROVIDER_PATH -declare PROVIDER_KUBECONFIG_PATH - -while [ $# -gt 0 ]; do - -if [[ $1 == *"--"* ]]; then - v="${1/--/}" - declare $v="$2" -fi - -shift -done - -main() { - setPaths - echo "Targeting gardener to get the kubeconfig of ${SHOOT} cluster control plane" - setControlKubeconfig - echo "Targeting seed cluster to get the kubeconfig of ${SHOOT} cluster" - setTargetKubeconfig - echo "Placing kubeconfigs at /dev/kubeconfigs/kubeconfig_.yaml" - copyFilesToProvider - # All the kubeconfigs are at place - echo "Annotating deployment/machine-controller-manager with dependency-watchdog.gardener.cloud/ignore-scaling=true" - addAnnotation - echo "Scaling down deployment/machine-controller-manager to 0" - scaleDownMCM - echo "Updating and exporting variables for starting the local MCM instance" - updateMCMMakefile - exportVariables - updateProviderMakefile +############################################################################################################## +# Script sets up local development environment enabling you to start MCM process locally. +# It does the following: +# 1. Downloads short-lived control and target cluster kube-configs +# 2. Ensures that kube-configs are copied to both mcm and provider-mcm project directory +# 3. Scales down MCM to 0 +# 4. Places annotation dependency-watchdog.gardener.cloud/ignore-scaling on MCM deployment, thus preventing +# DWD from scaling it back up. +# 5. Updates Makefile for mcm and provider-mcm projects and exports variables used by the makefile. +############################################################################################################## + +declare SEED SHOOT PROJECT PROVIDER # these are mandatory cli flags to be provided by the user +# these are optional cli flags +declare KUBECONFIG_PATH PROVIDER_MCM_PROJECT_DIR PROVIDER_KUBECONFIG_PATH +declare LANDSCAPE_NAME="dev" +declare KUBECONFIG_EXPIRY_SECONDS="3600" +declare VIRTUAL_GARDEN_CLUSTER + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd)" +PROJECT_DIR="$(cd "$(dirname "${SCRIPT_DIR}")" &>/dev/null && pwd)" + +function create_usage() { + usage=$(printf '%s\n' " + Usage: $(basename $0) [Options] + Options: + -d | --seed (Required) Name of the Gardener Seed Cluster + -t | --shoot (Required) Name of the Gardener Shoot Cluster + -p | --project (Required) Name of the Gardener Project + -i | --provider (Required) Infrastructure provider name. Supported providers (gcp|aws|azure|vsphere|openstack|alicloud|metal|equinix-metal) + -l | --landscape (Optional) Name of the landscape. Defaults to dev + -k | --kubeconfig-path (Optional) Target path to store the control and target KubeConfigs. Default: /dev/kube-configs + -m | --mcm-provider-project-path (Optional) MCM Provider project directory. If not provided then it assumes that both mcm and mcm-provider projects are under the same parent directory + -e | --kubeconfig-expiry-seconds (Optional) Common expiry durations in seconds for control and target KubeConfigs. Default: 3600 seconds + ") + echo "${usage}" } -setPaths() { - CURRENT_DIR=$(dirname $0) - PROJECT_ROOT="${CURRENT_DIR}"/.. - KUBECONFIG_PATH="${PROJECT_ROOT}"/dev/kubeconfigs - PROVIDER_PATH="${PROJECT_ROOT}"/../machine-controller-manager-provider-${PROVIDER} - PROVIDER_KUBECONFIG_PATH="${PROVIDER_PATH}"/dev/kubeconfigs +function parse_flags() { + while test $# -gt 0; do + case "$1" in + --seed | -d) + shift + SEED="$1" + ;; + --shoot | -t) + shift + SHOOT="$1" + ;; + --project | -p) + shift + PROJECT="$1" + ;; + --provider | -i) + shift + PROVIDER="$1" + ;; + --kubeconfig-path | -k) + shift + KUBECONFIG_PATH="$1" + ;; + --mcm-provider-project-path | -m) + shift + PROVIDER_MCM_PROJECT_DIR="$1" + ;; + --kubeconfig-expiry-seconds | -e) + shift + KUBECONFIG_EXPIRY_SECONDS="$1" + ;; + --landscape | -l) + shift + LANDSCAPE_NAME="$1" + ;; + --help | -h) + shift + echo "${USAGE}" + exit 0 + ;; + esac + shift + done } -setControlKubeconfig() { - gardenctl target --garden sap-landscape-dev --project garden - - eval $(gardenctl kubectl-env bash) - - echo "$(kubectl get secret/"${SEED}".kubeconfig --template={{.data.kubeconfig}} | base64 -d)" > "${KUBECONFIG_PATH}"/kubeconfig_control.yaml +function validate_args() { + if [[ -z "${SEED}" ]]; then + echo -e "Seed has not been passed. Please provide Seed either by specifying --seed or -d argument" + exit 1 + fi + if [[ -z "${SHOOT}" ]]; then + echo -e "Shoot has not been passed. Please provide Shoot either by specifying --shoot or -t argument" + exit 1 + fi + if [[ -z "${PROJECT}" ]]; then + echo -e "Project name has not been passed. Please provide Project name either by specifying --project or -p argument" + exit 1 + fi + if [[ -z "${PROVIDER}" ]]; then + echo -e "Infrastructure provider name has not been passed. Please provide infrastructure provider name either by specifying --provider or -i argument" + exit 1 + fi } -setTargetKubeconfig() { - - #setting up the target config - - gardenctl target --garden sap-landscape-dev --project "${PROJECT}" --shoot "${SHOOT}" --control-plane - - eval $(gardenctl kubectl-env bash) - - secret=$(kubectl get secrets | awk '{ print $1 }' |grep user-kubeconfig-) - - echo "$(kubectl get secret/"${secret}" -n shoot--"${PROJECT}"--"${SHOOT}" --template={{.data.kubeconfig}} | base64 -d)" > "${KUBECONFIG_PATH}"/kubeconfig_target.yaml +function initialize_variables() { + if [[ -z "${KUBECONFIG_PATH}" ]]; then + KUBECONFIG_PATH="${PROJECT_DIR}/dev/kube-configs" + fi + if [[ -z "${PROVIDER_MCM_PROJECT_DIR}" ]]; then + PROVIDER_MCM_PROJECT_DIR="${PROJECT_DIR}/../machine-controller-manager-provider-${PROVIDER}" + fi + PROVIDER_KUBECONFIG_PATH="${PROVIDER_MCM_PROJECT_DIR}/dev/kube-configs" + VIRTUAL_GARDEN_CLUSTER="sap-landscape-${LANDSCAPE_NAME}" } -copyFilesToProvider() { - # Copy both the kubeconfigs to dev folder of provider - - cp "${KUBECONFIG_PATH}"/kubeconfig_target.yaml "${PROVIDER_KUBECONFIG_PATH}"/kubeconfig_target.yaml - cp "${KUBECONFIG_PATH}"/kubeconfig_control.yaml "${PROVIDER_KUBECONFIG_PATH}"/kubeconfig_control.yaml +function prepare_paths() { + echo "Creating directory ${KUBECONFIG_PATH} if it does not exist..." + mkdir -p "${KUBECONFIG_PATH}" + echo "Creating directory ${PROVIDER_KUBECONFIG_PATH} if it does not exist..." + mkdir -p "${PROVIDER_KUBECONFIG_PATH}" } -addAnnotation() { - # Adding annotation - - kubectl annotate --overwrite=true deployment/machine-controller-manager dependency-watchdog.gardener.cloud/ignore-scaling=true - - # Another way of adding annotation - # kubectl patch deployment/machine-controller-manager -p '{"metadata":{"annotations":{"dependency-watchdog.gardener.cloud/ignore-scaling":true}} }' - - # Removing the annotation, needs to be called after done with local setup +function download_kubeconfigs() { + readonly garden_namespace="garden" + local project_namespace="${garden_namespace}-${PROJECT}" + + kubeconfig_request_path=$(create_kubeconfig_request_yaml) + + echo "Targeting Virtual Garden Cluster ${VIRTUAL_GARDEN_CLUSTER}..." + gardenctl target --garden "${VIRTUAL_GARDEN_CLUSTER}" + eval "$(gardenctl kubectl-env zsh)" + + echo "Downloading kubeconfig for control cluster to ${KUBECONFIG_PATH}..." + kubectl create \ + -f "${kubeconfig_request_path}" \ + --raw "/apis/core.gardener.cloud/v1beta1/namespaces/${garden_namespace}/shoots/${SEED}/adminkubeconfig" | + jq -r '.status.kubeconfig' | + base64 -d >"${KUBECONFIG_PATH}/kubeconfig_control.yaml" + + echo "Downloading kubeconfig for target cluster to ${KUBECONFIG_PATH}..." + kubectl create \ + -f "${kubeconfig_request_path}" \ + --raw "/apis/core.gardener.cloud/v1beta1/namespaces/${project_namespace}/shoots/${SHOOT}/adminkubeconfig" | + jq -r '.status.kubeconfig' | + base64 -d >"${KUBECONFIG_PATH}/kubeconfig_target.yaml" +} - # kubectl annotate --overwrite=true deployment/machine-controller-manager dependency-watchdog.gardener.cloud/ignore-scaling- +function create_kubeconfig_request_yaml() { + local expiry_seconds template_path target_request_path + expiry_seconds=${KUBECONFIG_EXPIRY_SECONDS} + template_path="${SCRIPT_DIR}"/admin-kube-config-request-template.json + target_request_path="${SCRIPT_DIR}"/admin-kube-config-request.json + export expiry_seconds + envsubst <"${template_path}" >"${target_request_path}" + unset expiry_seconds + echo "${target_request_path}" +} +function copy_kubeconfigs_to_provider_mcm() { + for kc in "${KUBECONFIG_PATH}"/*.yaml; do + cp -v "${kc}" "${PROVIDER_KUBECONFIG_PATH}" + done } -scaleDownMCM() { - # Scale down the MCM - kubectl scale deployment/machine-controller-manager --replicas=0 +function scale_down_mcm() { + gardenctl target --garden "${VIRTUAL_GARDEN_CLUSTER}" --project "${PROJECT}" --shoot "${SHOOT}" --control-plane + eval "$(gardenctl kubectl-env zsh)" - # If delete is required, when Scale Down operation is not working due to some reason - # kubectl delete deployment/machine-controller-manager + echo "annotating deployment/machine-controller-manager with dependency-watchdog.gardener.cloud/ignore-scaling=true..." + kubectl annotate --overwrite=true deployment/machine-controller-manager dependency-watchdog.gardener.cloud/ignore-scaling=true + # NOTE: One must remove the annotation after local setup is no longer needed. Use the below command to remove the annotation on machine-controller-manager deployment resource: + # kubectl annotate --overwrite=true deployment/machine-controller-manager dependency-watchdog.gardener.cloud/ignore-scaling- + echo "scaling down deployment/machine-controller-manager to 0..." + kubectl scale deployment/machine-controller-manager --replicas=0 } -updateMCMMakefile() { - # Point the makefiles to the correct kubeconfigs to use for local run - sed -i -e "s/\(CONTROL_NAMESPACE *:=\).*/\1 shoot--"${PROJECT}"--"${SHOOT}"/1" "${PROJECT_ROOT}"/makefile - sed -i -e "s/\(CONTROL_KUBECONFIG *:=\).*/\1 dev\/kubeconfigs\/kubeconfig_control.yaml/1" "${PROJECT_ROOT}"/makefile - sed -i -e "s/\(TARGET_KUBECONFIG *:=\).*/\1 dev\/kubeconfigs\/kubeconfig_target.yaml/1" "${PROJECT_ROOT}"/makefile +function update_makefile() { + if [[ $# -ne 1 ]]; then + echo -e "${FUNCNAME[0]} expects one argument - target path of makefile" + fi + local target_makefile="$1"/Makefile + echo "updating makefile ${target_makefile}, replacing CONTROL_NAMESPACE, CONTROL_KUBECONFIG and TARGET_KUBECONFIG default values with paths to created admin kubeconfigs..." + sed -i -e "s/\(CONTROL_NAMESPACE *:=\).*/\1 shoot--${PROJECT}--${SHOOT}/1" "${target_makefile}" + sed -i -e "s/\(CONTROL_KUBECONFIG *:=\).*/\1 dev\/kube-configs\/kubeconfig_control.yaml/1" "${target_makefile}" + sed -i -e "s/\(TARGET_KUBECONFIG *:=\).*/\1 dev\/kube-configs\/kubeconfig_target.yaml/1" "${target_makefile}" } -exportVariables() { - export CONTROL_NAMESPACE=shoot--"${PROJECT}"--"${SHOOT}" - export CONTROL_KUBECONFIG="${KUBECONFIG_PATH}"/kubeconfig_control.yaml - export TARGET_KUBECONFIG="${KUBECONFIG_PATH}"/kubeconfig_target.yaml +function export_variables() { + export CONTROL_NAMESPACE=shoot--"${PROJECT}"--"${SHOOT}" + export CONTROL_KUBECONFIG="${KUBECONFIG_PATH}"/kubeconfig_control.yaml + export TARGET_KUBECONFIG="${KUBECONFIG_PATH}"/kubeconfig_target.yaml } -updateProviderMakefile() { - # Makefile of provider also needs to point at those kubeconfigs - sed -i -e "s/\(CONTROL_NAMESPACE *:= *\).*/\1 shoot--"${PROJECT}"--"${SHOOT}"/1" "${PROVIDER_PATH}"/makefile - sed -i -e "s/\(CONTROL_KUBECONFIG *:= *\).*/\1 dev\/kubeconfigs\/kubeconfig_control.yaml/1" "${PROVIDER_PATH}"/makefile - sed -i -e "s/\(TARGET_KUBECONFIG *:= *\).*/\1 dev\/kubeconfigs\/kubeconfig_target.yaml/1" "${PROVIDER_PATH}"/makefile +function main() { + parse_flags "$@" + validate_args + initialize_variables + prepare_paths + download_kubeconfigs + copy_kubeconfigs_to_provider_mcm + scale_down_mcm + update_makefile "${PROJECT_DIR}" # update the local Makefile + update_makefile "${PROVIDER_MCM_PROJECT_DIR}" # update the provider-mcm Makefile + export_variables } -main +USAGE=$(create_usage) +main "$@" diff --git a/hack/tools.mk b/hack/tools.mk new file mode 100644 index 000000000..04112d443 --- /dev/null +++ b/hack/tools.mk @@ -0,0 +1,33 @@ +# Copyright (c) 2023 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file +# +# 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. + +TOOLS_DIR := hack/tools +TOOLS_BIN_DIR := $(TOOLS_DIR)/bin +GO_ADD_LICENSE := $(TOOLS_BIN_DIR)/addlicense + +# default tool versions +GO_ADD_LICENSE_VERSION ?= latest + +export TOOLS_BIN_DIR := $(TOOLS_BIN_DIR) +export PATH := $(abspath $(TOOLS_BIN_DIR)):$(PATH) +$(info "TOOLS_BIN_DIR from tools.mk", $(TOOLS_BIN_DIR)) +$(info "TOOLS_DIR from tools.mk", $(TOOLS_DIR)) +$(info "PATH from tools.mk", $(PATH)) + +######################################### +# Tools # +######################################### + +$(GO_ADD_LICENSE): + GOBIN=$(abspath $(TOOLS_BIN_DIR)) go install github.com/google/addlicense@$(GO_ADD_LICENSE_VERSION) \ No newline at end of file diff --git a/pkg/apis/machine/validation/validation_suite_test.go b/pkg/apis/machine/validation/validation_suite_test.go index 37c9ac1fc..520a7bcef 100644 --- a/pkg/apis/machine/validation/validation_suite_test.go +++ b/pkg/apis/machine/validation/validation_suite_test.go @@ -1,3 +1,17 @@ +// Copyright 2023 SAP SE or an SAP affiliate company +// +// 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 validation import ( diff --git a/pkg/apis/machine/zz_generated.defaults.go b/pkg/apis/machine/zz_generated.defaults.go index 3fa68441f..d5513ac6d 100644 --- a/pkg/apis/machine/zz_generated.defaults.go +++ b/pkg/apis/machine/zz_generated.defaults.go @@ -1,3 +1,17 @@ +// Copyright 2023 SAP SE or an SAP affiliate company +// +// 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. + // +build !ignore_autogenerated // This file was autogenerated by defaulter-gen. Do not edit it manually! diff --git a/pkg/controller/autoscaler/types.go b/pkg/controller/autoscaler/types.go index e61b3c8c7..e5a0941fd 100644 --- a/pkg/controller/autoscaler/types.go +++ b/pkg/controller/autoscaler/types.go @@ -1,3 +1,17 @@ +// Copyright 2023 SAP SE or an SAP affiliate company +// +// 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 autoscaler const ( diff --git a/pkg/openapi/doc.go b/pkg/openapi/doc.go index 251286530..850a8ea8d 100644 --- a/pkg/openapi/doc.go +++ b/pkg/openapi/doc.go @@ -1,2 +1,16 @@ +// Copyright 2023 SAP SE or an SAP affiliate company +// +// 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 openapi exists to hold generated openapi code package openapi diff --git a/pkg/test/integration/common/framework.go b/pkg/test/integration/common/framework.go index 403789edf..ac9063c7e 100644 --- a/pkg/test/integration/common/framework.go +++ b/pkg/test/integration/common/framework.go @@ -1,3 +1,17 @@ +// Copyright 2023 SAP SE or an SAP affiliate company +// +// 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 common import ( diff --git a/pkg/test/integration/common/helpers/cluster.go b/pkg/test/integration/common/helpers/cluster.go index d0b8f8059..2b6580f3b 100644 --- a/pkg/test/integration/common/helpers/cluster.go +++ b/pkg/test/integration/common/helpers/cluster.go @@ -1,3 +1,17 @@ +// Copyright 2023 SAP SE or an SAP affiliate company +// +// 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 helpers import ( diff --git a/pkg/test/integration/common/helpers/handling_files.go b/pkg/test/integration/common/helpers/handling_files.go index 736805273..402f9424e 100644 --- a/pkg/test/integration/common/helpers/handling_files.go +++ b/pkg/test/integration/common/helpers/handling_files.go @@ -1,3 +1,17 @@ +// Copyright 2023 SAP SE or an SAP affiliate company +// +// 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 helpers import ( diff --git a/pkg/test/integration/common/helpers/handling_git.go b/pkg/test/integration/common/helpers/handling_git.go index 86b808ba5..5859456a8 100644 --- a/pkg/test/integration/common/helpers/handling_git.go +++ b/pkg/test/integration/common/helpers/handling_git.go @@ -1,3 +1,17 @@ +// Copyright 2023 SAP SE or an SAP affiliate company +// +// 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 helpers import ( diff --git a/pkg/test/integration/common/helpers/machine_resources.go b/pkg/test/integration/common/helpers/machine_resources.go index 5ddb98ba6..6ecc8adb4 100644 --- a/pkg/test/integration/common/helpers/machine_resources.go +++ b/pkg/test/integration/common/helpers/machine_resources.go @@ -1,3 +1,17 @@ +// Copyright 2023 SAP SE or an SAP affiliate company +// +// 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 helpers import ( diff --git a/pkg/test/integration/common/helpers/nodes.go b/pkg/test/integration/common/helpers/nodes.go index 10345118f..2f4089f3a 100644 --- a/pkg/test/integration/common/helpers/nodes.go +++ b/pkg/test/integration/common/helpers/nodes.go @@ -1,3 +1,17 @@ +// Copyright 2023 SAP SE or an SAP affiliate company +// +// 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 helpers import ( diff --git a/pkg/test/integration/common/helpers/resources_tracker_interface.go b/pkg/test/integration/common/helpers/resources_tracker_interface.go index d8722f04a..20d59deb4 100644 --- a/pkg/test/integration/common/helpers/resources_tracker_interface.go +++ b/pkg/test/integration/common/helpers/resources_tracker_interface.go @@ -1,3 +1,17 @@ +// Copyright 2023 SAP SE or an SAP affiliate company +// +// 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 helpers import ( diff --git a/pkg/util/annotations/annotations_suite_test.go b/pkg/util/annotations/annotations_suite_test.go index 755c27844..85919c7e4 100644 --- a/pkg/util/annotations/annotations_suite_test.go +++ b/pkg/util/annotations/annotations_suite_test.go @@ -1,3 +1,17 @@ +// Copyright 2023 SAP SE or an SAP affiliate company +// +// 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 annotations_test import ( diff --git a/pkg/util/provider/drain/drain_suite_test.go b/pkg/util/provider/drain/drain_suite_test.go index fae04932d..d1fc550f0 100644 --- a/pkg/util/provider/drain/drain_suite_test.go +++ b/pkg/util/provider/drain/drain_suite_test.go @@ -1,3 +1,17 @@ +// Copyright 2023 SAP SE or an SAP affiliate company +// +// 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 drain_test import ( diff --git a/pkg/util/provider/machinecontroller/machine_safety_util.go b/pkg/util/provider/machinecontroller/machine_safety_util.go index ef27f7c7c..0ab682f95 100644 --- a/pkg/util/provider/machinecontroller/machine_safety_util.go +++ b/pkg/util/provider/machinecontroller/machine_safety_util.go @@ -1,3 +1,17 @@ +// Copyright 2023 SAP SE or an SAP affiliate company +// +// 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 controller import ( diff --git a/pkg/util/provider/machinecontroller/machine_safety_util_test.go b/pkg/util/provider/machinecontroller/machine_safety_util_test.go index 5c0ae2eb5..4d67e02d6 100644 --- a/pkg/util/provider/machinecontroller/machine_safety_util_test.go +++ b/pkg/util/provider/machinecontroller/machine_safety_util_test.go @@ -1,3 +1,17 @@ +// Copyright 2023 SAP SE or an SAP affiliate company +// +// 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 controller import ( diff --git a/pkg/util/time/time_suite_test.go b/pkg/util/time/time_suite_test.go index 69f1ac6f7..3a1ef4dc7 100644 --- a/pkg/util/time/time_suite_test.go +++ b/pkg/util/time/time_suite_test.go @@ -1,3 +1,17 @@ +// Copyright 2023 SAP SE or an SAP affiliate company +// +// 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 time_test import ( diff --git a/pkg/util/worker/worker.go b/pkg/util/worker/worker.go index 2ac3f7d48..3e8334cca 100644 --- a/pkg/util/worker/worker.go +++ b/pkg/util/worker/worker.go @@ -1,3 +1,17 @@ +// Copyright 2023 SAP SE or an SAP affiliate company +// +// 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 worker import (