Skip to content

Commit 20fcacf

Browse files
CLOUDP-335193: Added organization settings CRD and controller (#2580)
Added AtlasOrgSettings feature
1 parent b3ddeea commit 20fcacf

37 files changed

+3869
-159
lines changed

.github/workflows/test-e2e.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ jobs:
109109
"dry-run",
110110
"networkcontainer-controller",
111111
"networkpeering-controller",
112+
"atlas-org-settings",
112113
]
113114
steps:
114115
- uses: actions/checkout@v5

.licenses-gomod.sha256

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
100644 83d67cc56911f2a9e16130ab20e4342dd308fca1 go.mod
1+
100644 2691da691dfa0e25e9338f3410b5b9db3db87f92 go.mod

PROJECT

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,4 +159,12 @@ resources:
159159
kind: AtlasThirdPartyIntegration
160160
path: github.com/mongodb/mongodb-atlas-kubernetes/v2/api/v1
161161
version: v1
162+
- api:
163+
crdVersion: v1
164+
namespaced: true
165+
domain: mongodb.com
166+
group: atlas
167+
kind: AtlasOrgSettings
168+
path: github.com/mongodb/mongodb-atlas-kubernetes/v2/api/v1
169+
version: v1
162170
version: "3"

api/v1/atlasorgsettings_types.go

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
// Copyright 2025 MongoDB Inc
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
package v1
16+
17+
import (
18+
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
19+
20+
"github.com/mongodb/mongodb-atlas-kubernetes/v2/api"
21+
"github.com/mongodb/mongodb-atlas-kubernetes/v2/api/v1/status"
22+
)
23+
24+
func init() {
25+
SchemeBuilder.Register(&AtlasOrgSettings{})
26+
SchemeBuilder.Register(&AtlasOrgSettingsList{})
27+
}
28+
29+
type AtlasOrgSettingsSpec struct {
30+
// OrgId Unique 24-hexadecimal digit string that identifies the organization that
31+
// contains your projects
32+
// +required
33+
OrgID string `json:"orgID"`
34+
35+
// ConnectionSecretRef is the name of the Kubernetes Secret which contains the information about the way to connect to
36+
// Atlas (Public & Private API keys).
37+
ConnectionSecretRef *api.LocalObjectReference `json:"connectionSecretRef,omitempty"`
38+
39+
// ApiAccessListRequired Flag that indicates whether to require API operations to
40+
// originate from an IP Address added to the API access list for the specified
41+
// organization.
42+
// +optional
43+
ApiAccessListRequired *bool `json:"apiAccessListRequired,omitempty"`
44+
45+
// GenAIFeaturesEnabled Flag that indicates whether this organization has access to
46+
// generative AI features. This setting only applies to Atlas Commercial and is
47+
// enabled by default. Once this setting is turned on, Project Owners may be able
48+
// to enable or disable individual AI features at the project level.
49+
// +optional
50+
GenAIFeaturesEnabled *bool `json:"genAIFeaturesEnabled,omitempty"`
51+
52+
// MaxServiceAccountSecretValidityInHours Number that represents the maximum period
53+
// before expiry in hours for new Atlas Admin API Service Account secrets within
54+
// the specified organization.
55+
// +optional
56+
MaxServiceAccountSecretValidityInHours *int `json:"maxServiceAccountSecretValidityInHours,omitempty"`
57+
58+
// MultiFactorAuthRequired Flag that indicates whether to require users to set up
59+
// Multi-Factor Authentication (MFA) before accessing the specified organization.
60+
// To learn more, see:
61+
// https://www.mongodb.com/docs/atlas/security-multi-factor-authentication/.
62+
// +optional
63+
MultiFactorAuthRequired *bool `json:"multiFactorAuthRequired,omitempty"`
64+
65+
// RestrictEmployeeAccess Flag that indicates whether to block MongoDB Support from
66+
// accessing Atlas infrastructure and cluster logs for any deployment in the
67+
// specified organization without explicit permission. Once this setting is turned
68+
// on, you can grant MongoDB Support a 24-hour bypass access to the Atlas
69+
// deployment to resolve support issues. To learn more, see:
70+
// https://www.mongodb.com/docs/atlas/security-restrict-support-access/.
71+
// +optional
72+
RestrictEmployeeAccess *bool `json:"restrictEmployeeAccess,omitempty"`
73+
74+
// SecurityContact String that specifies a single email address for the specified
75+
// organization to receive security-related notifications. Specifying a security
76+
// contact does not grant them authorization or access to Atlas for security
77+
// decisions or approvals. An empty string is valid and clears the existing
78+
// security contact (if any).
79+
// +optional
80+
SecurityContact *string `json:"securityContact,omitempty"`
81+
82+
// StreamsCrossGroupEnabled Flag that indicates whether a group's Atlas Stream
83+
// Processing instances in this organization can create connections to other
84+
// group's clusters in the same organization.
85+
// +optional
86+
StreamsCrossGroupEnabled *bool `json:"streamsCrossGroupEnabled,omitempty"`
87+
}
88+
89+
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
90+
// +kubebuilder:object:root=true
91+
// +kubebuilder:printcolumn:name="Ready",type=string,JSONPath=`.status.conditions[?(@.type=="Ready")].status`
92+
// +kubebuilder:name:plural=AtlasOrgSettings, singular=AtlasOrgSettings
93+
// +kubebuilder:resource:categories=atlas,shortName=aos
94+
// +kubebuilder:subresource:status
95+
type AtlasOrgSettings struct {
96+
metav1.TypeMeta `json:",inline"`
97+
metav1.ObjectMeta `json:"metadata,omitempty"`
98+
99+
Spec AtlasOrgSettingsSpec `json:"spec,omitempty"`
100+
Status status.AtlasOrgSettingsStatus `json:"status,omitempty"`
101+
}
102+
103+
func (aos *AtlasOrgSettings) Credentials() *api.LocalObjectReference {
104+
return aos.Spec.ConnectionSecretRef
105+
}
106+
107+
func (aos *AtlasOrgSettings) GetConditions() []metav1.Condition {
108+
if aos.Status.Conditions == nil {
109+
return []metav1.Condition{}
110+
}
111+
return aos.Status.Conditions
112+
}
113+
114+
// +kubebuilder:object:root=true
115+
type AtlasOrgSettingsList struct {
116+
metav1.TypeMeta `json:",inline"`
117+
metav1.ListMeta `json:"metadata,omitempty"`
118+
Items []AtlasOrgSettings `json:"items"`
119+
}

api/v1/status/atlasorgsettings.go

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// Copyright 2025 MongoDB Inc
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
package status
16+
17+
// +k8s:deepcopy-gen=true
18+
type AtlasOrgSettingsStatus struct {
19+
UnifiedStatus `json:",inline"`
20+
}
21+
22+
// +k8s:deepcopy-gen=false
23+
24+
type AtlasOrgSettingsStatusOption func(s *AtlasOrgSettingsStatus)

api/v1/status/zz_generated.deepcopy.go

Lines changed: 16 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/v1/zz_generated.deepcopy.go

Lines changed: 114 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)