cluster: introduce Machine.Inactive flag #38

Merged
amery merged 3 commits from pr-amery-dns-ignore into main 2023-10-30 20:44:42 +01:00
Owner

reflected on disk as none on a file named region

these machines won't be included in the regional or zonal aliases

reflected on disk as `none` on a file named `region` these machines won't be included in the regional or zonal aliases
amery added 3 commits 2023-10-30 19:59:19 +01:00
Signed-off-by: Alejandro Mery <amery@jpi.io>
if a Machine is Inactive, it won't be included on the DNS
aliases for the zone or it's regions.

Signed-off-by: Alejandro Mery <amery@jpi.io>
Signed-off-by: Alejandro Mery <amery@jpi.io>
amery requested review from karasz 2023-10-30 19:59:51 +01:00
karasz requested changes 2023-10-30 20:05:45 +01:00
karasz left a comment
Owner

see comments

see comments
@@ -15,6 +15,7 @@ type Machine struct {
ID int
Name string `json:"-" yaml:"-"`
Inactive bool `json:"inactive,omitempty" yaml:"inactive,omitempty"`
Owner

Please name the field Active

Please name the field `Active`
Author
Owner

Active breaks zero-value rules, everything would become inactive by default

`Active` breaks zero-value rules, everything would become inactive by default
@@ -46,0 +48,4 @@
func (m *Machine) Active() bool {
return !m.Inactive
}
Owner
func (m *Machine) IsActive() bool {
	return m.Active
}
```go func (m *Machine) IsActive() bool { return m.Active }
amery marked this conversation as resolved
@@ -85,0 +99,4 @@
for _, r := range data {
switch r {
case "none":
m.Inactive = true
Owner

please see above s/Inactive/Active/ and switch logic.

please see above s/Inactive/Active/ and switch logic.
@@ -33,3 +33,3 @@
z.ForEachMachine(func(p *Machine) bool {
term = fn(p)
if p.Active() {
Owner
if p.IsActive() {
...
```go if p.IsActive() { ... ```
amery marked this conversation as resolved
Author
Owner

@karasz it's currently called Inactive to deal with the zero value. Active by default, otherwise indicated.

@karasz it's currently called Inactive to deal with the zero value. Active by default, otherwise indicated.
amery added 2 commits 2023-10-30 20:21:15 +01:00
if a Machine is Inactive, it won't be included on the DNS
aliases for the zone or it's regions.

v2:
- Machine.Active() renamed to Machine.IsActive()

Signed-off-by: Alejandro Mery <amery@jpi.io>
Signed-off-by: Alejandro Mery <amery@jpi.io>
Author
Owner

Machine.Active() renamed to Machine.IsActive()

`Machine.Active()` renamed to `Machine.IsActive()`
amery requested review from karasz 2023-10-30 20:27:28 +01:00
karasz approved these changes 2023-10-30 20:37:02 +01:00
karasz left a comment
Owner

LGTM

LGTM
amery merged commit a910bba406 into main 2023-10-30 20:44:42 +01:00
amery deleted branch pr-amery-dns-ignore 2023-10-30 20:44:42 +01:00
Sign in to join this conversation.
No Reviewers
No Label
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: amery/jpictl#38