diff --git a/api/v1alpha1/oidcapp_types.go b/api/v1alpha1/oidcapp_types.go index 897e079..7f682dc 100644 --- a/api/v1alpha1/oidcapp_types.go +++ b/api/v1alpha1/oidcapp_types.go @@ -67,7 +67,7 @@ type OIDCAppStatus struct { // +optional // +operator-sdk:csv:customresourcedefinitions:type=status,xDescriptors={"urn:alm:descriptor:io.kubernetes.conditions"} Conditions []metav1.Condition `json:"conditions,omitempty"` - AppId *string `json:"appId"` + AppId *string `json:"appId,omitempty"` ClientId *string `json:"clientId,omitempty"` } diff --git a/internal/controller/oidcapp_controller.go b/internal/controller/oidcapp_controller.go index ce4df04..bc5d1b2 100644 --- a/internal/controller/oidcapp_controller.go +++ b/internal/controller/oidcapp_controller.go @@ -144,8 +144,6 @@ func (wr *wrappedOIDCAppReconciler) Reconcile(ctx context.Context, ztdClient *cl return fmt.Errorf("Error listing OIDCApps: %v", err) } - fmt.Println(appList.Applications) - if len(appList.Applications) > 0 { appid = &appList.Applications[0].ApplicationId clientid = &appList.Applications[0].GetOidcConfiguration().ClientId @@ -154,7 +152,7 @@ func (wr *wrappedOIDCAppReconciler) Reconcile(ctx context.Context, ztdClient *cl if appid == nil { resp, err := ztdClient.ApplicationServiceV2().CreateApplication(ctx, &application.CreateApplicationRequest{ - Name: wr.OIDCApp.Name, + Name: wr.OIDCApp.Spec.OIDCAppName, ProjectId: *project.Status.ProjectId, ApplicationType: &application.CreateApplicationRequest_OidcConfiguration{ OidcConfiguration: &application.CreateOIDCApplicationRequest{ @@ -192,7 +190,7 @@ func (wr *wrappedOIDCAppReconciler) Reconcile(ctx context.Context, ztdClient *cl Namespace: wr.OIDCApp.Namespace, } - secretData := map[string][]byte{"clientSecret": []byte(resp.GetApiConfiguration().ClientSecret), "appId": []byte(resp.ApplicationId), "clientId": []byte(resp.GetOidcConfiguration().ClientId)} + secretData := map[string][]byte{"clientSecret": []byte(resp.GetOidcConfiguration().ClientSecret), "appId": []byte(resp.ApplicationId), "clientId": []byte(resp.GetOidcConfiguration().ClientId)} secret, err := wr.Builder.BuildSecret(builder.SecretOpts{Immutable: false, Key: key, Data: secretData}, wr.OIDCApp) if err != nil { return fmt.Errorf("error building Secret: %v", err)