Skip to content

Commit 0a9e1ad

Browse files
authored
CLOUDP-278912: Export without Fed Auth (#3329)
Signed-off-by: jose.vazquez <[email protected]>
1 parent cce9740 commit 0a9e1ad

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

internal/kubernetes/operator/config_exporter.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -417,9 +417,12 @@ func (e *ConfigExporter) exportAtlasFederatedAuth(projectName string) ([]runtime
417417
// Gets the FederationAuthSetting
418418
federatedAuthentificationSetting, err := e.dataProvider.FederationSetting(&admin.GetFederationSettingsApiParams{OrgId: e.orgID})
419419
if err != nil {
420+
if admin.IsErrorCode(err, "RESOURCE_NOT_FOUND") {
421+
return nil, nil
422+
}
420423
return nil, fmt.Errorf("failed to retrieve federation settings: %w", err)
421424
}
422-
// Does not have an IdenityProvider set then no need to generate
425+
// Does not have an IdentityProvider set then no need to generate
423426
if !federatedAuthentificationSetting.HasIdentityProviderStatus() || federatedAuthentificationSetting.GetIdentityProviderStatus() == InactiveStatus {
424427
return nil, nil
425428
}

test/e2e/atlas/kubernetes_config_generate_test.go

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,26 @@ func InitialSetup(t *testing.T) KubernetesConfigGenerateProjectSuite {
131131
return s
132132
}
133133

134+
func TestExportWorksWithoutFedAuth(t *testing.T) {
135+
s := InitialSetup(t)
136+
cliPath := s.cliPath
137+
generator := s.generator
138+
cmd := exec.Command(cliPath,
139+
"kubernetes",
140+
"config",
141+
"generate",
142+
"--projectId",
143+
generator.projectID)
144+
cmd.Env = os.Environ()
145+
resp, err := cmd.CombinedOutput()
146+
t.Log(string(resp))
147+
require.NoError(t, err, string(resp))
148+
var objects []runtime.Object
149+
objects, err = getK8SEntities(resp)
150+
require.NoError(t, err, "should not fail on decode but got:\n"+string(resp))
151+
require.NotEmpty(t, objects)
152+
}
153+
134154
func TestFederatedAuthTest(t *testing.T) {
135155
t.Run("PreRequisite Get the federation setting ID", func(t *testing.T) {
136156
s := InitialSetup(t)

0 commit comments

Comments
 (0)