Граф коммитов

100 Коммитов

Автор SHA1 Сообщение Дата
bennerv 07c22dbdec Clean up unused contexts 2024-10-23 09:08:19 -04:00
Kipp Morris e3cec21b73
Lay groundwork for cluster MSI usage (#3757)
* Add a parameter for enabling Entra ID RBAC on key vaults
* Add an RP-level feature flag for determining whether to use the mock MSI RP
* Tweak the mock identity URL to play nicely with the mock MSI RP
* Add Azure SDK client wrappers for new clients (federated identity credentials control plane and key vault data plane)
* Vendor in new Azure SDK clients and update msi-dataplane

* Lay groundwork for use of cluster MSI...
- Initialize the MSI dataplane client, using the mock MSI RP/stub if
  appropriate
- Initialize key vault store client (for MSI certificates; functionality
  is implemented in MSI dataplane module)
- Create a cluster MSI certificate and store it in the key vault during
  cluster bootstrap
- Instantiate an Azure SDK FederatedIdentityCredential client using the
  cluster MSI certificate
- Delete the cluster MSI certificate as needed during cluster deletion

* Don't fail during cluster deletion if the cluster MSI certificate is
already gone from the key vault (or was potentially never created)

* Establish an RP-Config variable for the MSI RP endpoint

- Update doc comment for ensureClusterMsiCertificate
- Simplify conditional logic in MSI cert deletion

* Use pointer conversion functions that aren't deprecated

* Respond to PR comments (and fix some other things along the way)

- Move `clusterMsiResourceId` function to `OpenShiftCluster` type
- When persisting the MSI cert to KV, use the `NotAfter` returned by the MSI RP (for the stub, just use an arbitrary value)
- Move `getClientOptions` functionality to `AROEnvironment` type
- Move logic for determining cluster MSI key vault name to `pkg/env`
- Pull cloud name mapping stuff out to `AROEnvironment` type
- Update msi-dataplane module to include new changes and use `UserAssignedIdentities` type to get Azure credential in `pkg/cluster/clustermsi.go`
- Fix typo in https URL in comment in `pkg/cluster/delete.go`
- Implement suggestion to use `errors.As` instead of a type assertion in `pkg/cluster/delete.go`

* Update documentation with info about new feature flag

- Move new cluster MSI steps forward in bootstrap step order
- Move MSI dataplane client options stuff to pkg/env
- Explicitly check for a single cluster MSI in `ClusterMsiResourceId`
- Other small tweaks

* Vendor in msi-dataplane update that prevents a potential nil pointer dereference

* Add missing method to internal key vault client

* Make error messages more specific in ClusterMsiResourceId

* Add missing env vars to run-rp make target and uncomment dynamic validation bootstrap step

- In newly added Azure clients, return struct types instead of interface
  types
- Move cluster MSI certificate deletion to be after Azure resource
  deletion for safety just in case cx continues to use cluster that is
  in Failed/Deleting provisioning state

* Add new env vars for MIWI to env.example for clarity/completeness

* Turn check for nonzero number of user assigned identities into a utility function

* Use existing constant for key vault dns suffix
2024-09-24 08:14:56 -04:00
Rajdeep Chauhan 66f073f205
Dynamic validation for workload identity permissions and requirements (#3619)
* ARO-4376 Track2 authorization api addition for roledefinitions

* ARO-4376 add a stringutil funcs

* ARO-4376 use dbPlatformWorkloadIdentityRoleSets to get platform identity roles for cluster version

* ARO-4376 add dynamic validation for platformworkloadidentityprofile

* ARO-4376 resolve initial comments

* ARO-4376 refactor error messages and checkaccess action crosscheck

* ARO-4376 Add unit tests and comments resolution

* ARO-4376 add validation for upgradeableTo

* ARO-4376 Comment resoultion and additional unit tests

* ARO-4376 minor version comparison handling

* ARO-4376 update permission error messaging handling for MIWI

* ARO-4376 update constructors to return non-interface type

* ARO-4376 add unit tests for GroupsIntersect

* ARO-4376 update generate files to support bingo
2024-09-10 16:32:25 -04:00
Rajdeep Chauhan a16e7e8799
ARO-4373 fix oidcstorageaccount var validation (#3743) 2024-07-31 13:01:39 -04:00
Amber Brown f1fbd0feb2
Try and get the NewMonitor/Frontend/etc mess under control (#3690)
* make a db wrapper

* add the other fields

* mechanical changes

* instantiate

* remove clustermanager code

* implement in portal too
2024-07-18 08:25:32 +10:00
Amber Brown 81f22cb8c8
Clean up some duplicated code in cmd/ (#3648)
* move some repeated code into pkg/util/service/

* cleanups in cmd/aro

* update_ocp_versions does not need AEAD

* cache the authorisers rather than recreating them

* env mock updates

* move stuff around from review
2024-07-17 16:29:39 +10:00
Amber Brown 31af734103
[ARO-5368] Try and log the VM info + console log on failure (#3629)
Dumps the VM info + console logs on failure so that we don't need to run the Geneva Action or have the control plane still around to get it. Also refactors frontend and geneva action to make use of the same code path.
2024-07-15 16:32:23 +10:00
Rajdeep Singh Chauhan 42daa82815 ARO-4373 resolve comments and parameter fixes 2024-06-30 20:38:28 -04:00
Anshul Verma b8ed0da73f added scope to be of the database rather than the whole cosmosdb account 2024-06-11 22:24:46 +05:30
Anshul Verma ce4e04bd6e corrected the new database client methods for components. 2024-06-11 22:24:46 +05:30
Anshul Verma 8928e025b2 createUpdateTriggers were taking time. Reduced poll fequency time 2024-06-11 22:24:45 +05:30
Anshul Verma ca06e6de0f fixed usgov scope thing, also changed few things. 2024-06-11 22:24:45 +05:30
Anshul Verma 49f572ae6e removed generate issues 2024-06-11 22:24:45 +05:30
Kipp Morris 31c72522fe
MIWI API endpoints (#3608)
* Add Cosmos DB container for PlatformWorkloadIdentityRoleSets

* Revert change to AKS k8s version - committed by mistake

* Fix bug in converter

When I first wrote the converter, I thought Go would treat the the slice
we `make` few lines above these changes as a slice full of zero-value
structs, but it actually treats it as an empty slice, which led to
out-of-bound issues when I first tried to use this converter to work on
the API endpoints.

* Add the PlatformWorkloadIdentityRoleSetConverter to the API register

* Implement the change feed for role sets in the easiest, most naive way

* Implement the external API endpoint for listing role sets

* Fix a small oversight from earlier on

* Add unit tests for the list endpoint

* Add unit tests for changefeed changes

* Uncomment the static validator

* Fix more slice out of bounds bugs in the converters...

* Add converter and static validator to the admin API register

* Add list and put endpoints

* Fix name of function to match convention

* Fix bug in static validator

I originally wrote the code the way I did so that we could aggregate
errors so that we could provide a better UX in cases where there are
multiple similar errors in the request content. I found while writing
unit tests that aggregating the errors in this way and not wrapping them
in a CloudError causes the RP to return an internal server error instead
of a 400 bad request.

Is there a way we can aggregate the errors and still wrap them in a
CloudError? I'm not sure of the formatting requirements for the text of
CloudErrors.

* Add unit tests for new API endpoints

* Fix typo

* Appease the linter

* Appease the linter

* Add TODO comment re: the number of parameters

* Update static validator to return multiple validation issues at the same time where applicable for better UX

* Add a simple utility function to make semver comparisons of OpenShift minor version more readable

* Log error before returning 500 to user

* Log errors before returning 500 to user

* Improve naming of unit test cases

* Add additional unit test cases
2024-06-06 10:15:44 -04:00
Maitiú Ó Ciaráin 07672dde9c
Switch to using the secondary key (#3427)
* Switch to using the secondary key

* Documentation update

* Log the name of the key used

* Pass log arg through

* Fix import ordering

* Shorten line
2024-03-21 11:28:58 -04:00
Kipp Morris 8ee1b531ef
2024-08-12-preview API skeleton (#3419) 2024-02-29 12:37:28 -05:00
Jory Horeman 3abcd30e5b
2023-11-22 stable API (porting 07-01-preview api) (#3300)
* adding 2023-11-22 stable

---------

Co-authored-by: b-jhoreman <b-jhoreman@microsoft.com>
2024-01-18 14:15:38 -07:00
Matthew Barnes 809041fe2e
Move default openshift version (#3094)
* api: Avoid referencing DefaultInstallStream in tests

* frontend: Avoid referencing DefaultInstallStream

The frontend's OpenShiftVersions change feed handler will record
the current default version for the rest of the frontend to use.

* monitor: Remove latestGaMinorVersion metric

The RP no longer has this information internally, so the metric
is no longer relevant.

* update_ocp_versions: Read versions from an environment variable

Read OpenShift versions and pull specs from an OPENSHIFT_VERSIONS
environment variable containing a JSON object. This data includes
the default OpenShift version for new installs that don't specify
a version.

This moves us toward eliminating hard-coded OpenShift versions in
pkg/util/version/const.go.

* cache_fallback_discovery_client_test.go: Hard-code version

I'm not sure what to do with this test.  Install stream data has
moved to RP-Config, so if the test is worth keeping then I guess
the oldest supported version will have to be hard-coded and kept
up-to-date.  But it probably won't be.

* version: Remove DefaultInstallStreams

DefaultInstallStream will remain for now, but it's ONLY for use by
local development mode until we can come up with a better solution.

---------

Co-authored-by: Matthew Barnes <mbarnes@fedorapeople.org>
2024-01-18 13:20:03 -07:00
Amber Brown b4e8930830
Make env know what the service component its running is (#3254)
* make env know what the service component its running is

* regen mocks
2024-01-17 15:17:14 +11:00
Nont e7f514086d
Migrate documentdb client from sdk track 1 to track 2 client (#3255)
* Create documentdb track 2 client and mockgen

* Replace track 1 documentdb with track 2

* Refactor per comments

* Delete unused client

* Fix generated env mocks
2023-11-17 15:34:17 -05:00
Nicolas Ontiveros 01cf99f1ca
Unplanned Maintenance Signals (#3060)
Co-authored-by: Nicolas Ontiveros <nicolas.ontiveros@microsoft.com>
2023-08-25 13:17:19 -04:00
Goutham Muguluvalli Niranjan f9ee191ad8
skeleton for 20230904 (#3048)
* skeleton for 20230904

* Update .sha256sum

---------

Co-authored-by: gniranjan <gniranjan@microsoft.com>
2023-07-21 12:16:46 -04:00
Tony Schneider bcd60e807f
initial scaffolding for preview api (#2972) 2023-06-20 18:56:30 -04:00
Aldo Fuster Turpin a3b9613323
Refactor/env vars access (#2693)
Limits the dependency between packages to make the code more readable
2023-06-01 14:10:36 +02:00
Jeremy Facchetti b3b047e9f9
improved naming (#2828) 2023-04-12 12:41:14 +02:00
Matthew Barnes 176a7c9fbe azureclient: Add scope members to AROEnvironment
Scope strings should mostly go away once the RP code is fully
migrated to the newer TokenCredential-based Azure SDK, but this
was requested by multiple peer-reviewers.
2023-04-11 16:32:49 -04:00
Matthew Barnes 4d264806a2 pkg/env: Port to azidentity 2023-04-11 16:32:49 -04:00
Jeremy Facchetti 5c5a96fc40
enrichers redesign (#2402)
redesigned enrichers for better understandability
2023-04-05 15:30:24 +02:00
Carlo Wisse d536465e5d New API skeleton for v20230401 & make generate output 2023-02-22 16:35:08 -05:00
Spencer Amann cd1329ab47 directly injects hive.ClusterManager to the frontend
adds basic e2e test for new admin api
2023-02-14 15:21:54 -05:00
Spencer Amann fb271d81d8 implements geneva action to retrieve clusterdeployment cr
- frontend creates hive.ClusterManager via on-demand factory
2023-02-14 15:21:54 -05:00
Amber Brown 2876a8e64c
Revert "Database tests are placed in tests/database." (#2629)
This reverts commit 39326bca8c.
2023-01-12 16:40:19 +11:00
Steven Fairchild 39326bca8c Database tests are placed in tests/database.
httptest is used to send http responses.
Add Mock for databaseaccounts.
Add DatabaseClient, MasterKeyClient interfaces to allow for mock testing.
Add unit tests for subscriptions.
Add billing unit tests.
Add default http.Client to database.go, update references to use DatabaseClient interface. This will keep from importing "net/http" in every package calling it and allow easy changing within database if needed."
Add unit tests for clustermanager in database package
Add asyncoperations unit tests.
Add monitor tests.
Add gateway unit tests.
Add openshiftversions tests.
Add portal tests.
Add openshiftclusters tests.

Tests for billing and subscriptions are placed in test/database to reuse
fake testing code due without import cycling.
2022-12-16 13:03:07 -05:00
Ross Bryan 2d076a8242 create clustermanager api definitions, wire up cosmosdb 2022-09-14 09:57:29 -04:00
darthhexx 1f678c3b87 M6: enable install-version selection for Hive adoption and installs 2022-09-05 12:08:56 +10:00
Amber Brown 115421ffd2 add the openshiftversions to the frontend 2022-08-25 13:31:19 +10:00
Ross Bryan 95d192c35f create new api version, make client 2022-07-05 17:40:36 -04:00
Ulrich Schlueter 5bb1018ad4
Add an option to send metrics via UDP instead of Unix Domain Sockets (#2074) 2022-05-31 11:08:55 +01:00
Peter Kostyukov 49ed232c76
Create 2022-04-01 API (#1876) 2022-04-05 15:34:54 +02:00
Jim Minter 9b3c4383a4 add encryption.multi 2021-09-10 11:26:20 -04:00
Jim Minter 6aecbe085a add GetBase64Secrets 2021-09-10 11:26:20 -04:00
Petr Kotas b8c064bc1a Extract certificateRefresher timer out
enables ticker mocking by extracting the timer out of the refresher.
with extracted timer, mock is added int he tests, enabling exact steps
as required per test.

Signed-off-by: Petr Kotas <pkotas@redhat.com>
2021-08-26 11:23:01 +01:00
Jim Minter fcc0db8cf0 forward Go prometheus metrics to MDM 2021-08-19 10:36:45 -04:00
Jim Minter ed319c139b update rp 2021-08-19 10:30:29 -04:00
Petr Kotas 72b26b18ca Add CertificateRefresher
Wraps around KeyvaultManager.GetCertificateSecret and
acts and simple poller. Refreshes certificates in regular
intervals, when error happens, it is logged and old
certificate is preserved.

If certificate is already rotated azure-wise the RP will
fail to authenticate, and there will be mention in the logs
about the error.

Signed-off-by: Petr Kotas <pkotas@redhat.com>
2021-07-20 06:30:49 -07:00
Mangirdas Judeikis 6ba3d3b1bd
rename 20210131 -> 20210901 2021-07-20 12:15:25 +01:00
Jim Minter 7dde80a432 remove NewMSIAuthorizer call from pkg/database 2021-05-11 11:48:19 -04:00
Jim Minter 31fbebea89
update NewDatabaseClient to new go-cosmosdb API 2021-04-26 13:56:49 -05:00
Jim Minter 81229ae196
for clarity, rename IsDevelopmentMode -> IsLocalDevelopmentMode 2021-04-23 10:25:46 -05:00
Jim Minter 10554999eb
remove pkg/util/deployment and revert to isDevelopment bool 2021-04-08 09:12:13 -05:00