From f669b284b5f3ed9bd0eb2a012e4f4807e70cb07a Mon Sep 17 00:00:00 2001 From: dgtown Date: Fri, 26 Jan 2024 17:00:09 -0500 Subject: [PATCH] add container insights and rbac to azure provisioning settings --- dashboard/package-lock.json | 14 ++++---- dashboard/package.json | 2 +- .../components/AzureProvisionerSettings.tsx | 33 +++++++++++++++++++ go.mod | 2 +- go.sum | 2 ++ 5 files changed, 44 insertions(+), 9 deletions(-) diff --git a/dashboard/package-lock.json b/dashboard/package-lock.json index 442129018f..8ecbb048f8 100644 --- a/dashboard/package-lock.json +++ b/dashboard/package-lock.json @@ -95,7 +95,7 @@ "@babel/preset-typescript": "^7.15.0", "@ianvs/prettier-plugin-sort-imports": "^4.1.1", "@pmmmwh/react-refresh-webpack-plugin": "^0.4.3", - "@porter-dev/api-contracts": "^0.2.84", + "@porter-dev/api-contracts": "^0.2.93", "@testing-library/jest-dom": "^4.2.4", "@testing-library/react": "^9.3.2", "@testing-library/user-event": "^7.1.2", @@ -2754,9 +2754,9 @@ } }, "node_modules/@porter-dev/api-contracts": { - "version": "0.2.84", - "resolved": "https://registry.npmjs.org/@porter-dev/api-contracts/-/api-contracts-0.2.84.tgz", - "integrity": "sha512-KNwaVBLkW95LQSxkxs+mwtJp8MIArS0X9ZODpVPjW/ZPjQ+PvCWoOsyNShoyOp2YrzaByKcXBDeKCsT2ZCgdCw==", + "version": "0.2.93", + "resolved": "https://registry.npmjs.org/@porter-dev/api-contracts/-/api-contracts-0.2.93.tgz", + "integrity": "sha512-Q+oKoqJ9owvzsAZKMusM+36GN9jGSMcqn/aurQ2kHt85qbYmYYq+8UiXzE6PyJqkVwMPqSP+O0SWTnUMsto7Tg==", "dev": true, "dependencies": { "@bufbuild/protobuf": "^1.1.0" @@ -20056,9 +20056,9 @@ "integrity": "sha512-P1st0aksCrn9sGZhp8GMYwBnQsbvAWsZAX44oXNNvLHGqAOcoVxmjZiohstwQ7SqKnbR47akdNi+uleWD8+g6A==" }, "@porter-dev/api-contracts": { - "version": "0.2.84", - "resolved": "https://registry.npmjs.org/@porter-dev/api-contracts/-/api-contracts-0.2.84.tgz", - "integrity": "sha512-KNwaVBLkW95LQSxkxs+mwtJp8MIArS0X9ZODpVPjW/ZPjQ+PvCWoOsyNShoyOp2YrzaByKcXBDeKCsT2ZCgdCw==", + "version": "0.2.93", + "resolved": "https://registry.npmjs.org/@porter-dev/api-contracts/-/api-contracts-0.2.93.tgz", + "integrity": "sha512-Q+oKoqJ9owvzsAZKMusM+36GN9jGSMcqn/aurQ2kHt85qbYmYYq+8UiXzE6PyJqkVwMPqSP+O0SWTnUMsto7Tg==", "dev": true, "requires": { "@bufbuild/protobuf": "^1.1.0" diff --git a/dashboard/package.json b/dashboard/package.json index dba4c2b540..b431c8cbf1 100644 --- a/dashboard/package.json +++ b/dashboard/package.json @@ -102,7 +102,7 @@ "@babel/preset-typescript": "^7.15.0", "@ianvs/prettier-plugin-sort-imports": "^4.1.1", "@pmmmwh/react-refresh-webpack-plugin": "^0.4.3", - "@porter-dev/api-contracts": "^0.2.84", + "@porter-dev/api-contracts": "^0.2.93", "@testing-library/jest-dom": "^4.2.4", "@testing-library/react": "^9.3.2", "@testing-library/user-event": "^7.1.2", diff --git a/dashboard/src/components/AzureProvisionerSettings.tsx b/dashboard/src/components/AzureProvisionerSettings.tsx index 06fbf87ba2..337e54832b 100644 --- a/dashboard/src/components/AzureProvisionerSettings.tsx +++ b/dashboard/src/components/AzureProvisionerSettings.tsx @@ -31,6 +31,7 @@ import { } from "./azureUtils"; import InputRow from "./form-components/InputRow"; import Button from "./porter/Button"; +import Checkbox from "./porter/Checkbox"; import Error from "./porter/Error"; import Icon from "./porter/Icon"; import Link from "./porter/Link"; @@ -78,6 +79,9 @@ const AzureProvisionerSettings: React.FC = (props) => { const [clusterVersion, setClusterVersion] = useState("v1.27.3"); const [isReadOnly, setIsReadOnly] = useState(false); const [skuTier, setSkuTier] = useState(AksSkuTier.FREE); + const [rbacEnabled, setRbacEnabled] = useState(false); + const [containerInsightsEnabled, setContainerInsightsEnabled] = + useState(false); const [errorMessage, setErrorMessage] = useState(""); const [errorDetails, setErrorDetails] = useState(""); const [isClicked, setIsClicked] = useState(false); @@ -225,6 +229,8 @@ const AzureProvisionerSettings: React.FC = (props) => { }), ], skuTier, + enableRbac: rbacEnabled, + enableContainerInsights: containerInsightsEnabled, }), }, }), @@ -340,6 +346,8 @@ const AzureProvisionerSettings: React.FC = (props) => { if (aksValues.skuTier !== AksSkuTier.UNSPECIFIED) { setSkuTier(aksValues.skuTier); } + setRbacEnabled(aksValues.enableRbac); + setContainerInsightsEnabled(aksValues.enableContainerInsights); } }, [props.selectedClusterVersion]); @@ -437,6 +445,31 @@ const AzureProvisionerSettings: React.FC = (props) => { label="VPC CIDR range" placeholder="ex: 10.78.0.0/16" /> + { + setContainerInsightsEnabled(!containerInsightsEnabled); + }} + disabledTooltip={ + "Wait for provisioning to complete before editing this field." + } + > + Enable Azure Container Insights + + + { + setRbacEnabled(!rbacEnabled); + }} + disabledTooltip={ + "Wait for provisioning to complete before editing this field." + } + > + Enable Azure RBAC + )} diff --git a/go.mod b/go.mod index fd965937c8..c01dd1a6f1 100644 --- a/go.mod +++ b/go.mod @@ -83,7 +83,7 @@ require ( github.com/matryer/is v1.4.0 github.com/nats-io/nats.go v1.24.0 github.com/open-policy-agent/opa v0.44.0 - github.com/porter-dev/api-contracts v0.2.91 + github.com/porter-dev/api-contracts v0.2.93 github.com/riandyrn/otelchi v0.5.1 github.com/santhosh-tekuri/jsonschema/v5 v5.0.1 github.com/stefanmcshane/helm v0.0.0-20221213002717-88a4a2c6e77d diff --git a/go.sum b/go.sum index b5e0857978..560bd49ffe 100644 --- a/go.sum +++ b/go.sum @@ -1527,6 +1527,8 @@ github.com/porter-dev/api-contracts v0.2.90 h1:0ceIXz0xWNQpqVqhUMt3/RDeEawccfXx3 github.com/porter-dev/api-contracts v0.2.90/go.mod h1:fX6JmP5QuzxDLvqP3evFOTXjI4dHxsG0+VKNTjImZU8= github.com/porter-dev/api-contracts v0.2.91 h1:jiFWQ+WISAtfjXalOmWJdSr1ZOm7/ov+3ozrCeYA9Ws= github.com/porter-dev/api-contracts v0.2.91/go.mod h1:fX6JmP5QuzxDLvqP3evFOTXjI4dHxsG0+VKNTjImZU8= +github.com/porter-dev/api-contracts v0.2.93 h1:ui3x0CwDGtVCnjZaI6F4O+nnMLKMv1r1v4H6o5vM5iY= +github.com/porter-dev/api-contracts v0.2.93/go.mod h1:fX6JmP5QuzxDLvqP3evFOTXjI4dHxsG0+VKNTjImZU8= github.com/porter-dev/switchboard v0.0.3 h1:dBuYkiVLa5Ce7059d6qTe9a1C2XEORFEanhbtV92R+M= github.com/porter-dev/switchboard v0.0.3/go.mod h1:xSPzqSFMQ6OSbp42fhCi4AbGbQbsm6nRvOkrblFeXU4= github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI=