Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CLOUDP-208446: Rename Cloud Provider Access to Cloud Provider Integration #1230

Merged
merged 2 commits into from
Dec 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 27 additions & 4 deletions config/crd/bases/atlas.mongodb.com_atlasprojects.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -305,9 +305,32 @@ spec:
type: boolean
type: object
cloudProviderAccessRoles:
description: CloudProviderAccessRoles is a list of Cloud Provider
Access Roles configured for the current Project.
description: 'CloudProviderAccessRoles is a list of Cloud Provider
Access Roles configured for the current Project. Deprecated: This
configuration was deprecated in favor of CloudProviderIntegrations'
items:
description: 'CloudProviderAccessRole define an integration to a
cloud provider Deprecated: This type is deprecated in favor of
CloudProviderIntegration'
properties:
iamAssumedRoleArn:
description: IamAssumedRoleArn is the ARN of the IAM role that
is assumed by the Atlas cluster.
type: string
providerName:
description: ProviderName is the name of the cloud provider.
Currently only AWS is supported.
type: string
required:
- providerName
type: object
type: array
cloudProviderIntegrations:
description: CloudProviderIntegrations is a list of Cloud Provider
Integration configured for the current Project.
items:
description: CloudProviderIntegration define an integration to a
cloud provider
properties:
iamAssumedRoleArn:
description: IamAssumedRoleArn is the ARN of the IAM role that
Expand Down Expand Up @@ -1210,8 +1233,8 @@ spec:
items:
type: string
type: array
cloudProviderAccessRoles:
description: CloudProviderAccessRoles contains a list of configured
cloudProviderIntegrations:
description: CloudProviderIntegrations contains a list of configured
cloud provider access roles. AWS support only
items:
properties:
Expand Down
5 changes: 5 additions & 0 deletions pkg/api/v1/atlasproject_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,14 @@ type AtlasProjectSpec struct {

// PrivateEndpoints is a list of Private Endpoints configured for the current Project.
PrivateEndpoints []PrivateEndpoint `json:"privateEndpoints,omitempty"`

// CloudProviderAccessRoles is a list of Cloud Provider Access Roles configured for the current Project.
// Deprecated: This configuration was deprecated in favor of CloudProviderIntegrations
CloudProviderAccessRoles []CloudProviderAccessRole `json:"cloudProviderAccessRoles,omitempty"`

// CloudProviderIntegrations is a list of Cloud Provider Integration configured for the current Project.
CloudProviderIntegrations []CloudProviderIntegration `json:"cloudProviderIntegrations,omitempty"`

// AlertConfiguration is a list of Alert Configurations configured for the current Project.
AlertConfigurations []AlertConfiguration `json:"alertConfigurations,omitempty"`

Expand Down
9 changes: 0 additions & 9 deletions pkg/api/v1/cloud_provider_access.go

This file was deleted.

20 changes: 20 additions & 0 deletions pkg/api/v1/cloud_provider_integration.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package v1

// CloudProviderIntegration define an integration to a cloud provider
type CloudProviderIntegration struct {
// ProviderName is the name of the cloud provider. Currently only AWS is supported.
ProviderName string `json:"providerName"`
helderjs marked this conversation as resolved.
Show resolved Hide resolved
// IamAssumedRoleArn is the ARN of the IAM role that is assumed by the Atlas cluster.
// +optional
IamAssumedRoleArn string `json:"iamAssumedRoleArn"`
}

// CloudProviderAccessRole define an integration to a cloud provider
// Deprecated: This type is deprecated in favor of CloudProviderIntegration
type CloudProviderAccessRole struct {
// ProviderName is the name of the cloud provider. Currently only AWS is supported.
ProviderName string `json:"providerName"`
// IamAssumedRoleArn is the ARN of the IAM role that is assumed by the Atlas cluster.
// +optional
IamAssumedRoleArn string `json:"iamAssumedRoleArn"`
}
8 changes: 4 additions & 4 deletions pkg/api/v1/status/atlasproject.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ func AtlasProjectSetAlertConfigOption(alertConfigs *[]AlertConfiguration) AtlasP
}
}

func AtlasProjectCloudAccessRolesOption(cloudAccessRoles []CloudProviderAccessRole) AtlasProjectStatusOption {
func AtlasProjectCloudIntegrationsOption(cloudIntegrations []CloudProviderIntegration) AtlasProjectStatusOption {
return func(s *AtlasProjectStatus) {
s.CloudProviderAccessRoles = cloudAccessRoles
s.CloudProviderIntegrations = cloudIntegrations
}
}

Expand Down Expand Up @@ -108,8 +108,8 @@ type AtlasProjectStatus struct {
// AlertConfigurations contains a list of alert configuration statuses
AlertConfigurations []AlertConfiguration `json:"alertConfigurations,omitempty"`

// CloudProviderAccessRoles contains a list of configured cloud provider access roles. AWS support only
CloudProviderAccessRoles []CloudProviderAccessRole `json:"cloudProviderAccessRoles,omitempty"`
// CloudProviderIntegrations contains a list of configured cloud provider access roles. AWS support only
CloudProviderIntegrations []CloudProviderIntegration `json:"cloudProviderIntegrations,omitempty"`

// CustomRoles contains a list of custom roles statuses
CustomRoles []CustomRole `json:"customRoles,omitempty"`
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package status

type CloudProviderAccessRole struct {
type CloudProviderIntegration struct {
AtlasAWSAccountArn string `json:"atlasAWSAccountArn,omitempty"`
AtlasAssumedRoleExternalID string `json:"atlasAssumedRoleExternalId"`
AuthorizedDate string `json:"authorizedDate,omitempty"`
Expand All @@ -19,24 +19,22 @@ type FeatureUsage struct {
}

const (
CloudProviderAccessStatusNew = "NEW"
CloudProviderAccessStatusCreated = "CREATED"
CloudProviderAccessStatusAuthorized = "AUTHORIZED"
CloudProviderAccessStatusDeAuthorize = "DEAUTHORIZE"
CloudProviderAccessStatusFailedToCreate = "FAILED_TO_CREATE"
CloudProviderAccessStatusFailedToAuthorize = "FAILED_TO_AUTHORIZE"
CloudProviderAccessStatusFailedToDeAuthorize = "FAILED_TO_DEAUTHORIZE"
CloudProviderIntegrationStatusNew = "NEW"
CloudProviderIntegrationStatusCreated = "CREATED"
CloudProviderIntegrationStatusAuthorized = "AUTHORIZED"
CloudProviderIntegrationStatusDeAuthorize = "DEAUTHORIZE"
CloudProviderIntegrationStatusFailedToCreate = "FAILED_TO_CREATE"
CloudProviderIntegrationStatusFailedToAuthorize = "FAILED_TO_AUTHORIZE"
CloudProviderIntegrationStatusFailedToDeAuthorize = "FAILED_TO_DEAUTHORIZE"

StatusFailed = "FAILED"
StatusCreated = "CREATED"
StatusReady = "READY"
StatusEmptyARN = "EMPTY_ARN"
StatusFailed = "FAILED"
StatusReady = "READY"
)

func NewCloudProviderAccessRole(providerName, assumedRoleArn string) CloudProviderAccessRole {
return CloudProviderAccessRole{
func NewCloudProviderIntegration(providerName, assumedRoleArn string) CloudProviderIntegration {
return CloudProviderIntegration{
ProviderName: providerName,
IamAssumedRoleArn: assumedRoleArn,
Status: CloudProviderAccessStatusNew,
Status: CloudProviderIntegrationStatusNew,
}
}
28 changes: 14 additions & 14 deletions pkg/api/v1/status/condition.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,20 +34,20 @@ const (

// AtlasProject condition types
const (
ProjectReadyType ConditionType = "ProjectReady"
IPAccessListReadyType ConditionType = "IPAccessListReady"
MaintenanceWindowReadyType ConditionType = "MaintenanceWindowReady"
PrivateEndpointServiceReadyType ConditionType = "PrivateEndpointServiceReady"
PrivateEndpointReadyType ConditionType = "PrivateEndpointReady"
NetworkPeerReadyType ConditionType = "NetworkPeerReady"
CloudProviderAccessReadyType ConditionType = "CloudProviderAccessReady"
IntegrationReadyType ConditionType = "ThirdPartyIntegrationReady"
AlertConfigurationReadyType ConditionType = "AlertConfigurationReady"
EncryptionAtRestReadyType ConditionType = "EncryptionAtRestReady"
AuditingReadyType ConditionType = "AuditingReady"
ProjectSettingsReadyType ConditionType = "ProjectSettingsReady"
ProjectCustomRolesReadyType ConditionType = "ProjectCustomRolesReady"
ProjectTeamsReadyType ConditionType = "ProjectTeamsReady"
ProjectReadyType ConditionType = "ProjectReady"
IPAccessListReadyType ConditionType = "IPAccessListReady"
MaintenanceWindowReadyType ConditionType = "MaintenanceWindowReady"
PrivateEndpointServiceReadyType ConditionType = "PrivateEndpointServiceReady"
PrivateEndpointReadyType ConditionType = "PrivateEndpointReady"
NetworkPeerReadyType ConditionType = "NetworkPeerReady"
CloudProviderIntegrationReadyType ConditionType = "CloudProviderIntegrationReady"
IntegrationReadyType ConditionType = "ThirdPartyIntegrationReady"
AlertConfigurationReadyType ConditionType = "AlertConfigurationReady"
EncryptionAtRestReadyType ConditionType = "EncryptionAtRestReady"
AuditingReadyType ConditionType = "AuditingReady"
ProjectSettingsReadyType ConditionType = "ProjectSettingsReady"
ProjectCustomRolesReadyType ConditionType = "ProjectCustomRolesReady"
ProjectTeamsReadyType ConditionType = "ProjectTeamsReady"
)

// AtlasDeployment condition types
Expand Down
14 changes: 7 additions & 7 deletions pkg/api/v1/status/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 20 additions & 0 deletions pkg/api/v1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions pkg/controller/atlasproject/atlasproject_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -296,8 +296,8 @@ func (r *AtlasProjectReconciler) ensureProjectResources(workflowCtx *workflow.Co
}
results = append(results, result)

if result = ensureProviderAccessStatus(workflowCtx, project, r.SubObjectDeletionProtection); result.IsOk() {
r.EventRecorder.Event(project, "Normal", string(status.CloudProviderAccessReadyType), "")
if result = ensureCloudProviderIntegration(workflowCtx, project, r.SubObjectDeletionProtection); result.IsOk() {
r.EventRecorder.Event(project, "Normal", string(status.CloudProviderIntegrationReadyType), "")
}
results = append(results, result)

Expand Down
Loading
Loading