Replace go-bindata with go:embed in pkg/deploy

This commit is contained in:
tschneid 2022-07-12 13:32:12 -05:00
Родитель c38a63f9b8
Коммит 7b6138505e
35 изменённых файлов: 685 добавлений и 1163 удалений

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -1,8 +0,0 @@
package deploy
// Copyright (c) Microsoft Corporation.
// Licensed under the Apache License 2.0.
//go:generate go run ../hack/gendeploy
//go:generate go run ../vendor/github.com/go-bindata/go-bindata/go-bindata -nometadata -pkg $GOPACKAGE -ignore=generate.go -ignore=config.yaml -o ../pkg/deploy/bindata.go .
//go:generate gofmt -s -l -w ../pkg/deploy/bindata.go

Просмотреть файл

@ -69,7 +69,7 @@
az deployment group create \ az deployment group create \
-g "$RESOURCEGROUP" \ -g "$RESOURCEGROUP" \
-n "databases-development-$USER" \ -n "databases-development-$USER" \
--template-file deploy/databases-development.json \ --template-file pkg/deploy/assets/databases-development.json \
--parameters \ --parameters \
"databaseAccountName=$DATABASE_ACCOUNT_NAME" \ "databaseAccountName=$DATABASE_ACCOUNT_NAME" \
"databaseName=$DATABASE_NAME" \ "databaseName=$DATABASE_NAME" \
@ -260,7 +260,7 @@ To access the cluster for oc / kubectl or SSH'ing into the cluster you need to c
* Access via Azure Portal * Access via Azure Portal
Due to the fact that the AKS cluster is private, you need to be connected to the VPN in order to view certain AKS cluster properties, because the UI interrogates k8s via the VPN. Due to the fact that the AKS cluster is private, you need to be connected to the VPN in order to view certain AKS cluster properties, because the UI interrogates k8s via the VPN.
### Metrics ### Metrics

Просмотреть файл

@ -206,7 +206,7 @@ locations.
LOCATION=<YOUR-REGION> LOCATION=<YOUR-REGION>
az deployment sub create \ az deployment sub create \
-l $LOCATION \ -l $LOCATION \
--template-file deploy/rbac-development.json \ --template-file pkg/deploy/assets/rbac-development.json \
--parameters \ --parameters \
"armServicePrincipalId=$(az ad sp list --filter "appId eq '$AZURE_ARM_CLIENT_ID'" --query '[].objectId' -o tsv)" \ "armServicePrincipalId=$(az ad sp list --filter "appId eq '$AZURE_ARM_CLIENT_ID'" --query '[].objectId' -o tsv)" \
"fpServicePrincipalId=$(az ad sp list --filter "appId eq '$AZURE_FP_CLIENT_ID'" --query '[].objectId' -o tsv)" \ "fpServicePrincipalId=$(az ad sp list --filter "appId eq '$AZURE_FP_CLIENT_ID'" --query '[].objectId' -o tsv)" \
@ -352,7 +352,7 @@ Variable | Certificate Client | Subscription Type | AAD App Nam
# Import firstparty.pem to keyvault v4-eastus-svc # Import firstparty.pem to keyvault v4-eastus-svc
az keyvault certificate import --vault-name <kv_name> --name rp-firstparty --file firstparty.pem az keyvault certificate import --vault-name <kv_name> --name rp-firstparty --file firstparty.pem
# Rotate certificates for SPs ARM, FP, and PORTAL (wherever applicable) # Rotate certificates for SPs ARM, FP, and PORTAL (wherever applicable)
az ad app credential reset \ az ad app credential reset \
--id "$AZURE_ARM_CLIENT_ID" \ --id "$AZURE_ARM_CLIENT_ID" \
--cert "$(base64 -w0 <secrets/arm.crt)" >/dev/null --cert "$(base64 -w0 <secrets/arm.crt)" >/dev/null
@ -511,7 +511,7 @@ each of the bash functions below.
> __NOTE:__: in development, if you don't have valid certs for these, you can just > __NOTE:__: in development, if you don't have valid certs for these, you can just
upload `localhost.pem` as a placeholder for each of these. This will avoid an upload `localhost.pem` as a placeholder for each of these. This will avoid an
error stemming from them not existing, but it will result in logging pods error stemming from them not existing, but it will result in logging pods
crash looping in any clusters you make. Additionally, no gateway resources are crash looping in any clusters you make. Additionally, no gateway resources are
created in development so you should not need to execute the cert import statement created in development so you should not need to execute the cert import statement
for the "-gwy" keyvault. for the "-gwy" keyvault.
@ -544,4 +544,4 @@ Development value: secrets/cluster-logging-int.pem
## Append Resource Group to Subscription Cleaner DenyList ## Append Resource Group to Subscription Cleaner DenyList
* We have subscription pruning that takes place routinely and need to add our resource group for the shared rp environment to the `denylist` of the cleaner: * We have subscription pruning that takes place routinely and need to add our resource group for the shared rp environment to the `denylist` of the cleaner:
* [https://github.com/Azure/ARO-RP/blob/e918d1b87be53a3b3cdf18b674768a6480fb56b8/hack/clean/clean.go#L29](https://github.com/Azure/ARO-RP/blob/e918d1b87be53a3b3cdf18b674768a6480fb56b8/hack/clean/clean.go#L29) * [https://github.com/Azure/ARO-RP/blob/e918d1b87be53a3b3cdf18b674768a6480fb56b8/hack/clean/clean.go#L29](https://github.com/Azure/ARO-RP/blob/e918d1b87be53a3b3cdf18b674768a6480fb56b8/hack/clean/clean.go#L29)

Просмотреть файл

@ -11,7 +11,7 @@ deploy_rp_dev_predeploy() {
az deployment group create \ az deployment group create \
-g "$RESOURCEGROUP" \ -g "$RESOURCEGROUP" \
-n rp-development-predeploy \ -n rp-development-predeploy \
--template-file deploy/rp-development-predeploy.json \ --template-file pkg/deploy/assets/rp-development-predeploy.json \
--parameters \ --parameters \
"adminObjectId=$ADMIN_OBJECT_ID" \ "adminObjectId=$ADMIN_OBJECT_ID" \
"fpServicePrincipalId=$(az ad sp list --filter "appId eq '$AZURE_FP_CLIENT_ID'" --query '[].objectId' -o tsv)" \ "fpServicePrincipalId=$(az ad sp list --filter "appId eq '$AZURE_FP_CLIENT_ID'" --query '[].objectId' -o tsv)" \
@ -24,7 +24,7 @@ deploy_rp_dev() {
az deployment group create \ az deployment group create \
-g "$RESOURCEGROUP" \ -g "$RESOURCEGROUP" \
-n rp-development \ -n rp-development \
--template-file deploy/rp-development.json \ --template-file pkg/deploy/assets/rp-development.json \
--parameters \ --parameters \
"clusterParentDomainName=$PARENT_DOMAIN_NAME" \ "clusterParentDomainName=$PARENT_DOMAIN_NAME" \
"databaseAccountName=$DATABASE_ACCOUNT_NAME" \ "databaseAccountName=$DATABASE_ACCOUNT_NAME" \
@ -37,7 +37,7 @@ deploy_env_dev_ci() {
az deployment group create \ az deployment group create \
-g "$RESOURCEGROUP" \ -g "$RESOURCEGROUP" \
-n env-development \ -n env-development \
--template-file deploy/env-development.json \ --template-file pkg/deploy/assets/env-development.json \
--parameters \ --parameters \
"ciAzpToken=$AZPTOKEN" \ "ciAzpToken=$AZPTOKEN" \
"ciCapacity=6" \ "ciCapacity=6" \
@ -56,7 +56,7 @@ deploy_env_dev() {
az deployment group create \ az deployment group create \
-g "$RESOURCEGROUP" \ -g "$RESOURCEGROUP" \
-n env-development \ -n env-development \
--template-file deploy/env-development.json \ --template-file pkg/deploy/assets/env-development.json \
--parameters \ --parameters \
"proxyCert=$(base64 -w0 <secrets/proxy.crt)" \ "proxyCert=$(base64 -w0 <secrets/proxy.crt)" \
"proxyClientCert=$(base64 -w0 <secrets/proxy-client.crt)" \ "proxyClientCert=$(base64 -w0 <secrets/proxy-client.crt)" \
@ -73,7 +73,7 @@ deploy_aks_dev() {
az deployment group create \ az deployment group create \
-g "$RESOURCEGROUP" \ -g "$RESOURCEGROUP" \
-n aks-development \ -n aks-development \
--template-file deploy/aks-development.json \ --template-file pkg/deploy/assets/aks-development.json \
--parameters \ --parameters \
"adminObjectId=$ADMIN_OBJECT_ID" \ "adminObjectId=$ADMIN_OBJECT_ID" \
"sshRSAPublicKey=$(<secrets/proxy_id_rsa.pub)" \ "sshRSAPublicKey=$(<secrets/proxy_id_rsa.pub)" \
@ -85,7 +85,7 @@ deploy_env_dev_override() {
az deployment group create \ az deployment group create \
-g "$RESOURCEGROUP" \ -g "$RESOURCEGROUP" \
-n env-development \ -n env-development \
--template-file deploy/env-development.json \ --template-file pkg/deploy/assets/env-development.json \
--parameters \ --parameters \
"proxyCert=$(base64 -w0 <secrets/proxy.crt)" \ "proxyCert=$(base64 -w0 <secrets/proxy.crt)" \
"proxyClientCert=$(base64 -w0 <secrets/proxy-client.crt)" \ "proxyClientCert=$(base64 -w0 <secrets/proxy-client.crt)" \

Просмотреть файл

@ -43,7 +43,7 @@ deploy_e2e_db() {
az deployment group create \ az deployment group create \
-g "$RESOURCEGROUP" \ -g "$RESOURCEGROUP" \
-n "databases-development-$DATABASE_NAME" \ -n "databases-development-$DATABASE_NAME" \
--template-file deploy/databases-development.json \ --template-file pkg/deploy/assets/databases-development.json \
--parameters \ --parameters \
"databaseAccountName=$DATABASE_ACCOUNT_NAME" \ "databaseAccountName=$DATABASE_ACCOUNT_NAME" \
"databaseName=$DATABASE_NAME" \ "databaseName=$DATABASE_NAME" \
@ -72,8 +72,8 @@ clean_e2e_db(){
# if LOCAL_E2E is set, set the value with the local test names # if LOCAL_E2E is set, set the value with the local test names
# If it it not set, it defaults to the build ID # If it it not set, it defaults to the build ID
if [ -z "${LOCAL_E2E}" ] ; then if [ -z "${LOCAL_E2E}" ] ; then
export CLUSTER="v4-e2e-V$BUILD_BUILDID-$LOCATION" export CLUSTER="v4-e2e-V$BUILD_BUILDID-$LOCATION"
export DATABASE_NAME="v4-e2e-V$BUILD_BUILDID-$LOCATION" export DATABASE_NAME="v4-e2e-V$BUILD_BUILDID-$LOCATION"
fi fi

Просмотреть файл

Просмотреть файл

@ -0,0 +1,11 @@
package assets
// Copyright (c) Microsoft Corporation.
// Licensed under the Apache License 2.0.
import (
"embed"
)
//go:embed *.json
var EmbeddedFiles embed.FS

Просмотреть файл

Просмотреть файл

@ -0,0 +1,6 @@
package assets
// Copyright (c) Microsoft Corporation.
// Licensed under the Apache License 2.0.
//go:generate go run ../../../hack/gendeploy

Просмотреть файл

Просмотреть файл

Просмотреть файл

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

Просмотреть файл

@ -11,6 +11,7 @@ import (
"github.com/Azure/go-autorest/autorest/to" "github.com/Azure/go-autorest/autorest/to"
"github.com/Azure/ARO-RP/pkg/deploy/assets"
"github.com/Azure/ARO-RP/pkg/deploy/generator" "github.com/Azure/ARO-RP/pkg/deploy/generator"
"github.com/Azure/ARO-RP/pkg/util/arm" "github.com/Azure/ARO-RP/pkg/util/arm"
) )
@ -28,13 +29,13 @@ func TestConfigurationFieldParity(t *testing.T) {
generator.FileRPProductionParameters, generator.FileRPProductionParameters,
generator.FileRPProductionPredeployParameters, generator.FileRPProductionPredeployParameters,
} { } {
b, err := Asset(paramsFile) asset, err := assets.EmbeddedFiles.ReadFile(paramsFile)
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }
var params *arm.Parameters var params *arm.Parameters
err = json.Unmarshal(b, &params) err = json.Unmarshal(asset, &params)
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }

Просмотреть файл

@ -9,6 +9,7 @@ import (
mgmtfeatures "github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2019-07-01/features" mgmtfeatures "github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2019-07-01/features"
"github.com/Azure/ARO-RP/pkg/deploy/assets"
"github.com/Azure/ARO-RP/pkg/deploy/generator" "github.com/Azure/ARO-RP/pkg/deploy/generator"
"github.com/Azure/ARO-RP/pkg/util/arm" "github.com/Azure/ARO-RP/pkg/util/arm"
) )
@ -26,13 +27,13 @@ func (d *deployer) DeployGateway(ctx context.Context) error {
deploymentName := "gateway-production-" + d.version deploymentName := "gateway-production-" + d.version
b, err := Asset(generator.FileGatewayProduction) asset, err := assets.EmbeddedFiles.ReadFile(generator.FileGatewayProduction)
if err != nil { if err != nil {
return err return err
} }
var template map[string]interface{} var template map[string]interface{}
err = json.Unmarshal(b, &template) err = json.Unmarshal(asset, &template)
if err != nil { if err != nil {
return err return err
} }

Просмотреть файл

@ -13,6 +13,7 @@ import (
mgmtfeatures "github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2019-07-01/features" mgmtfeatures "github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2019-07-01/features"
"github.com/Azure/go-autorest/autorest/to" "github.com/Azure/go-autorest/autorest/to"
"github.com/Azure/ARO-RP/pkg/deploy/assets"
"github.com/Azure/ARO-RP/pkg/deploy/generator" "github.com/Azure/ARO-RP/pkg/deploy/generator"
"github.com/Azure/ARO-RP/pkg/util/arm" "github.com/Azure/ARO-RP/pkg/util/arm"
) )
@ -30,13 +31,13 @@ func (d *deployer) DeployRP(ctx context.Context) error {
deploymentName := "rp-production-" + d.version deploymentName := "rp-production-" + d.version
b, err := Asset(generator.FileRPProduction) asset, err := assets.EmbeddedFiles.ReadFile(generator.FileRPProduction)
if err != nil { if err != nil {
return err return err
} }
var template map[string]interface{} var template map[string]interface{}
err = json.Unmarshal(b, &template) err = json.Unmarshal(asset, &template)
if err != nil { if err != nil {
return err return err
} }

Просмотреть файл

@ -19,6 +19,7 @@ import (
"github.com/Azure/go-autorest/autorest/azure" "github.com/Azure/go-autorest/autorest/azure"
"github.com/Azure/go-autorest/autorest/to" "github.com/Azure/go-autorest/autorest/to"
"github.com/Azure/ARO-RP/pkg/deploy/assets"
"github.com/Azure/ARO-RP/pkg/deploy/generator" "github.com/Azure/ARO-RP/pkg/deploy/generator"
"github.com/Azure/ARO-RP/pkg/env" "github.com/Azure/ARO-RP/pkg/env"
"github.com/Azure/ARO-RP/pkg/util/arm" "github.com/Azure/ARO-RP/pkg/util/arm"
@ -156,13 +157,13 @@ func (d *deployer) PreDeploy(ctx context.Context) error {
func (d *deployer) deployRPGlobal(ctx context.Context, rpServicePrincipalID, gatewayServicePrincipalID string) error { func (d *deployer) deployRPGlobal(ctx context.Context, rpServicePrincipalID, gatewayServicePrincipalID string) error {
deploymentName := "rp-global-" + d.config.Location deploymentName := "rp-global-" + d.config.Location
b, err := Asset(generator.FileRPProductionGlobal) asset, err := assets.EmbeddedFiles.ReadFile(generator.FileRPProductionGlobal)
if err != nil { if err != nil {
return err return err
} }
var template map[string]interface{} var template map[string]interface{}
err = json.Unmarshal(b, &template) err = json.Unmarshal(asset, &template)
if err != nil { if err != nil {
return err return err
} }
@ -205,13 +206,13 @@ func (d *deployer) deployRPGlobal(ctx context.Context, rpServicePrincipalID, gat
func (d *deployer) deployRPGlobalACRReplication(ctx context.Context) error { func (d *deployer) deployRPGlobalACRReplication(ctx context.Context) error {
deploymentName := "rp-global-acr-replication-" + d.config.Location deploymentName := "rp-global-acr-replication-" + d.config.Location
b, err := Asset(generator.FileRPProductionGlobalACRReplication) asset, err := assets.EmbeddedFiles.ReadFile(generator.FileRPProductionGlobalACRReplication)
if err != nil { if err != nil {
return err return err
} }
var template map[string]interface{} var template map[string]interface{}
err = json.Unmarshal(b, &template) err = json.Unmarshal(asset, &template)
if err != nil { if err != nil {
return err return err
} }
@ -234,13 +235,13 @@ func (d *deployer) deployRPGlobalACRReplication(ctx context.Context) error {
func (d *deployer) deployRPGlobalSubscription(ctx context.Context) error { func (d *deployer) deployRPGlobalSubscription(ctx context.Context) error {
deploymentName := "rp-global-subscription-" + d.config.Location deploymentName := "rp-global-subscription-" + d.config.Location
b, err := Asset(generator.FileRPProductionGlobalSubscription) asset, err := assets.EmbeddedFiles.ReadFile(generator.FileRPProductionGlobalSubscription)
if err != nil { if err != nil {
return err return err
} }
var template map[string]interface{} var template map[string]interface{}
err = json.Unmarshal(b, &template) err = json.Unmarshal(asset, &template)
if err != nil { if err != nil {
return err return err
} }
@ -274,13 +275,13 @@ func (d *deployer) deployRPGlobalSubscription(ctx context.Context) error {
func (d *deployer) deployRPSubscription(ctx context.Context) error { func (d *deployer) deployRPSubscription(ctx context.Context) error {
deploymentName := "rp-production-subscription-" + d.config.Location deploymentName := "rp-production-subscription-" + d.config.Location
b, err := Asset(generator.FileRPProductionSubscription) asset, err := assets.EmbeddedFiles.ReadFile(generator.FileRPProductionSubscription)
if err != nil { if err != nil {
return err return err
} }
var template map[string]interface{} var template map[string]interface{}
err = json.Unmarshal(b, &template) err = json.Unmarshal(asset, &template)
if err != nil { if err != nil {
return err return err
} }
@ -297,13 +298,13 @@ func (d *deployer) deployRPSubscription(ctx context.Context) error {
func (d *deployer) deployManagedIdentity(ctx context.Context, resourceGroupName, deploymentFile string) error { func (d *deployer) deployManagedIdentity(ctx context.Context, resourceGroupName, deploymentFile string) error {
deploymentName := strings.TrimSuffix(deploymentFile, ".json") deploymentName := strings.TrimSuffix(deploymentFile, ".json")
b, err := Asset(deploymentFile) asset, err := assets.EmbeddedFiles.ReadFile(deploymentFile)
if err != nil { if err != nil {
return err return err
} }
var template map[string]interface{} var template map[string]interface{}
err = json.Unmarshal(b, &template) err = json.Unmarshal(asset, &template)
if err != nil { if err != nil {
return err return err
} }
@ -320,13 +321,13 @@ func (d *deployer) deployManagedIdentity(ctx context.Context, resourceGroupName,
func (d *deployer) deployPreDeploy(ctx context.Context, resourceGroupName, deploymentFile, spIDName, spID string, isCreate bool) error { func (d *deployer) deployPreDeploy(ctx context.Context, resourceGroupName, deploymentFile, spIDName, spID string, isCreate bool) error {
deploymentName := strings.TrimSuffix(deploymentFile, ".json") deploymentName := strings.TrimSuffix(deploymentFile, ".json")
b, err := Asset(deploymentFile) asset, err := assets.EmbeddedFiles.ReadFile(deploymentFile)
if err != nil { if err != nil {
return err return err
} }
var template map[string]interface{} var template map[string]interface{}
err = json.Unmarshal(b, &template) err = json.Unmarshal(asset, &template)
if err != nil { if err != nil {
return err return err
} }

Просмотреть файл

@ -29,7 +29,7 @@ import (
"github.com/Azure/ARO-RP/pkg/api" "github.com/Azure/ARO-RP/pkg/api"
v20220401 "github.com/Azure/ARO-RP/pkg/api/v20220401" v20220401 "github.com/Azure/ARO-RP/pkg/api/v20220401"
mgmtredhatopenshift20220401 "github.com/Azure/ARO-RP/pkg/client/services/redhatopenshift/mgmt/2022-04-01/redhatopenshift" mgmtredhatopenshift20220401 "github.com/Azure/ARO-RP/pkg/client/services/redhatopenshift/mgmt/2022-04-01/redhatopenshift"
"github.com/Azure/ARO-RP/pkg/deploy" "github.com/Azure/ARO-RP/pkg/deploy/assets"
"github.com/Azure/ARO-RP/pkg/deploy/generator" "github.com/Azure/ARO-RP/pkg/deploy/generator"
"github.com/Azure/ARO-RP/pkg/env" "github.com/Azure/ARO-RP/pkg/env"
"github.com/Azure/ARO-RP/pkg/util/arm" "github.com/Azure/ARO-RP/pkg/util/arm"
@ -161,13 +161,13 @@ func (c *Cluster) Create(ctx context.Context, vnetResourceGroup, clusterName str
} }
} }
b, err := deploy.Asset(generator.FileClusterPredeploy) asset, err := assets.EmbeddedFiles.ReadFile(generator.FileClusterPredeploy)
if err != nil { if err != nil {
return err return err
} }
var template map[string]interface{} var template map[string]interface{}
err = json.Unmarshal(b, &template) err = json.Unmarshal(asset, &template)
if err != nil { if err != nil {
return err return err
} }