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

Enables the use of offline reason for all "offline" statuses (those that are not ONLINE/REPORTED) and makes it optional #7042

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

mitchell852
Copy link
Member

@mitchell852 mitchell852 commented Aug 29, 2022

This change treats any status that is not ONLINE/REPORTED as "offline" and therefore the offline reason is available for use.


Which Traffic Control components are affected by this PR?

  • Traffic Ops
  • Traffic Portal

What is the best way to verify this PR?

If this is a bugfix, which Traffic Control versions contained the bug?

PR submission checklist

@mitchell852 mitchell852 added Traffic Ops related to Traffic Ops Traffic Portal v1 related to Traffic Portal version 1 labels Aug 29, 2022
@@ -121,7 +121,7 @@ func UpdateStatusHandler(w http.ResponseWriter, r *http.Request) {
return
}

if *status.Name == tc.CacheStatusAdminDown.String() || *status.Name == tc.CacheStatusOffline.String() {
if *status.Name != tc.CacheStatusOnline.String() && *status.Name != tc.CacheStatusReported.String() {
if reqObj.OfflineReason == nil {
Copy link
Member Author

@mitchell852 mitchell852 Aug 29, 2022

Choose a reason for hiding this comment

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

this actually makes offline reason required for a bunch of statuses (anything that is not online/reported) so if this is considered a breaking api change, i will just hold off until api 5.x....or, the offline reason requirement could simply be removed and always optional if not online/reported.

@mitchell852 mitchell852 added the improvement The functionality exists but it could be improved in some way. label Aug 31, 2022
@mitchell852 mitchell852 changed the title Enables the use of "offline reason" for all statuses not ONLINE/REPORTED Enables the use of offline reason for all "offline" statuses (those that are not ONLINE/REPORTED) Aug 31, 2022
@@ -121,7 +121,7 @@ func UpdateStatusHandler(w http.ResponseWriter, r *http.Request) {
return
}

if *status.Name == tc.CacheStatusAdminDown.String() || *status.Name == tc.CacheStatusOffline.String() {
if *status.Name != tc.CacheStatusOnline.String() && *status.Name != tc.CacheStatusReported.String() {
Copy link
Contributor

Choose a reason for hiding this comment

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

So if I make a server have the status ONLINE1 or ONLINE_BUT_NOT_IN_SERVICE I then have to enter a reason why my ostensibly online server is offline?

Copy link
Member Author

@mitchell852 mitchell852 Aug 31, 2022

Choose a reason for hiding this comment

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

yes, unless we made "offline reason" always optional (never required as it is now) which makes more sense to me anyhow

Copy link
Member Author

Choose a reason for hiding this comment

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

ONLINE1 or ONLINE_BUT_NOT_IN_SERVICE is not considered "online" from TC's perspective :)

Copy link
Member Author

@mitchell852 mitchell852 Aug 31, 2022

Choose a reason for hiding this comment

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

well i guess it could be for some servers :) i.e. TP or TO where status has no impact and is purely informational

Copy link
Contributor

@ocket8888 ocket8888 Aug 31, 2022

Choose a reason for hiding this comment

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

Server statuses should not be mutable. It's one of a million places where we hijacked a concept to provide arbitrary informative tagging, which is better provided by actual tags. As it is, there's no guarantee that a status with any given name exists, or that a status with any given ID won't be renamed arbitrarily at any moment. Doing these kinds of checks becomes a lot easier once we can say what the actual values are and should mean.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, i get it but that ship has sailed (the immutable part), we already have many "offline" status types in production (i.e. TEST, PRE_PROD, DECOM, etc) that are all "offline" yet you can't add an offline reason to them.

Copy link
Contributor

Choose a reason for hiding this comment

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

That can be retconned:

  1. Implement tags
  2. Migrate existing, unrecognized statuses to tags
  3. Apply those tags on the servers that use those statuses
  4. Convert all unknown statuses to "OFFLINE"
  5. Eliminate the concept of a "Status" as an ATC object, use constant strings only.

@mitchell852 mitchell852 changed the title Enables the use of offline reason for all "offline" statuses (those that are not ONLINE/REPORTED) Enables the use of offline reason for all "offline" statuses (those that are not ONLINE/REPORTED) and makes it optional Aug 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
improvement The functionality exists but it could be improved in some way. Traffic Ops related to Traffic Ops Traffic Portal v1 related to Traffic Portal version 1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants