-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Set ns from token, add avatar, add namespaces metric (#509)
- Loading branch information
1 parent
2b95202
commit f925316
Showing
9 changed files
with
182 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
export const TenantKubeObjectConfig = { | ||
kind: 'Tenant', | ||
name: { | ||
singularForm: 'tenant', | ||
pluralForm: 'tenants', | ||
}, | ||
group: 'capsule.clastix.io', | ||
version: 'v1beta2', | ||
} as const; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { ApiProxy, K8s } from '@kinvolk/headlamp-plugin/lib'; | ||
import { TenantKubeObjectConfig } from './config'; | ||
import { TenantKubeObjectInterface } from './types'; | ||
|
||
const { | ||
name: { singularForm, pluralForm }, | ||
group, | ||
version, | ||
} = TenantKubeObjectConfig; | ||
|
||
export class TenantKubeObject extends K8s.cluster.makeKubeObject<TenantKubeObjectInterface>( | ||
singularForm | ||
) { | ||
static apiEndpoint = ApiProxy.apiFactoryWithNamespace(group, version, pluralForm); | ||
|
||
static get className(): string { | ||
return singularForm; | ||
} | ||
|
||
get spec(): any { | ||
return this.jsonData!.spec; | ||
} | ||
|
||
get status(): any { | ||
return this.jsonData!.status; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import { KubeObjectInterface } from '@kinvolk/headlamp-plugin/lib/lib/k8s/cluster'; | ||
|
||
export interface TenantStatus { | ||
namespaces: string[]; | ||
size: number; | ||
state: string; | ||
} | ||
|
||
export interface IngressOptions { | ||
hostnameCollisionScope: string; | ||
} | ||
|
||
export interface Limit { | ||
default: { | ||
cpu: string; | ||
memory: string; | ||
}; | ||
defaultRequest: { | ||
cpu: string; | ||
memory: string; | ||
}; | ||
type: string; | ||
} | ||
|
||
export interface LimitRange { | ||
limits: Limit[]; | ||
} | ||
|
||
export interface NamespaceOptions { | ||
quota: number; | ||
} | ||
|
||
export interface Owner { | ||
clusterRoles: string[]; | ||
kind: string; | ||
name: string; | ||
} | ||
|
||
export interface ResourceQuota { | ||
hard: { | ||
[key: string]: string; | ||
}; | ||
} | ||
|
||
export interface TenantSpec { | ||
ingressOptions: IngressOptions; | ||
limitRanges: { | ||
items: LimitRange[]; | ||
}; | ||
namespaceOptions: NamespaceOptions; | ||
networkPolicies: Record<string, unknown>; | ||
owners: Owner[]; | ||
resourceQuotas: { | ||
items: ResourceQuota[]; | ||
scope: string; | ||
}; | ||
} | ||
|
||
export interface TenantKubeObjectInterface extends KubeObjectInterface { | ||
status: TenantStatus; | ||
spec: TenantSpec; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
export const entityMapping = { | ||
'requests.cpu': 'CPU Requests', | ||
'requests.memory': 'Memory Requests', | ||
'limits.cpu': 'CPU Limits', | ||
'limits.memory': 'Memory Limits', | ||
pods: 'Pods', | ||
namespaces: 'Namespaces', | ||
} as const; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters