Add tenant runtimeclass (#2565)
This commit is contained in:
@@ -48,6 +48,9 @@ type Pool struct {
|
|||||||
// resources
|
// resources
|
||||||
Resources *PoolResources `json:"resources,omitempty"`
|
Resources *PoolResources `json:"resources,omitempty"`
|
||||||
|
|
||||||
|
// runtime class name
|
||||||
|
RuntimeClassName string `json:"runtimeClassName,omitempty"`
|
||||||
|
|
||||||
// security context
|
// security context
|
||||||
SecurityContext *SecurityContext `json:"securityContext,omitempty"`
|
SecurityContext *SecurityContext `json:"securityContext,omitempty"`
|
||||||
|
|
||||||
|
|||||||
@@ -4043,6 +4043,9 @@ func init() {
|
|||||||
"resources": {
|
"resources": {
|
||||||
"$ref": "#/definitions/poolResources"
|
"$ref": "#/definitions/poolResources"
|
||||||
},
|
},
|
||||||
|
"runtimeClassName": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
"securityContext": {
|
"securityContext": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"$ref": "#/definitions/securityContext"
|
"$ref": "#/definitions/securityContext"
|
||||||
@@ -9976,6 +9979,9 @@ func init() {
|
|||||||
"resources": {
|
"resources": {
|
||||||
"$ref": "#/definitions/poolResources"
|
"$ref": "#/definitions/poolResources"
|
||||||
},
|
},
|
||||||
|
"runtimeClassName": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
"securityContext": {
|
"securityContext": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"$ref": "#/definitions/securityContext"
|
"$ref": "#/definitions/securityContext"
|
||||||
|
|||||||
@@ -2270,9 +2270,10 @@ func parseTenantPoolRequest(poolParams *models.Pool) (*miniov2.Pool, error) {
|
|||||||
Requests: resourcesRequests,
|
Requests: resourcesRequests,
|
||||||
Limits: resourcesLimits,
|
Limits: resourcesLimits,
|
||||||
},
|
},
|
||||||
NodeSelector: poolParams.NodeSelector,
|
NodeSelector: poolParams.NodeSelector,
|
||||||
Affinity: affinity,
|
Affinity: affinity,
|
||||||
Tolerations: tolerations,
|
Tolerations: tolerations,
|
||||||
|
RuntimeClassName: &poolParams.RuntimeClassName,
|
||||||
}
|
}
|
||||||
// if security context for Tenant is present, configure it.
|
// if security context for Tenant is present, configure it.
|
||||||
if poolParams.SecurityContext != nil {
|
if poolParams.SecurityContext != nil {
|
||||||
@@ -2493,6 +2494,11 @@ func parseTenantPool(pool *miniov2.Pool) *models.Pool {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var runtimeClassName string
|
||||||
|
if pool.RuntimeClassName != nil {
|
||||||
|
runtimeClassName = *pool.RuntimeClassName
|
||||||
|
}
|
||||||
|
|
||||||
poolModel := &models.Pool{
|
poolModel := &models.Pool{
|
||||||
Name: pool.Name,
|
Name: pool.Name,
|
||||||
Servers: swag.Int64(int64(pool.Servers)),
|
Servers: swag.Int64(int64(pool.Servers)),
|
||||||
@@ -2501,11 +2507,12 @@ func parseTenantPool(pool *miniov2.Pool) *models.Pool {
|
|||||||
Size: size,
|
Size: size,
|
||||||
StorageClassName: storageClassName,
|
StorageClassName: storageClassName,
|
||||||
},
|
},
|
||||||
NodeSelector: pool.NodeSelector,
|
NodeSelector: pool.NodeSelector,
|
||||||
Resources: resources,
|
Resources: resources,
|
||||||
Affinity: affinity,
|
Affinity: affinity,
|
||||||
Tolerations: tolerations,
|
Tolerations: tolerations,
|
||||||
SecurityContext: &securityContext,
|
SecurityContext: &securityContext,
|
||||||
|
RuntimeClassName: runtimeClassName,
|
||||||
}
|
}
|
||||||
return poolModel
|
return poolModel
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -370,7 +370,7 @@ export MINIO_SECRET_KEY=minio123
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func NoTestTenantInfo(t *testing.T) {
|
func Test_TenantInfo(t *testing.T) {
|
||||||
testTimeStamp := metav1.Now()
|
testTimeStamp := metav1.Now()
|
||||||
type args struct {
|
type args struct {
|
||||||
minioTenant *miniov2.Tenant
|
minioTenant *miniov2.Tenant
|
||||||
@@ -405,6 +405,7 @@ func NoTestTenantInfo(t *testing.T) {
|
|||||||
StorageClassName: swag.String("standard"),
|
StorageClassName: swag.String("standard"),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
RuntimeClassName: swag.String(""),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -422,7 +423,12 @@ func NoTestTenantInfo(t *testing.T) {
|
|||||||
CurrentState: "ready",
|
CurrentState: "ready",
|
||||||
Pools: []*models.Pool{
|
Pools: []*models.Pool{
|
||||||
{
|
{
|
||||||
Name: "pool1",
|
Name: "pool1",
|
||||||
|
SecurityContext: &models.SecurityContext{
|
||||||
|
RunAsGroup: nil,
|
||||||
|
RunAsNonRoot: nil,
|
||||||
|
RunAsUser: nil,
|
||||||
|
},
|
||||||
Servers: swag.Int64(int64(2)),
|
Servers: swag.Int64(int64(2)),
|
||||||
VolumesPerServer: swag.Int32(4),
|
VolumesPerServer: swag.Int32(4),
|
||||||
VolumeConfiguration: &models.PoolVolumeConfiguration{
|
VolumeConfiguration: &models.PoolVolumeConfiguration{
|
||||||
@@ -470,6 +476,7 @@ func NoTestTenantInfo(t *testing.T) {
|
|||||||
StorageClassName: swag.String("standard"),
|
StorageClassName: swag.String("standard"),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
RuntimeClassName: swag.String(""),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Image: "minio/minio:RELEASE.2020-06-14T18-32-17Z",
|
Image: "minio/minio:RELEASE.2020-06-14T18-32-17Z",
|
||||||
@@ -487,7 +494,12 @@ func NoTestTenantInfo(t *testing.T) {
|
|||||||
CurrentState: "ready",
|
CurrentState: "ready",
|
||||||
Pools: []*models.Pool{
|
Pools: []*models.Pool{
|
||||||
{
|
{
|
||||||
Name: "pool1",
|
Name: "pool1",
|
||||||
|
SecurityContext: &models.SecurityContext{
|
||||||
|
RunAsGroup: nil,
|
||||||
|
RunAsNonRoot: nil,
|
||||||
|
RunAsUser: nil,
|
||||||
|
},
|
||||||
Servers: swag.Int64(int64(2)),
|
Servers: swag.Int64(int64(2)),
|
||||||
VolumesPerServer: swag.Int32(4),
|
VolumesPerServer: swag.Int32(4),
|
||||||
VolumeConfiguration: &models.PoolVolumeConfiguration{
|
VolumeConfiguration: &models.PoolVolumeConfiguration{
|
||||||
@@ -1012,7 +1024,7 @@ func Test_UpdateTenantAction(t *testing.T) {
|
|||||||
},
|
},
|
||||||
params: operator_api.UpdateTenantParams{
|
params: operator_api.UpdateTenantParams{
|
||||||
Body: &models.UpdateTenantRequest{
|
Body: &models.UpdateTenantRequest{
|
||||||
Image: "minio/minio:RELEASE.2020-06-03T22-13-49Z",
|
Image: "minio/minio:RELEASE.2023-01-06T18-11-18Z",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -1037,7 +1049,7 @@ func Test_UpdateTenantAction(t *testing.T) {
|
|||||||
},
|
},
|
||||||
params: operator_api.UpdateTenantParams{
|
params: operator_api.UpdateTenantParams{
|
||||||
Body: &models.UpdateTenantRequest{
|
Body: &models.UpdateTenantRequest{
|
||||||
Image: "minio/minio:RELEASE.2020-06-03T22-13-49Z",
|
Image: "minio/minio:RELEASE.2023-01-06T18-11-18Z",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -1063,7 +1075,7 @@ func Test_UpdateTenantAction(t *testing.T) {
|
|||||||
params: operator_api.UpdateTenantParams{
|
params: operator_api.UpdateTenantParams{
|
||||||
Tenant: "minio-tenant",
|
Tenant: "minio-tenant",
|
||||||
Body: &models.UpdateTenantRequest{
|
Body: &models.UpdateTenantRequest{
|
||||||
Image: "minio/minio:RELEASE.2020-06-03T22-13-49Z",
|
Image: "minio/minio:RELEASE.2023-01-06T18-11-18Z",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -2610,6 +2610,8 @@ definitions:
|
|||||||
https://kubernetes.io/docs/concepts/configuration/assign-pod-node/"
|
https://kubernetes.io/docs/concepts/configuration/assign-pod-node/"
|
||||||
affinity:
|
affinity:
|
||||||
$ref: "#/definitions/poolAffinity"
|
$ref: "#/definitions/poolAffinity"
|
||||||
|
runtimeClassName:
|
||||||
|
type: string
|
||||||
tolerations:
|
tolerations:
|
||||||
$ref: "#/definitions/poolTolerations"
|
$ref: "#/definitions/poolTolerations"
|
||||||
securityContext:
|
securityContext:
|
||||||
@@ -3750,4 +3752,4 @@ definitions:
|
|||||||
redirect:
|
redirect:
|
||||||
type: string
|
type: string
|
||||||
displayName:
|
displayName:
|
||||||
type: string
|
type: string
|
||||||
Reference in New Issue
Block a user