npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

openshift-apidocs-gen

v1.0.6

Published

OpenShift API reference documentation generator.

Downloads

109

Readme

OpenShift OpenAPI reference documentation generator

This tool generates documentation for the OpenShift OpenAPI specification for a running a cluster. The APIs included in the OpenAPI spec file are specific to the cluster from which the spec originates.

(If you want to immediately access the OpenShift API reference documentation, it is available as part of the official OpenShift Container Platform documentation.)

Configuration format

The configuration supports the following keys. Only uncommented keys are supported in the current release.

version: 2
outputDir: build
#apisToHide: []
#apiSupportLevels: {}
#packageMap: {}
apiMap: []

The apiMap key specifies an array of nested objects defining OpenShift APIs, with each object describing a related set of APIs.

Every key is required.

The values for the keys kind, group, version, plural, and namespaced are found in the output of oc api-resources on recent versions of OpenShift based on Kubernetes v1.20.

- name: Authorization APIs
  resources:
  - kind: LocalResourceAccessReview
    group: authorization.openshift.io
    version: v1
    plural: localresourceaccessreviews
    namespaced: true
- name: Autoscale APIs
  resources:
  - kind: ClusterAutoscaler
    group: autoscaling.openshift.io
    version: v1
    plural: clusterautoscalers
    namespaced: false

For convenience, the script hack/create-resources.js automatically generates the previous YAML output for a given OpenAPI spec file.

How to install

This tool is written in JavaScript and depends on NodeJS to run.

Prerequisites

Procedure

npm i -g openshift-apidocs-gen

CLI help

A list of commands and expected parameters is available from the tool itself:

openshift-apidocs-gen --help
Usage: openshift-apidocs-gen [options] [command]

Options:
  -h, --help                             display help for command

Commands:
  build [options] <oapiSpecFile>         Build the Asciidoc source for the OpenShift API reference documentation
  topic-map [resource_map]               Output YAML to stdout suitable for inclusion in an AsciiBinder _topic_map.yml file
  changelog [options] [oapiSpecFile]     Output a changelog to stdout for a specified resource map
  verify-rules [options] [oapiSpecFile]  Output a list of API resources in an OpenShift OpenAPI spec file
  help [command]                         display help for command

Typical usage

The following procedure reflects typical usage. For each new release of OpenShift, the apiMap must be adjusted accordingly as APIs are added and API versions increment, or APIs are dropped.

Prerequisites

Procedure

  1. Log in to an OpenShift cluster with cluster-admin privileges.

  2. Run oc get --raw /openapi/v2 | jq . > /tmp/openshift-openapi-<version>-<yyyymmdd>.json.

  3. Run oc api-resources > /tmp/api-resources-<version>-<yyyymmdd>.txt.

  4. Confirm that no package matching rules are missing:

    openshift-apidocs-gen verify-rules -q /tmp/<openshift_apis>.json

    Currently, if a new rule is necessary, this software needs to be updated before the API documentation can be generated. Otherwise, the API documentation related to the missing rules cannot be generated.

  5. Generate an API map:

    hack/create-resources.js /tmp/<api_resources>.txt /tmp/<openshift_apis>.json > /tmp/map.yaml
  6. Create a configuration file and populate the apiMap key with the YAML from map.yaml generated in the previous step.

    A legacy mode supports using the YAML as-is, without the version: v2 configuration keys, but support for this may be deprecated and removed in the future.

  7. Generate the API docs:

    openshift-apidocs-gen build --map <config>.yaml /tmp/<openshift_apis>.json
  8. Build the HTML documentation, such as with the following command:

    find build -type f -name '*.adoc' | xargs -L1 -I^ -P1 asciidoctor -a toc -d book ^

Known issues

For known issues, refer to GitHub.