Skip to content

Commit

Permalink
Merge branch 'main' into CLOUDP-188104/deployment-resource-tagging
Browse files Browse the repository at this point in the history
  • Loading branch information
cveticm authored Aug 10, 2023
2 parents 05aa2d3 + 7b4825e commit 0ca9968
Show file tree
Hide file tree
Showing 38 changed files with 3,979 additions and 277 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/test-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,8 @@ jobs:
"custom-roles",
"teams",
"backup-config",
"data-federation"
"data-federation",
"deletion-protection"
]
steps:
- name: Get repo files from cache
Expand Down Expand Up @@ -229,6 +230,7 @@ jobs:
AZURE_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
GCP_SA_CRED: ${{ secrets.GCP_SA_CRED_NEW_TEST }}
DATADOG_KEY: ${{ secrets.DATADOG_KEY }}
PAGER_DUTY_SERVICE_KEY: ${{ secrets.PAGER_DUTY_SERVICE_KEY }}
run: |
helm version
go version
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ run: generate fmt vet manifests ## Run against the configured Kubernetes cluster
OPERATOR_POD_NAME=$(OPERATOR_POD_NAME) \
OPERATOR_NAMESPACE=$(OPERATOR_NAMESPACE) \
go run ./cmd/manager/main.go --atlas-domain=$(ATLAS_DOMAIN) \
--global-api-secret-name=$(ATLAS_KEY_SECRET_NAME)
--global-api-secret-name=$(ATLAS_KEY_SECRET_NAME) --log-level=debug

.PHONY: install
install: manifests kustomize ## Install CRDs from a cluster
Expand Down
20 changes: 10 additions & 10 deletions cmd/manager/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,6 @@ import (
)

const (
objectDeletionProtectionFlag = "object-deletion-protection"
subobjectDeletionProtectionFlag = "subobject-deletion-protection"
objectDeletionProtectionDefault = false
subobjectDeletionProtectionDefault = false

Expand Down Expand Up @@ -136,14 +134,16 @@ func main() {
}

if err = (&atlasdeployment.AtlasDeploymentReconciler{
Client: mgr.GetClient(),
Log: logger.Named("controllers").Named("AtlasDeployment").Sugar(),
Scheme: mgr.GetScheme(),
AtlasDomain: config.AtlasDomain,
GlobalAPISecret: config.GlobalAPISecret,
ResourceWatcher: watch.NewResourceWatcher(),
GlobalPredicates: globalPredicates,
EventRecorder: mgr.GetEventRecorderFor("AtlasDeployment"),
Client: mgr.GetClient(),
Log: logger.Named("controllers").Named("AtlasDeployment").Sugar(),
Scheme: mgr.GetScheme(),
AtlasDomain: config.AtlasDomain,
GlobalAPISecret: config.GlobalAPISecret,
ResourceWatcher: watch.NewResourceWatcher(),
GlobalPredicates: globalPredicates,
EventRecorder: mgr.GetEventRecorderFor("AtlasDeployment"),
ObjectDeletionProtection: config.ObjectDeletionProtection,
SubObjectDeletionProtection: config.SubObjectDeletionProtection,
}).SetupWithManager(mgr); err != nil {
setupLog.Error(err, "unable to create controller", "controller", "AtlasDeployment")
os.Exit(1)
Expand Down
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ require (
github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 // indirect
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1.1.1 // indirect
github.com/AzureAD/microsoft-authentication-library-for-go v1.0.0 // indirect
github.com/benbjohnson/clock v1.3.0 // indirect
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 // indirect
github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1 // indirect
github.com/google/s2a-go v0.1.4 // indirect
Expand Down
1 change: 1 addition & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ github.com/aws/aws-sdk-go v1.44.318 h1:Yl66rpbQHFUbxe9JBKLcvOvRivhVgP6+zH0b9KzAR
github.com/aws/aws-sdk-go v1.44.318/go.mod h1:aVsgQcEevwlmQ7qHE9I3h+dtQgpqhFB+i8Phjh7fkwI=
github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA=
github.com/benbjohnson/clock v1.3.0 h1:ip6w0uFQkncKQ979AypyG0ER7mqUSBdKLOgAle/AT8A=
github.com/benbjohnson/clock v1.3.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA=
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
Expand Down
7 changes: 7 additions & 0 deletions pkg/api/v1/atlasdeployment_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,13 @@ func (s *ServerlessSpec) ServerlessToAtlas() (*mongodbatlas.Cluster, error) {
return result, err
}

// ToAtlas converts the ServerlessSpec to native Atlas client Cluster format.
func (s *ServerlessSpec) ToAtlas() (*mongodbatlas.Cluster, error) {
result := &mongodbatlas.Cluster{}
err := compat.JSONCopy(result, s)
return result, err
}

// BiConnector specifies BI Connector for Atlas configuration on this deployment.
type BiConnector struct {
Enabled *bool `json:"enabled,omitempty"`
Expand Down
3 changes: 1 addition & 2 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.

7 changes: 7 additions & 0 deletions pkg/controller/atlas/api_error.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@ const (
// Error indicates that the cluster doesn't exist
ClusterNotFound = "CLUSTER_NOT_FOUND"

// ServerlessClusterNotFound indicates that the serverless cluster doesn't exist
ServerlessInstanceNotFound = "SERVERLESS_INSTANCE_NOT_FOUND"

// ServerlessClusterFromClusterAPI indicates that we are trying to access
// a serverless instance from the cluster API, which is not allowed
ServerlessInstanceFromClusterAPI = "CANNOT_USE_SERVERLESS_INSTANCE_IN_CLUSTER_API"

// Resource not found
ResourceNotFound = "RESOURCE_NOT_FOUND"
)
Loading

0 comments on commit 0ca9968

Please sign in to comment.