Documentation ¶
Overview ¶
Package usage is responsible for reporting NGINX Plus usage data.
Index ¶
- func CollectNodeCount(ctx context.Context, k8sClient client.Reader) (int, error)
- func CreateUsageJobWorker(logger logr.Logger, k8sClient client.Reader, reporter Reporter, ...) func(ctx context.Context)
- func GetTotalNGFPodCount(ctx context.Context, k8sClient client.Reader) (int, error)
- type ClusterDetails
- type CurrentPodsCount
- type Metadata
- type NIMReporter
- type PodDetails
- type Reporter
- type Secret
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CollectNodeCount ¶
CollectNodeCount returns the number of nodes in the cluster.
func CreateUsageJobWorker ¶
Types ¶
type ClusterDetails ¶
type ClusterDetails struct { // Metadata contains the cluster metadata. Metadata Metadata `json:"metadata"` // PodDetails contain the details about the NGF Pod. PodDetails PodDetails `json:"pod_details"` // NodeCount is the count of Nodes in the cluster. NodeCount int64 `json:"node_count"` }
ClusterDetails are the k8s usage details for the cluster.
type CurrentPodsCount ¶
type CurrentPodsCount struct { // PodCount is the current count of NGF NGINX Plus Pods in the cluster. PodCount int64 `json:"pod_count"` // DosCount is the count of Pods with NAP DOS enabled in the cluster. Not applicable for NGF, // but required as part of the payload. DosCount int64 `json:"dos_count"` // WafCount is the count of Pods with NAP WAF enabled in the cluster. Not applicable for NGF, // but required as part of the payload. WafCount int64 `json:"waf_count"` }
CurrentPodsCount is the total count of NGF NGINX Plus Pods in the cluster.
type Metadata ¶
type Metadata struct { // DisplayName is a user friendly resource name. It can be used to define // a longer, and less constrained, name for a resource. DisplayName string `json:"displayName"` // UID is the unique identifier for the cluster. UID string `json:"uid"` }
Metadata contains the cluster metadata.
type NIMReporter ¶
type NIMReporter struct {
// contains filtered or unexported fields
}
NIMReporter reports the NGINX Plus usage info to NGINX Instance Manager.
func NewNIMReporter ¶
func NewNIMReporter( credentials credentialsGetter, baseURL string, insecureSkipVerify bool, ) (*NIMReporter, error)
NewNIMReporter creates a new NIM usage reporter.
func (*NIMReporter) Report ¶
func (r *NIMReporter) Report(ctx context.Context, data ClusterDetails) error
Report sends a PUT request with the provided data to the API endpoint configured in the Reporter. The clusterUID is used as the name in the API path.
type PodDetails ¶
type PodDetails struct { // CurrentPodsCount is the total count of NGF NGINX Plus Pods in the cluster. CurrentPodCounts CurrentPodsCount `json:"current_pod_counts"` }
PodDetails contain the details about the NGF Pod.
type Reporter ¶
type Reporter interface {
Report(context.Context, ClusterDetails) error
}
Reporter reports the NGINX Plus usage info to the provided collector.
type Secret ¶
type Secret struct {
// contains filtered or unexported fields
}
Secret implements the SecretStorer interface.
func (*Secret) GetCredentials ¶
GetCredentials returns the base64 encoded username and password from the Secret.