-
Notifications
You must be signed in to change notification settings - Fork 13
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
ROX-14544 - Add CentralRequest field documentation #743
Conversation
Skipping CI for Draft Pull Request. |
Region string `json:"region"` | ||
// ClusterID is the data-plane cluster ID | ||
ClusterID string `json:"cluster_id" gorm:"index"` | ||
// CloudProvider ... | ||
CloudProvider string `json:"cloud_provider"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Double-check in production in production system
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cloud provider that runs the data plane instance. Also the cloud provider that owns the customer account we bill again.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
Region string `json:"region"` | ||
// ClusterID is the data-plane cluster ID | ||
ClusterID string `json:"cluster_id" gorm:"index"` | ||
// CloudProvider ... | ||
CloudProvider string `json:"cloud_provider"` | ||
CloudAccountID string `json:"cloud_account_id"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Double-check in production in production system. Maybe remove it (cc @johannes94)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe it is used by @kovayur, see:
rr.BillingMarketplaceAccount(dinosaur.CloudAccountID)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the billing cloud account, definitely don't remove or we won't get paid ;-).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
MultiAZ bool `json:"multi_az"` | ||
// MultiAZ enables multi AZ support | ||
MultiAZ bool `json:"multi_az"` | ||
// Name of the ACS instance | ||
Name string `json:"name" gorm:"index"` | ||
Status string `json:"status" gorm:"index"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lifecycle status of the CentralRequest, link to constants
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
MultiAZ bool `json:"multi_az"` | ||
// MultiAZ enables multi AZ support | ||
MultiAZ bool `json:"multi_az"` | ||
// Name of the ACS instance | ||
Name string `json:"name" gorm:"index"` | ||
Status string `json:"status" gorm:"index"` | ||
SubscriptionID string `json:"subscription_id"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
by @kovayur
SubscriptionID is returned by ams (ocm) when the user’s (owner) quota is reserved for Central
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Owner
= OCM owner who created the tenant (email), how is it populated? (Identify ID type, seems to be different for RH employees joined after a specific date, or based on the preferred username (OpenID feature, ocm whoami
prints the active username))
OwnerAccountID
and OrganisationID
maybe the same fields.
Code snippet:
dinosaurRequest.Owner, _ = claims.GetUsername()
dinosaurRequest.OrganisationID, _ = claims.GetOrgID()
dinosaurRequest.OwnerAccountID, _ = claims.GetAccountID()
dinosaurRequest.OwnerUserID, _ = claims.GetUserID()
tenantUsernameClaim = "username"
//--------------
// GetUsername ...
func (c *ACSClaims) GetUsername() (string, error) {
if idx, val := arrays.FindFirst(func(x interface{}) bool { return x != nil },
(*c)[tenantUsernameClaim], (*c)[alternateTenantUsernameClaim]); idx != -1 {
if userName, ok := val.(string); ok {
return userName, nil
}
}
return "", fmt.Errorf("can't find neither %q or %q attribute in claims",
tenantUsernameClaim, alternateTenantUsernameClaim)
}
//--------------
// sso.redhat.com token claim keys.
alternateTenantUsernameClaim = "preferred_username"
tenantUserIDClaim = "account_id"
tenantSubClaim = "sub"
// Only service accounts that have been created via the service_accounts API have this claim set.
alternateTenantIDClaim = "rh-org-id
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OwnerUserID
, OwnerAccountID
needs investigation. Is the same in @johannes94 database. Not equal to organisation ID.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
organisation ID and organisation name are the Red Hat SSO organisation identifiers - it identifies a customer organisation, e.g. 16678382
and IBM
. We need the id for authn/z, and the name for observability purposes. There can be many users that part of one customer organisation - for example, all Red Hat employee accounts are part of org_id=11009103
.
OwnerAccountID
will be used in telemetry, it is the account_id
claim of the Red Hat SSO token. OwnerUserID
is the subject claim (confusingly it is NOT the user_id
claim) of the Red Hat SSO token - this one I don't know if we use it anywhere.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Owner
is the Red Hat SSO login name. It is either the email, or the user name, depending on what the user chose to login with. It's displayed in the console UI.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@stehessel Where do you see the OrganisationName
? I could find the field in the CentralRequest
struct.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rebased and added it
MultiAZ bool `json:"multi_az"` | ||
// MultiAZ enables multi AZ support | ||
MultiAZ bool `json:"multi_az"` | ||
// Name of the ACS instance | ||
Name string `json:"name" gorm:"index"` | ||
Status string `json:"status" gorm:"index"` | ||
SubscriptionID string `json:"subscription_id"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SubscriptionID
is returned by AMS and identifies a Central instance in their system. We need it to deregister instances again from AMS.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
55a38f3
to
e48a8a3
Compare
e48a8a3
to
aa9d806
Compare
Region string `json:"region"` | ||
ClusterID string `json:"cluster_id" gorm:"index"` | ||
CloudProvider string `json:"cloud_provider"` | ||
// Region is the cloud region the service is deployed in, i.e. us-east-1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you end sentence comments with a "." everywhere?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
MultiAZ bool `json:"multi_az"` | ||
Name string `json:"name" gorm:"index"` | ||
Status string `json:"status" gorm:"index"` | ||
// MultiAZ enables multi AZ support |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd spell out availability zone in the explanation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
SubscriptionID string `json:"subscription_id"` | ||
Owner string `json:"owner" gorm:"index"` // TODO: ocm owner? | ||
// Owner is the Red Hat SSO login name. It is either the email, or the user name, depending on what the user chose to login with. It's displayed in the console UI. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Owner is the Red Hat SSO login name. It is either the email, or the user name, depending on what the user chose to login with. It's displayed in the console UI. | |
// Owner is the Red Hat SSO login name of the user who created the instance. It is either the email, or the user name, depending on what the user chose to login with. It's displayed in the console UI. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
Owner string `json:"owner" gorm:"index"` // TODO: ocm owner? | ||
// Owner is the Red Hat SSO login name. It is either the email, or the user name, depending on what the user chose to login with. It's displayed in the console UI. | ||
Owner string `json:"owner" gorm:"index"` | ||
// OwnerAccountID is used in telemetry, it is the account_id claim of the Red Hat SSO token. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We switched to user_id
claim in telemetry. owner_account_id
is no longer used as far as I can tell.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is never read anywhere, only set once in fleet-manager. Is it safe to assume that we can remove it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How could I test that the change worked?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How could I test that the change worked?
You can take a look at Telemetry events in https://app.segment.com/redhat-devtools/sources/acs_instances_backend_dev/debugger.
Is it safe to assume that we can remove it?
I think we can remove this field, yes. Just need to be careful with backwards/forwards compatibility.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be okay for you to mark it here as deprecated and removing the field in a follow-up ticket?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah that makes sense.
OrganisationID string `json:"organisation_id" gorm:"index"` | ||
Host string `json:"host"` | ||
// OrganisationID is a Red Hat SSO organisation identifier to identify a customer. It is needed as an id for authn/z, and the name for observability purposes. | ||
OrganisationID string `json:"organisation_id" gorm:"index"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not 100% true (depends on definition of customer), it is just one customer organisation. For example IBM has many Red Hat orgs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed it to:
// OrganisationID identifies a customer's organisation. It is needed as an id for authn/z, and the name for observability purposes.
Host string `json:"host"` | ||
// OrganisationID is a Red Hat SSO organisation identifier to identify a customer. It is needed as an id for authn/z, and the name for observability purposes. | ||
OrganisationID string `json:"organisation_id" gorm:"index"` | ||
// OrganisationName is a Red Hat SSO organisation identifier to identify a customer. It is needed as an id for authn/z, and the name for observability purposes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Organisation names not unique. Its purpose is mostly human readability and observability purposes (e.g. display in dashboards).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for going over these 🚀
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: SimonBaeumer, stehessel The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
New changes are detected. LGTM label has been removed. |
Description
Added CentralRequest documentation.
Checklist (Definition of Done)
Test manual
ROX-12345: ...
Test manual