Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 54 additions & 1 deletion models/prometheus_configuration.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

139 changes: 139 additions & 0 deletions models/security_context.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

60 changes: 60 additions & 0 deletions operatorapi/embedded_spec.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 12 additions & 2 deletions operatorapi/operator_tenants.go
Original file line number Diff line number Diff line change
Expand Up @@ -395,11 +395,11 @@ func getTenantCreds(ctx context.Context, client K8sClientI, tenant *miniov2.Tena
}

func getTenant(ctx context.Context, operatorClient OperatorClientI, namespace, tenantName string) (*miniov2.Tenant, error) {
minInst, err := operatorClient.TenantGet(ctx, namespace, tenantName, metav1.GetOptions{})
tenant, err := operatorClient.TenantGet(ctx, namespace, tenantName, metav1.GetOptions{})
if err != nil {
return nil, err
}
return minInst, nil
return tenant, nil
}

func isPrometheusEnabled(annotations map[string]string) bool {
Expand Down Expand Up @@ -1309,6 +1309,16 @@ func getTenantCreatedResponse(session *models.Principal, params operator_api.Cre
if prometheusImage != "" {
minInst.Spec.Prometheus.Image = prometheusImage
}
// if security context for prometheus is present, configure it.
if tenantReq.PrometheusConfiguration != nil && tenantReq.PrometheusConfiguration.SecurityContext != nil {
sc := tenantReq.PrometheusConfiguration.SecurityContext
minInst.Spec.Prometheus.SecurityContext = &corev1.PodSecurityContext{
RunAsUser: sc.RunAsUser,
RunAsGroup: sc.RunAsGroup,
RunAsNonRoot: sc.RunAsNonRoot,
FSGroup: sc.FsGroup,
}
}

// expose services
minInst.Spec.ExposeServices = &miniov2.ExposeServices{
Expand Down
23 changes: 23 additions & 0 deletions swagger-operator.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1317,6 +1317,9 @@ definitions:
default: 5
image:
type: string
securityContext:
type: object
$ref: '#/definitions/securityContext'
idpConfiguration:
type: object
properties:
Expand Down Expand Up @@ -2263,3 +2266,23 @@ definitions:
type: string
force:
type: boolean
securityContext:
type: object
required:
- runAsUser
- runAsGroup
- runAsNonRoot
- fsGroup
properties:
runAsUser:
type: integer
format: int64
runAsGroup:
type: integer
format: int64
runAsNonRoot:
type: boolean
fsGroup:
type: integer
format: int64