diff --git a/models/pool.go b/models/pool.go index ae6e39b566..3f35e076b6 100644 --- a/models/pool.go +++ b/models/pool.go @@ -48,6 +48,9 @@ type Pool struct { // resources Resources *PoolResources `json:"resources,omitempty"` + // runtime class name + RuntimeClassName string `json:"runtimeClassName,omitempty"` + // security context SecurityContext *SecurityContext `json:"securityContext,omitempty"` diff --git a/operatorapi/embedded_spec.go b/operatorapi/embedded_spec.go index 5bae518c44..cbc436391a 100644 --- a/operatorapi/embedded_spec.go +++ b/operatorapi/embedded_spec.go @@ -4043,6 +4043,9 @@ func init() { "resources": { "$ref": "#/definitions/poolResources" }, + "runtimeClassName": { + "type": "string" + }, "securityContext": { "type": "object", "$ref": "#/definitions/securityContext" @@ -9976,6 +9979,9 @@ func init() { "resources": { "$ref": "#/definitions/poolResources" }, + "runtimeClassName": { + "type": "string" + }, "securityContext": { "type": "object", "$ref": "#/definitions/securityContext" diff --git a/operatorapi/tenants.go b/operatorapi/tenants.go index 6017c347dd..9112cf6582 100644 --- a/operatorapi/tenants.go +++ b/operatorapi/tenants.go @@ -2270,9 +2270,10 @@ func parseTenantPoolRequest(poolParams *models.Pool) (*miniov2.Pool, error) { Requests: resourcesRequests, Limits: resourcesLimits, }, - NodeSelector: poolParams.NodeSelector, - Affinity: affinity, - Tolerations: tolerations, + NodeSelector: poolParams.NodeSelector, + Affinity: affinity, + Tolerations: tolerations, + RuntimeClassName: &poolParams.RuntimeClassName, } // if security context for Tenant is present, configure it. 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{ Name: pool.Name, Servers: swag.Int64(int64(pool.Servers)), @@ -2501,11 +2507,12 @@ func parseTenantPool(pool *miniov2.Pool) *models.Pool { Size: size, StorageClassName: storageClassName, }, - NodeSelector: pool.NodeSelector, - Resources: resources, - Affinity: affinity, - Tolerations: tolerations, - SecurityContext: &securityContext, + NodeSelector: pool.NodeSelector, + Resources: resources, + Affinity: affinity, + Tolerations: tolerations, + SecurityContext: &securityContext, + RuntimeClassName: runtimeClassName, } return poolModel } diff --git a/operatorapi/tenants_test.go b/operatorapi/tenants_test.go index e181d271fb..4347d233a3 100644 --- a/operatorapi/tenants_test.go +++ b/operatorapi/tenants_test.go @@ -370,7 +370,7 @@ export MINIO_SECRET_KEY=minio123 } } -func NoTestTenantInfo(t *testing.T) { +func Test_TenantInfo(t *testing.T) { testTimeStamp := metav1.Now() type args struct { minioTenant *miniov2.Tenant @@ -405,6 +405,7 @@ func NoTestTenantInfo(t *testing.T) { StorageClassName: swag.String("standard"), }, }, + RuntimeClassName: swag.String(""), }, }, @@ -422,7 +423,12 @@ func NoTestTenantInfo(t *testing.T) { CurrentState: "ready", Pools: []*models.Pool{ { - Name: "pool1", + Name: "pool1", + SecurityContext: &models.SecurityContext{ + RunAsGroup: nil, + RunAsNonRoot: nil, + RunAsUser: nil, + }, Servers: swag.Int64(int64(2)), VolumesPerServer: swag.Int32(4), VolumeConfiguration: &models.PoolVolumeConfiguration{ @@ -470,6 +476,7 @@ func NoTestTenantInfo(t *testing.T) { StorageClassName: swag.String("standard"), }, }, + RuntimeClassName: swag.String(""), }, }, Image: "minio/minio:RELEASE.2020-06-14T18-32-17Z", @@ -487,7 +494,12 @@ func NoTestTenantInfo(t *testing.T) { CurrentState: "ready", Pools: []*models.Pool{ { - Name: "pool1", + Name: "pool1", + SecurityContext: &models.SecurityContext{ + RunAsGroup: nil, + RunAsNonRoot: nil, + RunAsUser: nil, + }, Servers: swag.Int64(int64(2)), VolumesPerServer: swag.Int32(4), VolumeConfiguration: &models.PoolVolumeConfiguration{ @@ -1012,7 +1024,7 @@ func Test_UpdateTenantAction(t *testing.T) { }, params: operator_api.UpdateTenantParams{ 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{ 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{ Tenant: "minio-tenant", Body: &models.UpdateTenantRequest{ - Image: "minio/minio:RELEASE.2020-06-03T22-13-49Z", + Image: "minio/minio:RELEASE.2023-01-06T18-11-18Z", }, }, }, diff --git a/swagger-operator.yml b/swagger-operator.yml index 902ca97552..07e13e723a 100644 --- a/swagger-operator.yml +++ b/swagger-operator.yml @@ -2610,6 +2610,8 @@ definitions: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/" affinity: $ref: "#/definitions/poolAffinity" + runtimeClassName: + type: string tolerations: $ref: "#/definitions/poolTolerations" securityContext: @@ -3750,4 +3752,4 @@ definitions: redirect: type: string displayName: - type: string + type: string \ No newline at end of file