Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Noobaa/Backingstore : Need facility to change labels #1489

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
2 changes: 2 additions & 0 deletions deploy/crds/noobaa.io_v1alpha1_backingstore_cr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@ apiVersion: noobaa.io/v1alpha1
kind: BackingStore
metadata:
name: default
labels:
backingstore: noobaa
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should avoid setting a default label for the BackingStore. Instead, users should have the flexibility to add the label as needed.

spec:
12 changes: 10 additions & 2 deletions pkg/backingstore/reconciler.go
Original file line number Diff line number Diff line change
Expand Up @@ -1169,6 +1169,12 @@ func (r *Reconciler) needUpdate(pod *corev1.Pod) bool {
}
}

var pod_label = pod.Labels["backingstore"]
var bs_label = r.BackingStore.Labels["backingstore"]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and we can check here if label is provided in backingstore then we will update the label in pv-pods.

if pod_label != bs_label {
return true
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should log a warn msg here if the label is updated

}

for _, name := range []string{"NOOBAA_LOG_LEVEL", "NOOBAA_LOG_COLOR"} {
configMapValue := r.CoreAppConfig.Data[name]
noobaaLogEnvVar := util.GetEnvVariable(&c.Env, name)
Expand Down Expand Up @@ -1305,10 +1311,12 @@ func (r *Reconciler) updatePodTemplate() error {
r.PodAgentTemplate.Spec.ImagePullSecrets =
[]corev1.LocalObjectReference{*r.NooBaa.Spec.ImagePullSecret}
}
var bs_label = r.BackingStore.Labels["backingstore"]

r.PodAgentTemplate.Labels = map[string]string{
"app": "noobaa",
"pool": r.BackingStore.Name,
"backingstore": "noobaa",
"backingstore": bs_label,
}
if r.NooBaa.Spec.Tolerations != nil {
r.PodAgentTemplate.Spec.Tolerations = r.NooBaa.Spec.Tolerations
Expand All @@ -1329,7 +1337,7 @@ func (r *Reconciler) updatePodTemplate() error {
NodeTaintsPolicy: &honor,
LabelSelector: &metav1.LabelSelector{
MatchLabels: map[string]string{
"backingstore": "noobaa",
"backingstore": bs_label,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"backingstore": bs_label,
"pvbackingstore": bs_label,

wdyt? Can we change the label name to pvbackingstore ?

},
},
}
Expand Down
4 changes: 3 additions & 1 deletion pkg/bundle/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -3623,12 +3623,14 @@ spec:
status: {}
`

const Sha256_deploy_crds_noobaa_io_v1alpha1_backingstore_cr_yaml = "84ca6f2a35a413e74a51375bd0ec31c33bb76a00de8e0ef8d02a7798e02ec460"
const Sha256_deploy_crds_noobaa_io_v1alpha1_backingstore_cr_yaml = "8fdf39c530933be6f2d81eee4f5e3bd8a11c56e97b81f32d17313817fc0d4d67"

const File_deploy_crds_noobaa_io_v1alpha1_backingstore_cr_yaml = `apiVersion: noobaa.io/v1alpha1
kind: BackingStore
metadata:
name: default
labels:
backingstore: noobaa
spec:
`

Expand Down
4 changes: 2 additions & 2 deletions pkg/system/phase4_configuring.go
Original file line number Diff line number Diff line change
Expand Up @@ -417,11 +417,11 @@ func (r *Reconciler) SetDesiredDeploymentEndpoint() error {

if r.NooBaa.Spec.BucketNotifications.Enabled {
envVar := corev1.EnvVar{
Name: "NOTIFICATION_LOG_DIR",
Name: "NOTIFICATION_LOG_DIR",
Value: "/var/logs/notifications",
}

util.MergeEnvArrays(&c.Env, &[]corev1.EnvVar{envVar});
util.MergeEnvArrays(&c.Env, &[]corev1.EnvVar{envVar})
}

c.SecurityContext = &corev1.SecurityContext{
Expand Down
Loading