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

Add ttr, the time-to-readiness reporting tool for managed resources #71

Merged
merged 1 commit into from
Apr 17, 2023

Conversation

ulucinar
Copy link
Contributor

@ulucinar ulucinar commented Mar 2, 2023

Description of your changes

Fixes #69

This PR proposes a standalone, reusable time-to-readiness (ttr) reporting tool for managed resources. ttr is defined as the time it takes for a managed resource to acquire the Ready=True condition from the moment it's provisioned (metadata.creationTimestamp), measured in seconds and was proposed here. This tool can be run against a cluster to collect the ttr measurements of a subset of managed resources found in the cluster. The subset of managed resources can be specified with a list of filter strings via the --filters command-line option.

Some example invocations of the tool are:

  • ttr -> Report on all managed resources
  • ttr -f cognitoidp.aws.upbound.io/v1beta1/UserPool/example
  • ttr -f //UserPool/ -> Report all UserPool resources
  • ttr -f //UserPool/ -f //VPC/ -> Report all UserPool and VPC resources
  • ttr -f cognitoidp.aws.upbound.io/// -> Report all resources in the group
  • ttr -f ///example-.* -> Report all resources with names prefixed by example-

Sample output:

❯ ttr
cognitoidp.aws.upbound.io/v1beta1/UserPool/example-alper:20
cognitoidp.aws.upbound.io/v1beta1/UserPool/example-alper2:18

The output syntax is <API group>/<API version>/<Kind>/<metadata.name>:<ttr> on each line. The reported ttr is in seconds.

Command's usage document:

❯ ./_output/bin/darwin_arm64/ttr -h
Reports the time-to-readiness measurements for a subset of the managed resources in a Kubernetes cluster

Usage:
  ttr [flags]

Examples:
ttr --kubeconfig=./kubeconfig

Flags:
      --as string                      Username to impersonate for the operation. User could be a regular user or a service account in a namespace.
      --as-group stringArray           Group to impersonate for the operation, this flag can be repeated to specify multiple groups.
      --as-uid string                  UID to impersonate for the operation.
      --cache-dir string               Default cache directory (default "/Users/alper/.kube/cache")
      --certificate-authority string   Path to a cert file for the certificate authority
      --client-certificate string      Path to a client certificate file for TLS
      --client-key string              Path to a client key file for TLS
      --cluster string                 The name of the kubeconfig cluster to use
      --context string                 The name of the kubeconfig context to use
      --disable-compression            If true, opt-out of response compression for all requests to the server
  -f, --filters stringArray            Zero or more filter expressions each with the following syntax: [group]/[version]/[kind]/[name regex]. Can be repeated. Filters managed resources with the specified APIs and names. Missing entries should be specified as empty strings.
  -h, --help                           help for ttr
      --insecure-skip-tls-verify       If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure
      --kubeconfig string              Path to the kubeconfig file to use for CLI requests.
  -n, --namespace string               If present, the namespace scope for this CLI request
      --request-timeout string         The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests. (default "0")
  -s, --server string                  The address and port of the Kubernetes API server
      --tls-server-name string         Server name to use for server certificate validation. If it is not provided, the hostname used to contact the server is used
      --token string                   Bearer token for authentication to the API server
      --user string                    The name of the kubeconfig user to use

I have:

  • Run make reviewable test to ensure this PR is ready for review.

How has this code been tested

Tested against provider-aws resources.

Copy link
Member

@sergenyalcin sergenyalcin left a comment

Choose a reason for hiding this comment

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

Thanks @ulucinar LGTM!

Signed-off-by: Alper Rifat Ulucinar <ulucinar@users.noreply.github.com>
@ulucinar ulucinar merged commit 3eecf2d into upbound:main Apr 17, 2023
@ulucinar ulucinar deleted the fix-69 branch April 17, 2023 15:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Time-to-readiness reporting tool
2 participants