Skip to content

Commit

Permalink
add principal creator id to clusters
Browse files Browse the repository at this point in the history
  • Loading branch information
mantis-toboggan-md committed Oct 11, 2024
1 parent 64b36ae commit a5678fc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
6 changes: 6 additions & 0 deletions lib/shared/addon/components/cru-cluster/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import ChildHook from 'shared/mixins/child-hook';
import ViewNewEdit from 'shared/mixins/view-new-edit';
import { loadStylesheet, proxifyUrl } from 'shared/utils/load-script';
import layout from './template';
import C from '../../utils/constants';

const MEMBER_CONFIG = { type: 'clusterRoleTemplateBinding', };
const BUILD_IN_UI = ['tencentkubernetesengine', 'huaweicontainercloudengine', 'oraclecontainerengine', 'linodekubernetesengine'];
Expand Down Expand Up @@ -67,6 +68,11 @@ export default Component.extend(ViewNewEdit, ChildHook, {

if ( isEmpty(get(this, 'cluster.id')) ){
set(this, 'newCluster', true);
const principal = get(this, 'access.principal')

if (principal?.provider !== 'local'){
set(this.cluster, 'annotations', { [C.LABEL.CREATOR_PRINCIPAL_ID]: principal.id })
}
}

this.router.on('routeWillChange', (/* transition */) => {
Expand Down
5 changes: 3 additions & 2 deletions lib/shared/addon/utils/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,9 @@ var C = {

DEPLOYMENT_REVISION: 'deployment.kubernetes.io/revision',

CREATOR_ID: 'field.cattle.io/creatorId',
TIMESTAMP: 'cattle.io/timestamp',
CREATOR_ID: 'field.cattle.io/creatorId',
TIMESTAMP: 'cattle.io/timestamp',
CREATOR_PRINCIPAL_ID: 'field.cattle.io/creator-principal-name',

// EKS Cluster session token
EKS_SESSION_TOKEN: 'clusterstatus.management.cattle.io/temporary-security-credentials',
Expand Down

0 comments on commit a5678fc

Please sign in to comment.