From b9cb3de85b6d877e98ae581677f44d7459bad10c Mon Sep 17 00:00:00 2001 From: Candice Ye Date: Fri, 9 Sep 2022 11:49:27 -0700 Subject: [PATCH] Bug bash fixes to Azure Arc PostgreSQL (#20568) * Added username field to PG and removed defaultvalue for port * Disabled system username for miaa. Added username to pg create notebook. * Block system for pg username * Remove sql username from pg create * Add service type * bump version for preview * Add dev use label * Changed postgres icon * Fixed PG create page not displaying. Wrong type * Fixed service type * changed naming for admin usernames sql and pg * sql and pg dev use fix * Move port under service type and make storage class not required * Fixed regex to include things like sa1 system1 * Made storage class params optional * Added placeholder text and changed PG admin username label * Remove backups * Removed postgres hardcoded username in connectionstring * Remove more postgres username hardcoded Co-authored-by: Candice Ye --- extensions/arc/images/postgres.svg | 34 +++++---- .../deploy.postgres.existing.arc.ipynb | 8 ++- .../deploy.sql.existing.arc.ipynb | 2 +- extensions/arc/package.json | 69 ++++++++++++------- extensions/arc/package.nls.json | 15 +++- .../postgres/postgresConnectionStringsPage.ts | 16 ++--- extensions/azcli/package.json | 2 +- 7 files changed, 89 insertions(+), 57 deletions(-) diff --git a/extensions/arc/images/postgres.svg b/extensions/arc/images/postgres.svg index 8c4cb91c17..061ef43b00 100644 --- a/extensions/arc/images/postgres.svg +++ b/extensions/arc/images/postgres.svg @@ -1,21 +1,19 @@ - + - - - + + + + + + + + - - - - - - - - - - - - - - + Icon-databases-131 + + + + + + \ No newline at end of file diff --git a/extensions/arc/notebooks/arcDeployment/deploy.postgres.existing.arc.ipynb b/extensions/arc/notebooks/arcDeployment/deploy.postgres.existing.arc.ipynb index 999097fe43..d590986e69 100644 --- a/extensions/arc/notebooks/arcDeployment/deploy.postgres.existing.arc.ipynb +++ b/extensions/arc/notebooks/arcDeployment/deploy.postgres.existing.arc.ipynb @@ -99,16 +99,22 @@ "print (f'Creating the PostgreSQL server - Azure Arc instance')\n", "\n", "port = f' --port \"{postgres_server_port}\"' if postgres_server_port else \"\"\n", + "service_type = f' --service-type \"{postgres_server_service_type}\"' if postgres_server_service_type else \"\"\n", "volume_size_data = f' --volume-size-data {postgres_server_volume_size_data}Gi' if postgres_server_volume_size_data else \"\"\n", "volume_size_logs = f' --volume-size-logs {postgres_server_volume_size_logs}Gi' if postgres_server_volume_size_logs else \"\"\n", "\n", + "storage_class_data = f' --storage-class-data {postgres_storage_class_data}' if postgres_storage_class_data else \"\"\n", + "storage_class_logs = f' --storage-class-logs {postgres_storage_class_logs}' if postgres_storage_class_logs else \"\"\n", + "\n", "cores_request = f' --cores-request {postgres_server_cores_request}' if postgres_server_cores_request else \"\"\n", "cores_limit = f' --cores-limit {postgres_server_cores_limit}' if postgres_server_cores_limit else \"\"\n", "memory_request = f' --memory-request {postgres_server_memory_request}Gi' if postgres_server_memory_request else \"\"\n", "memory_limit = f' --memory-limit {postgres_server_memory_limit}Gi' if postgres_server_memory_limit else \"\"\n", + "dev_use = ' --dev' if postgres_server_dev_use == 'true' else ''\n", "\n", + "os.environ[\"AZDATA_USERNAME\"] = postgres_server_username\n", "os.environ[\"AZDATA_PASSWORD\"] = os.environ[\"AZDATA_NB_VAR_POSTGRES_SERVER_PASSWORD\"]\n", - "cmd = f'az postgres server-arc create --name {postgres_server_name} --k8s-namespace {arc_data_controller_namespace} --use-k8s --storage-class-data {postgres_storage_class_data} --storage-class-logs {postgres_storage_class_logs}{port}{volume_size_data}{volume_size_logs}{cores_request}{cores_limit}{memory_request}{memory_limit}'\n", + "cmd = f'az postgres server-arc create --name {postgres_server_name} --k8s-namespace {arc_data_controller_namespace} --use-k8s {storage_class_data}{storage_class_logs}{port}{service_type}{volume_size_data}{volume_size_logs}{cores_request}{cores_limit}{memory_request}{memory_limit}{dev_use}'\n", "out=run_command()" ] } diff --git a/extensions/arc/notebooks/arcDeployment/deploy.sql.existing.arc.ipynb b/extensions/arc/notebooks/arcDeployment/deploy.sql.existing.arc.ipynb index ff8782f405..ca4911916d 100644 --- a/extensions/arc/notebooks/arcDeployment/deploy.sql.existing.arc.ipynb +++ b/extensions/arc/notebooks/arcDeployment/deploy.sql.existing.arc.ipynb @@ -129,7 +129,7 @@ "\n", "service_tier = f' --tier {sql_service_tier}'\n", "cores_limit = f' --cores-limit {sql_cores_limit}'\n", - "dev_use = ' --dev' if sql_dev_use else ''\n", + "dev_use = ' --dev' if sql_dev_use == 'true' else ''\n", "license_type = ' --license-type BasePrice' if sql_license_type else ' --license-type LicenseIncluded'\n", "\n", "os.environ[\"AZDATA_USERNAME\"] = sql_username\n", diff --git a/extensions/arc/package.json b/extensions/arc/package.json index 3f77bcb294..52d61e552e 100644 --- a/extensions/arc/package.json +++ b/extensions/arc/package.json @@ -2,7 +2,7 @@ "name": "arc", "displayName": "%arc.displayName%", "description": "%arc.description%", - "version": "1.5.2", + "version": "1.5.3", "publisher": "Microsoft", "license": "https://raw.githubusercontent.com/Microsoft/azuredatastudio/main/LICENSE.txt", "icon": "images/extension.png", @@ -758,7 +758,8 @@ "regex": "^[a-z]([-a-z0-9]{0,11}[a-z0-9])?$", "description": "%arc.sql.invalid.instance.name%" } - ] + ], + "placeHolder": "%arc.sql.instance.name.placeholder%" }, { "label": "%arc.sql.username%", @@ -768,10 +769,11 @@ "validations": [ { "type": "regex_match", - "regex": "^(?!sa$)", + "regex": "^(?!system$|sa$).*$", "description": "%arc.sql.invalid.username%" } - ] + ], + "placeHolder": "%arc.sql.username.placeholder%" }, { "label": "%arc.password%", @@ -1378,7 +1380,24 @@ "description": "%arc.postgres.server.name.validation.description%" } ], - "required": true + "required": true, + "placeHolder": "%arc.postgres.server.name.placeholder%" + }, + { + "label": "%arc.postgres.server.username%", + "variableName": "AZDATA_NB_VAR_POSTGRES_SERVER_USERNAME", + "type": "text", + "required": true, + "validations": [ + { + "type": "regex_match", + "regex": "^(?!system$).*$", + "description": "%arc.postgres.server.invalid.username%" + } + ], + "defaultValue": "", + "enabled": true, + "placeHolder": "%arc.postgres.server.username.placeholder%" }, { "label": "%arc.password%", @@ -1389,6 +1408,17 @@ "defaultValue": "", "required": true }, + { + "label": "%arc.postgres.server.service.type%", + "variableName": "AZDATA_NB_VAR_POSTGRES_SERVER_SERVICE_TYPE", + "type": "options", + "required": true, + "options": { + "values": ["NodePort", "LoadBalancer"], + "defaultValue": "NodePort", + "optionsType": "radio" + } + }, { "label": "%arc.postgres.server.port%", "variableName": "AZDATA_NB_VAR_POSTGRES_SERVER_PORT", @@ -1399,9 +1429,15 @@ "description": "%should.be.integer%" } ], - "defaultValue": "5432", "min": 1, "max": 65535 + }, + { + "type": "checkbox", + "label": "%arc.postgres.server.dev.use.label%", + "variableName": "AZDATA_NB_VAR_POSTGRES_SERVER_DEV_USE", + "description": "%arc.postgres.server.dev.use.description%", + "defaultValue": false } ] }, @@ -1473,8 +1509,7 @@ "label": "%arc.storage-class.data.label%", "description": "%arc.postgres.storage-class.data.description%", "variableName": "AZDATA_NB_VAR_POSTGRES_STORAGE_CLASS_DATA", - "type": "kube_storage_class", - "required": true + "type": "kube_storage_class" }, { "label": "%arc.postgres.server.volume.size.data.label%", @@ -1488,8 +1523,7 @@ "label": "%arc.storage-class.logs.label%", "description": "%arc.postgres.storage-class.logs.description%", "variableName": "AZDATA_NB_VAR_POSTGRES_STORAGE_CLASS_LOGS", - "type": "kube_storage_class", - "required": true + "type": "kube_storage_class" }, { "label": "%arc.postgres.server.volume.size.logs.label%", @@ -1498,21 +1532,6 @@ "type": "number", "defaultValue": "5", "min": 1 - }, - { - "label": "%arc.storage-class.backups.label%", - "description": "%arc.postgres.storage-class.backups.description%", - "variableName": "AZDATA_NB_VAR_POSTGRES_STORAGE_CLASS_BACKUPS", - "type": "kube_storage_class", - "required": true - }, - { - "label": "%arc.postgres.server.volume.size.backups.label%", - "description": "%arc.postgres.server.volume.size.backups.description%", - "variableName": "AZDATA_NB_VAR_POSTGRES_SERVER_VOLUME_SIZE_BACKUPS", - "type": "number", - "defaultValue": "5", - "min": 1 } ] } diff --git a/extensions/arc/package.nls.json b/extensions/arc/package.nls.json index b5f0288668..20bc4caac6 100644 --- a/extensions/arc/package.nls.json +++ b/extensions/arc/package.nls.json @@ -104,8 +104,10 @@ "arc.sql.instance.retention.policy.title": "SQL Instance Backup Retention Policy", "arc.azure.section.title": "Azure information", "arc.sql.instance.name": "Instance name", - "arc.sql.username": "Username", - "arc.sql.invalid.username": "sa username is disabled, please choose another username", + "arc.sql.instance.name.placeholder": "Enter instance name", + "arc.sql.username": "Managed Instance admin login", + "arc.sql.username.placeholder": "Enter admin name", + "arc.sql.invalid.username": "That username is disabled; please choose another username.", "arc.sql.invalid.instance.name": "Instance name must consist of lower case alphanumeric characters or '-', start with a letter, end with an alphanumeric character, and be 13 characters or fewer in length.", "arc.storage-class.dc.label": "Storage Class", "arc.sql.storage-class.dc.description": "The storage class to be used for all data and logs persistent volumes for all data controller pods that require them.", @@ -176,12 +178,12 @@ "arc.sql.service.tier.label": "Service Tier", "arc.sql.service.tier.description": "Select from the latest vCore service tiers available for SQL Managed Instance - Azure Arc including General Purpose and Business Critical.", "arc.sql.dev.use.label": "For development use only", + "arc.sql.dev.use.description": "Check the box to indicate this instance will be used for development or testing purposes only. This instance will not be billed.", "arc.sql.license.type.label": "I already have a SQL Server License", "arc.sql.license.type.description": "Apply the Azure Hybrid Benefit if you already own a SQL Server License", "arc.sql.pitr.description": "Point in time restore", "arc.sql.retention.days.label": "Point in time retention (days)", "arc.sql.retention.days.description": "Specify how long you want to keep your point-in-time backups.", - "arc.sql.dev.use.description": "Check the box to indicate this instance will be used for development or testing purposes only. This instance will not be billed.", "arc.postgres.storage-class.backups.description": "The storage class to be used for backup persistent volumes", "arc.password": "Password", "arc.confirm.password": "Confirm password", @@ -195,6 +197,7 @@ "arc.postgres.settings.resource.compute.config.title": "Compute Configuration", "arc.postgres.settings.storage.title": "Storage settings", "arc.postgres.server.name": "Server name", + "arc.postgres.server.name.placeholder": "Enter server name", "arc.postgres.server.name.validation.description": "Server name must consist of lower case alphanumeric characters or '-', start with a letter, end with an alphanumeric character, and be 11 characters or fewer in length.", "arc.postgres.server.port": "Port", "arc.postgres.server.engine.version": "Engine Version", @@ -214,6 +217,12 @@ "arc.postgres.server.memory.request.description": "The memory request of the Postgres instance on the coordinator node in GB.", "arc.postgres.server.memory.limit.label": "Memory limit (GB)", "arc.postgres.server.memory.limit.description": "The memory limit of the Postgres instance on the coordinator node in GB.", + "arc.postgres.server.username": "Admin username", + "arc.postgres.server.username.placeholder": "Enter server admin login name", + "arc.postgres.server.invalid.username": "That username is disabled; please choose another username.", + "arc.postgres.server.service.type": "Service type", + "arc.postgres.server.dev.use.label": "For development use only", + "arc.postgres.server.dev.use.description": "Check the box to indicate this instance will be used for development or testing purposes only. This instance will not be billed.", "arc.agreement": "I accept {0} and {1}.", "arc.agreement.sql.terms.conditions": "Azure SQL managed instance - Azure Arc terms and conditions", "arc.agreement.postgres.terms.conditions": "PostgreSQL Server - Azure Arc terms and conditions", diff --git a/extensions/arc/src/ui/dashboards/postgres/postgresConnectionStringsPage.ts b/extensions/arc/src/ui/dashboards/postgres/postgresConnectionStringsPage.ts index a207b78caa..e2ba85eec5 100644 --- a/extensions/arc/src/ui/dashboards/postgres/postgresConnectionStringsPage.ts +++ b/extensions/arc/src/ui/dashboards/postgres/postgresConnectionStringsPage.ts @@ -83,14 +83,14 @@ export class PostgresConnectionStringsPage extends DashboardPage { } return [ - new InputKeyValue(this.modelView.modelBuilder, 'ADO.NET', `Server=${endpoint.ip};Database=postgres;Port=${endpoint.port};User Id=postgres;Password={your_password_here};Ssl Mode=Require;`), - new InputKeyValue(this.modelView.modelBuilder, 'C++ (libpq)', `host=${endpoint.ip} port=${endpoint.port} dbname=postgres user=postgres password={your_password_here} sslmode=require`), - new InputKeyValue(this.modelView.modelBuilder, 'JDBC', `jdbc:postgresql://${endpoint.ip}:${endpoint.port}/postgres?user=postgres&password={your_password_here}&sslmode=require`), - new InputKeyValue(this.modelView.modelBuilder, 'Node.js', `host=${endpoint.ip} port=${endpoint.port} dbname=postgres user=postgres password={your_password_here} sslmode=require`), - new InputKeyValue(this.modelView.modelBuilder, 'PHP', `host=${endpoint.ip} port=${endpoint.port} dbname=postgres user=postgres password={your_password_here} sslmode=require`), - new InputKeyValue(this.modelView.modelBuilder, 'psql', `psql "host=${endpoint.ip} port=${endpoint.port} dbname=postgres user=postgres password={your_password_here} sslmode=require"`), - new InputKeyValue(this.modelView.modelBuilder, 'Python', `dbname='postgres' user='postgres' host='${endpoint.ip}' password='{your_password_here}' port='${endpoint.port}' sslmode='true'`), - new InputKeyValue(this.modelView.modelBuilder, 'Ruby', `host=${endpoint.ip}; dbname=postgres user=postgres password={your_password_here} port=${endpoint.port} sslmode=require`) + new InputKeyValue(this.modelView.modelBuilder, 'ADO.NET', `Server=${endpoint.ip};Database=postgres;Port=${endpoint.port};User Id={your_username_here};Password={your_password_here};Ssl Mode=Require;`), + new InputKeyValue(this.modelView.modelBuilder, 'C++ (libpq)', `host=${endpoint.ip} port=${endpoint.port} dbname=postgres user={your_username_here} password={your_password_here} sslmode=require`), + new InputKeyValue(this.modelView.modelBuilder, 'JDBC', `jdbc:postgresql://${endpoint.ip}:${endpoint.port}/postgres?user={your_username_here}&password={your_password_here}&sslmode=require`), + new InputKeyValue(this.modelView.modelBuilder, 'Node.js', `host=${endpoint.ip} port=${endpoint.port} dbname=postgres user={your_username_here} password={your_password_here} sslmode=require`), + new InputKeyValue(this.modelView.modelBuilder, 'PHP', `host=${endpoint.ip} port=${endpoint.port} dbname=postgres user={your_username_here} password={your_password_here} sslmode=require`), + new InputKeyValue(this.modelView.modelBuilder, 'psql', `psql "host=${endpoint.ip} port=${endpoint.port} dbname=postgres user={your_username_here} password={your_password_here} sslmode=require"`), + new InputKeyValue(this.modelView.modelBuilder, 'Python', `dbname='postgres' user='{your_username_here}' host='${endpoint.ip}' password='{your_password_here}' port='${endpoint.port}' sslmode='true'`), + new InputKeyValue(this.modelView.modelBuilder, 'Ruby', `host=${endpoint.ip}; dbname=postgres user={your_username_here} password={your_password_here} port=${endpoint.port} sslmode=require`) ]; } diff --git a/extensions/azcli/package.json b/extensions/azcli/package.json index 3b16f70762..2fd5ce1ee5 100644 --- a/extensions/azcli/package.json +++ b/extensions/azcli/package.json @@ -2,7 +2,7 @@ "name": "azcli", "displayName": "%azcli.arc.displayName%", "description": "%azcli.arc.description%", - "version": "1.5.2", + "version": "1.5.3", "publisher": "Microsoft", "license": "https://raw.githubusercontent.com/Microsoft/azuredatastudio/main/LICENSE.txt", "icon": "images/extension.png",