Skip to content
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
5 changes: 4 additions & 1 deletion internal/kubernetes/operator/config_exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -417,9 +417,12 @@ func (e *ConfigExporter) exportAtlasFederatedAuth(projectName string) ([]runtime
// Gets the FederationAuthSetting
federatedAuthentificationSetting, err := e.dataProvider.FederationSetting(&admin.GetFederationSettingsApiParams{OrgId: e.orgID})
if err != nil {
if admin.IsErrorCode(err, "RESOURCE_NOT_FOUND") {
return nil, nil
}
return nil, fmt.Errorf("failed to retrieve federation settings: %w", err)
}
// Does not have an IdenityProvider set then no need to generate
// Does not have an IdentityProvider set then no need to generate
if !federatedAuthentificationSetting.HasIdentityProviderStatus() || federatedAuthentificationSetting.GetIdentityProviderStatus() == InactiveStatus {
return nil, nil
}
Expand Down
20 changes: 20 additions & 0 deletions test/e2e/atlas/kubernetes_config_generate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,26 @@ func InitialSetup(t *testing.T) KubernetesConfigGenerateProjectSuite {
return s
}

func TestExportWorksWithoutFedAuth(t *testing.T) {
s := InitialSetup(t)
cliPath := s.cliPath
generator := s.generator
cmd := exec.Command(cliPath,
"kubernetes",
"config",
"generate",
"--projectId",
generator.projectID)
cmd.Env = os.Environ()
resp, err := cmd.CombinedOutput()
t.Log(string(resp))
require.NoError(t, err, string(resp))
var objects []runtime.Object
objects, err = getK8SEntities(resp)
require.NoError(t, err, "should not fail on decode but got:\n"+string(resp))
require.NotEmpty(t, objects)
}

func TestFederatedAuthTest(t *testing.T) {
t.Run("PreRequisite Get the federation setting ID", func(t *testing.T) {
s := InitialSetup(t)
Expand Down