Skip to content
Draft
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
4 changes: 4 additions & 0 deletions api/v1alpha1/storagenode_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,10 @@ type StorageNodeSpec struct {
// Tolerations configures pod tolerations for storage-node pods.
Tolerations []corev1.Toleration `json:"tolerations,omitempty"`

// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Image Pull Secrets"
// ImagePullSecrets is the list of image pull secrets for storage-node pods.
ImagePullSecrets []corev1.LocalObjectReference `json:"imagePullSecrets,omitempty"`

// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Force"
// Force enables forced action execution where supported.
Force *bool `json:"force,omitempty"`
Expand Down
5 changes: 5 additions & 0 deletions api/v1alpha1/zz_generated.deepcopy.go

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

14 changes: 14 additions & 0 deletions config/crd/bases/storage.simplyblock.io_storagenodes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,20 @@ spec:
When omitted the backend default is used.
pattern: ^[0-9]+(G|GI|GB|GiB|M|MI|MB|MiB|g|gi|gb|gib|m|mi|mb|mib)?$
type: string
imagePullSecrets:
description: ImagePullSecrets is the list of image pull secrets for
storage-node pods.
items:
description: LocalObjectReference contains enough information to
let you locate the referenced object inside the same namespace.
properties:
name:
default: ""
description: Name of the referent.
type: string
type: object
x-kubernetes-map-type: atomic
type: array
tolerations:
description: Tolerations configures pod tolerations for storage-node
pods.
Expand Down
14 changes: 14 additions & 0 deletions internal/utils/storage_node_ds.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package utils

import (

Check failure on line 3 in internal/utils/storage_node_ds.go

View workflow job for this annotation

GitHub Actions / Run on Ubuntu

File is not properly formatted (gofmt)
"fmt"
"strings"
"encoding/json"

simplyblockv1alpha1 "github.com/simplyblock/simplyblock-operator/api/v1alpha1"
appsv1 "k8s.io/api/apps/v1"
Expand Down Expand Up @@ -54,12 +55,24 @@
initCmd = append(initCmd, "--cores-percentage="+Int32PtrToString(sn.Spec.CorePercentage))
}

imagePullSecretsJSON := ""
if len(sn.Spec.ImagePullSecrets) > 0 {
names := make([]string, len(sn.Spec.ImagePullSecrets))
for i, ref := range sn.Spec.ImagePullSecrets {
names[i] = ref.Name
}
if data, err := json.Marshal(names); err == nil {
imagePullSecretsJSON = string(data)
}
}

mainEnv := []corev1.EnvVar{
{Name: "UBUNTU_HOST", Value: BoolPtrToString(sn.Spec.UbuntuHost)},
{Name: "OPENSHIFT_CLUSTER", Value: BoolPtrToString(sn.Spec.OpenShiftCluster)},
{Name: "CPU_TOPOLOGY_ENABLED", Value: BoolPtrToString(sn.Spec.EnableCpuTopology)},
{Name: "SKIP_KUBELET_CONFIGURATION", Value: BoolPtrToString(sn.Spec.SkipKubeletConfiguration)},
{Name: "SIMPLY_BLOCK_DOCKER_IMAGE", Value: image},
{Name: "IMAGE_PULL_SECRETS", Value: imagePullSecretsJSON},
{Name: "HOSTNAME", ValueFrom: &corev1.EnvVarSource{
FieldRef: &corev1.ObjectFieldSelector{FieldPath: "spec.nodeName"},
}},
Expand Down Expand Up @@ -206,6 +219,7 @@
ServiceAccountName: "simplyblock-storage-node-sa",
HostNetwork: true,
Tolerations: sn.Spec.Tolerations,
ImagePullSecrets: sn.Spec.ImagePullSecrets,
NodeSelector: map[string]string{
"io.simplyblock.node-type": "simplyblock-storage-plane-" + sn.Spec.ClusterName,
},
Expand Down
Loading