Conversation
How to use the Graphite Merge QueueAdd the label main-merge-queue to this PR to add it to the merge queue. You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has required the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
Graphite Automations"Add anton/matt/sergey/kristina as reviwers on operator PRs" took an action on this PR • (01/22/26)2 reviewers were added to this PR based on Anton Bykov's automation. |
6660290 to
295e9ec
Compare
| smbwCluster, err := wekaService.GetSmbwCluster(ctx) | ||
| if err != nil { | ||
| err = errors.Wrap(err, "Failed to get SMB-W cluster") | ||
| return err | ||
| } | ||
|
|
||
| if smbwCluster.Active { | ||
| logger.Info("SMB-W cluster already exists") | ||
| return nil | ||
| } |
There was a problem hiding this comment.
it looks like EnsureSmbwCluster expects smbw cluster to be already created and will otherwise
| func contains(s, substr string) bool { | ||
| return len(s) >= len(substr) && (s == substr || len(s) > 0 && containsIgnoreCase(s, substr)) | ||
| } |
There was a problem hiding this comment.
ah, it's for containsIgnoreCase
then maybe would be good to remove this "contains" func and only keep "containsIgnoreCase"
295e9ec to
5516b89
Compare
dd13517 to
607f4de
Compare
3ecc1ad to
ff27dc2
Compare
ff27dc2 to
4b43eff
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 19 out of 19 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| shmSizeLimit := resource.MustParse(config.Config.Smbw.ShmSize) | ||
| vols = append(vols, corev1.Volume{ | ||
| Name: "smbw-shm", | ||
| VolumeSource: corev1.VolumeSource{ | ||
| EmptyDir: &corev1.EmptyDirVolumeSource{ | ||
| Medium: corev1.StorageMediumMemory, | ||
| SizeLimit: &shmSizeLimit, |
There was a problem hiding this comment.
resource.MustParse(config.Config.Smbw.ShmSize) will panic if the SMBW_SHM_SIZE env/Helm value is invalid, potentially crashing the operator. Prefer resource.ParseQuantity (or validation during env config) and return/log a clear error instead of panicking.
| shmSizeLimit := resource.MustParse(config.Config.Smbw.ShmSize) | |
| vols = append(vols, corev1.Volume{ | |
| Name: "smbw-shm", | |
| VolumeSource: corev1.VolumeSource{ | |
| EmptyDir: &corev1.EmptyDirVolumeSource{ | |
| Medium: corev1.StorageMediumMemory, | |
| SizeLimit: &shmSizeLimit, | |
| var shmSizeLimit *resource.Quantity | |
| if q, err := resource.ParseQuantity(config.Config.Smbw.ShmSize); err != nil { | |
| fmt.Printf("invalid SMBW_SHM_SIZE value %q, using unlimited shm size: %v\n", config.Config.Smbw.ShmSize, err) | |
| } else { | |
| shmSizeLimit = &q | |
| } | |
| vols = append(vols, corev1.Volume{ | |
| Name: "smbw-shm", | |
| VolumeSource: corev1.VolumeSource{ | |
| EmptyDir: &corev1.EmptyDirVolumeSource{ | |
| Medium: corev1.StorageMediumMemory, | |
| SizeLimit: shmSizeLimit, |
| if prepareForUpgrade { | ||
| err := r.prepareForUpgradeS3(ctx, smbwContainers, targetVersion) | ||
| if err != nil { |
There was a problem hiding this comment.
prepareForUpgradeS3 is now used for SMB-W containers as well. Even if the underlying logic is valid (it appears to prepare the “frontend” upgrade phase), the name is misleading and makes the SMB-W upgrade path harder to understand. Consider renaming to something frontend-generic or adding a dedicated wrapper for SMB-W that calls the shared helper.
e9a70f7 to
f4fc165
Compare
f4fc165 to
c268bd8
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 19 out of 19 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
c268bd8 to
f7f59e1
Compare
f7f59e1 to
1aeefab
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 19 out of 19 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
1aeefab to
c6d9a0b
Compare
c6d9a0b to
84ce4d9
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 19 out of 19 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
84ce4d9 to
021caef
Compare
021caef to
d310f51
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 19 out of 19 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| cmd := fmt.Sprintf("weka smb domain join %s %s", username, password) | ||
| _, stderr, err := executor.ExecSensitive(ctx, "JoinSmbwDomain", []string{"bash", "-ce", cmd}) | ||
| if err != nil { | ||
| stderrStr := stderr.String() |
There was a problem hiding this comment.
The domain-join command is built via string interpolation and executed through bash -ce, which allows shell injection if the username/password contain shell metacharacters (and will also break on spaces). Prefer calling the executable directly with an argv slice (e.g., []string{"weka", "smb", "domain", "join", username, password}) so inputs are not interpreted by a shell.
| cmd := fmt.Sprintf("weka smb domain join %s %s", username, password) | |
| _, stderr, err := executor.ExecSensitive(ctx, "JoinSmbwDomain", []string{"bash", "-ce", cmd}) | |
| if err != nil { | |
| stderrStr := stderr.String() | |
| _, stderr, err := executor.ExecSensitive(ctx, "JoinSmbwDomain", []string{"weka", "smb", "domain", "join", username, password}) | |
| if err != nil { | |
| stderrStr := stderr.String() | |
| stderrStr := stderr.String() |
| smbwContainers := r.SelectSmbwContainers(r.containers) | ||
| containerIds := []int{} | ||
| for _, c := range smbwContainers { | ||
| if len(containerIds) == config.Consts.FormSmbwClusterMaxContainerCount { | ||
| logger.Debug("Max SMB-W containers reached for initial SMB-W cluster creation", "maxContainers", config.Consts.FormSmbwClusterMaxContainerCount) | ||
| break | ||
| } | ||
|
|
||
| if c.Status.ClusterContainerID == nil { | ||
| msg := fmt.Sprintf("SMB-W container %s does not have a cluster container id", c.Name) | ||
| logger.Debug(msg) | ||
| continue | ||
| } | ||
| containerIds = append(containerIds, *c.Status.ClusterContainerID) | ||
| } |
There was a problem hiding this comment.
SMB-W cluster creation selects all SMB-W containers from r.containers without filtering for running/ready state. This can include terminating/not-yet-running containers and lead to using stale ClusterContainerIDs or waiting indefinitely. Consider mirroring the S3 logic (discovery.SelectRunningContainersByRole or equivalent) so only running SMB-W containers with valid IDs are considered for initial cluster formation.
| &lifecycle.SimpleStep{ | ||
| Predicates: lifecycle.Predicates{ | ||
| loop.HasSmbwContainers, | ||
| }, | ||
| State: &lifecycle.State{ | ||
| Name: condition.CondSmbwClusterCreated, | ||
| }, | ||
| Run: loop.EnsureSmbwCluster, |
There was a problem hiding this comment.
These SMB-W post-cluster steps are gated by HasSmbwContainers, which (as currently implemented) counts all SMB-W CRs, not just running/ready ones. This differs from the S3/NFS gating (HasRunning...Containers) and can cause repeated waits or re-creation attempts during scale-down/deletion. Consider gating on running SMB-W containers (or adding a HasRunningSmbwContainers predicate) to match the established pattern.
| } | ||
| } | ||
| if prepareForUpgrade { | ||
| err := r.prepareForUpgradeS3(ctx, smbwContainers, targetVersion) |
There was a problem hiding this comment.
This upgrade path reuses prepareForUpgradeS3 for SMB-W containers. That helper logs/labels itself as S3 and hardcodes the "frontend" upgrade phase; if SMB-W uses a distinct upgrade phase or you rely on logs/metrics for debugging, this will be misleading or incorrect. Consider introducing a generic prepareForUpgradeFrontend helper (or a dedicated SMB-W variant) and using the correct naming/phase.
| err := r.prepareForUpgradeS3(ctx, smbwContainers, targetVersion) | |
| err := r.prepareForUpgradeFrontend(ctx, smbwContainers, targetVersion) |
d310f51 to
0235f70
Compare
0235f70 to
e1ff068
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 19 out of 19 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| Drive: config.DriveContainers, | ||
| S3: config.S3Containers, | ||
| Nfs: config.NfsContainers, | ||
| Smbw: config.SmbwContainers, |
There was a problem hiding this comment.
There is inconsistent indentation/alignment in this struct literal (e.g., tabs/spaces around the Smbw field). Please run gofmt on the file to keep formatting consistent and avoid noisy diffs later.
| Smbw: config.SmbwContainers, | |
| Smbw: config.SmbwContainers, |
Merge activity
|

No description provided.