Skip to content

Commit

Permalink
allow custom (non-propagating) sts metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
ramondeklein committed Oct 15, 2024
1 parent 082389a commit 11361b4
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 2 deletions.
19 changes: 19 additions & 0 deletions pkg/apis/minio.min.io/v2/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,11 @@ type TenantSpec struct {
ServiceMetadata *ServiceMetadata `json:"serviceMetadata,omitempty"`
// *Optional* +
//
// Specify custom labels and annotations to append to the MinIO statefulsets.
// +optional
StatefulSetMetadata *StatefulSetMetadata `json:"statefulSetMetadata,omitempty"`
// *Optional* +
//
// An array of https://kubernetes.io/docs/concepts/configuration/secret/[Kubernetes opaque secrets] to use for generating MinIO users during tenant provisioning. +
//
// Each element in the array is an object consisting of a key-value pair `name: <string>`, where the `<string>` references an opaque Kubernetes secret. +
Expand Down Expand Up @@ -397,6 +402,20 @@ type ServiceMetadata struct {
ConsoleServiceAnnotations map[string]string `json:"consoleServiceAnnotations,omitempty"`
}

// StatefulSetMetadata (`statefulSetMetadata`) defines custom labels and annotations for the MinIO stateful sets. +
type StatefulSetMetadata struct {
// *Optional* +
//
// If provided, append these labels to the MinIO statefulset
// +optional
Labels map[string]string `json:"minioServiceLabels,omitempty"`
// *Optional* +
//
// If provided, append these annotations to the MinIO statefulset
// +optional
Annotations map[string]string `json:"minioServiceAnnotations,omitempty"`
}

// LocalCertificateReference (`externalCertSecret`, `externalCaCertSecret`,`clientCertSecret`) contains a Kubernetes secret containing TLS certificates or Certificate Authority files for use with enabling TLS in the MinIO Tenant. +
type LocalCertificateReference struct {
// *Required* +
Expand Down
11 changes: 9 additions & 2 deletions pkg/resources/statefulsets/minio-statefulset.go
Original file line number Diff line number Diff line change
Expand Up @@ -628,8 +628,15 @@ func NewPool(args *NewPoolArgs) *appsv1.StatefulSet {
},
}
// Copy labels and annotations from the Tenant.Spec.Metadata
ssMeta.Labels = t.ObjectMeta.Labels
ssMeta.Annotations = t.ObjectMeta.Annotations
// unless `StatefulSetMetadata` is defined, then we'll copy it
// from there.
if t.Spec.StatefulSetMetadata != nil {
ssMeta.Labels = t.Spec.StatefulSetMetadata.Labels
ssMeta.Annotations = t.Spec.StatefulSetMetadata.Annotations
} else {
ssMeta.Labels = t.ObjectMeta.Labels
ssMeta.Annotations = t.ObjectMeta.Annotations
}

if ssMeta.Labels == nil {
ssMeta.Labels = make(map[string]string)
Expand Down

0 comments on commit 11361b4

Please sign in to comment.