Skip to content

Commit

Permalink
Merge pull request #1152 from cdapio/sa-fill-tenantid-inhelpcommand
Browse files Browse the repository at this point in the history
Command help command changes in service accounts modal UI
  • Loading branch information
radhikav1 authored Nov 22, 2023
2 parents 6d65c94 + 6ede6b3 commit 218c4cf
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,13 @@ const StyledTextField = styled(TextField)`
* @return string, the gcloud cli command to run
*/
const getGcloudCommand = ({
tenantProjectId = '${TENANT_PROJECT_ID}',
k8sWorkloadIdentityPool = '${TENANT_PROJECT_ID}.svc.id.goog',
identity = '${IDENTITY}',
gsaEmail = '${GSA_EMAIL}',
gsaProjectId = '${GSA_PROJECT_ID}',
k8snamespace = 'default',
}): string =>
`gcloud iam service-accounts add-iam-policy-binding --role roles/iam.workloadIdentityUser --member "serviceAccount:${tenantProjectId}.svc.id.goog[${k8snamespace}/${identity}]" ${gsaEmail} --project ${gsaProjectId}`;
`gcloud iam service-accounts add-iam-policy-binding --role roles/iam.workloadIdentityUser --member "serviceAccount:${k8sWorkloadIdentityPool}[${k8snamespace}/${identity}]" ${gsaEmail} --project ${gsaProjectId}`;

export const EditConfirmDialog = ({
selectedServiceAcccount,
Expand All @@ -79,6 +79,7 @@ export const EditConfirmDialog = ({
k8snamespace,
}: IEditConfirmDialogProps) => {
const namespacedCreationHookEnabled = window.CDAP_CONFIG.cdap.namespaceCreationHookEnabled;
const k8sWorkloadIdentityPool = window.CDAP_CONFIG.cdap.k8sWorkloadIdentityPool;
const [serviceAccountInputValue, setServiceAccountInputValue] = useState<string>(
selectedServiceAcccount
);
Expand All @@ -94,6 +95,7 @@ export const EditConfirmDialog = ({
identity: namespaceIdentity || undefined,
gsaEmail: serviceAccountInputValue || undefined,
k8snamespace: (namespacedCreationHookEnabled && k8snamespace) || undefined,
k8sWorkloadIdentityPool: k8sWorkloadIdentityPool || undefined,
};

const copyableExtendedMessage =
Expand Down
1 change: 1 addition & 0 deletions server/express.js
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,7 @@ function makeApp(authAddress, cdapConfig, uiSettings) {
maxRecordsPreview: cdapConfig['preview.max.num.records'],
ui: uiSettings['ui'],
k8sWorkloadIdentityEnabled: cdapConfig['master.environment.k8s.workload.identity.enabled'],
k8sWorkloadIdentityPool:cdapConfig['credential.provider.system.properties.gcp-wi-credential-provider.k8s.workload.identity.pool'],
namespaceCreationHookEnabled: cdapConfig['namespaces.creation.hook.enabled'],
hstsEnabled: cdapConfig['hsts.enabled'],
hstsMaxAge: cdapConfig['hsts.max.age'],
Expand Down

0 comments on commit 218c4cf

Please sign in to comment.