Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 20 additions & 7 deletions .github/workflows/sanity.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,26 @@ jobs:
verify:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-go@v5
with:
go-version-file: "go.mod"
- name: Run verification checks
run: make verify
- uses: actions/checkout@v4
with:
path: operator-controller
- uses: actions/setup-go@v5
with:
go-version-file: "operator-controller/go.mod"
- name: Get catalogd version
id: get-catalogd-version
run: |
cd operator-controller
echo "CATALOGD_VERSION=$(go list -mod=mod -m -f "{{.Version}}" github.com/operator-framework/catalogd)" >> "$GITHUB_OUTPUT"
- uses: actions/checkout@v4
with:
repository: operator-framework/catalogd
path: catalogd
ref: "${{ steps.get-catalogd-version.outputs.CATALOGD_VERSION }}"
- name: Run verification checks
run: |
cd operator-controller
make verify
lint:
runs-on: ubuntu-latest
steps:
Expand Down
17 changes: 11 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -300,13 +300,18 @@ quickstart: $(KUSTOMIZE) manifests #EXHELP Generate the installation release man
##@ Docs

.PHONY: crd-ref-docs
API_REFERENCE_FILENAME := operator-controller-api-reference.md
crd-ref-docs: $(CRD_REF_DOCS)
rm -f $(ROOT_DIR)/docs/refs/api/$(API_REFERENCE_FILENAME)
OPERATOR_CONTROLLER_API_REFERENCE_FILENAME := operator-controller-api-reference.md
CATALOGD_API_REFERENCE_FILENAME := catalogd-api-reference.md
CATALOGD_PATH := "$(ROOT_DIR)/../catalogd"
crd-ref-docs: $(CRD_REF_DOCS) #EXHELP Generate the API Reference Documents. NOTE: catalogd must be cloned into operator-controller's parent directory.
rm -f $(ROOT_DIR)/docs/refs/api/$(OPERATOR_CONTROLLER_API_REFERENCE_FILENAME)
$(CRD_REF_DOCS) --source-path=$(ROOT_DIR)/api \
--config=$(ROOT_DIR)/config/base/crd/bases/olm.operatorframework.io_clusterextensions.yaml \
--renderer=markdown \
--output-path=$(ROOT_DIR)/docs/refs/api/$(API_REFERENCE_FILENAME)
--config=$(ROOT_DIR)/docs/refs/api/crd-ref-docs-gen-config.yaml \
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'd misunderstood the usage of this flag when I first implemented this, but turns out if you don't specify --source-path and do specify --config as your CRD file, it generates the same doc. Confusing? Or maybe it finds the api folder automatically if not specified?

Regardless, this is the actual intended usage. --config specifies a configuration file for the generator. At the moment we just specify the reference k8s version, which also consequently fixes the broken k8s API reference links in our doc.

Copy link
Member

Choose a reason for hiding this comment

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

Non-blocking meta question:

Is there a way to specify a CRD instead? I ask because I know there have been cases in the past (and maybe present?) where we patch the CRD via kustomize after generating it from Go code.

If we generate from Go code, the docs don't account for those patches.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

From what I can tell, no, the api/ folder is the only available source of truth for this tool. If the --source-path isn't specified, it'll crawl through your folder structure and find the api/ folder itself.

Do you have an example of what kind of change we would make from a patch like that? Something like field descriptions, validations, or other things not required to be present in the _types.go file is what I was thinking of. We may be able to cover this kind of thing using their custom markers and templates (reference).

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

@joelanford I think we should ensure that we are appropriately tracking any and all validations, even if they are kustomize patches, in the GoDoc of the field(s) associated with it. In the example from catalogd, I would expect the GoDoc in the ClusterCatalog.Spec.Source type to reflect that the image field is required if the source type is set to image

--renderer=markdown --output-path=$(ROOT_DIR)/docs/refs/api/$(OPERATOR_CONTROLLER_API_REFERENCE_FILENAME);
rm -f $(ROOT_DIR)/docs/refs/api/$(CATALOGD_API_REFERENCE_FILENAME)
$(CRD_REF_DOCS) --source-path=$(CATALOGD_PATH)/api \
--config=$(ROOT_DIR)/docs/refs/api/crd-ref-docs-gen-config.yaml \
--renderer=markdown --output-path=$(ROOT_DIR)/docs/refs/api/$(CATALOGD_API_REFERENCE_FILENAME)

VENVDIR := $(abspath docs/.venv)

Expand Down
192 changes: 192 additions & 0 deletions docs/refs/api/catalogd-api-reference.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,192 @@
# API Reference

## Packages
- [olm.operatorframework.io/core](#olmoperatorframeworkiocore)
- [olm.operatorframework.io/v1alpha1](#olmoperatorframeworkiov1alpha1)


## olm.operatorframework.io/core

Package api is the internal version of the API.




## olm.operatorframework.io/v1alpha1

Package v1alpha1 contains API Schema definitions for the core v1alpha1 API group

### Resource Types
- [ClusterCatalog](#clustercatalog)
- [ClusterCatalogList](#clustercataloglist)



#### CatalogSource



CatalogSource contains the sourcing information for a Catalog



_Appears in:_
- [ClusterCatalogSpec](#clustercatalogspec)

| Field | Description | Default | Validation |
| --- | --- | --- | --- |
| `type` _[SourceType](#sourcetype)_ | type defines the kind of Catalog content being sourced. | | Enum: [image] <br />Required: \{\} <br /> |
| `image` _[ImageSource](#imagesource)_ | image is the catalog image that backs the content of this catalog. | | |


#### ClusterCatalog



ClusterCatalog is the Schema for the ClusterCatalogs API



_Appears in:_
- [ClusterCatalogList](#clustercataloglist)

| Field | Description | Default | Validation |
| --- | --- | --- | --- |
| `apiVersion` _string_ | `olm.operatorframework.io/v1alpha1` | | |
| `kind` _string_ | `ClusterCatalog` | | |
| `kind` _string_ | Kind is a string value representing the REST resource this object represents.<br />Servers may infer this from the endpoint the client submits requests to.<br />Cannot be updated.<br />In CamelCase.<br />More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds | | |
| `apiVersion` _string_ | APIVersion defines the versioned schema of this representation of an object.<br />Servers should convert recognized schemas to the latest internal value, and<br />may reject unrecognized values.<br />More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources | | |
| `metadata` _[ObjectMeta](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.31/#objectmeta-v1-meta)_ | Refer to Kubernetes API documentation for fields of `metadata`. | | |
| `spec` _[ClusterCatalogSpec](#clustercatalogspec)_ | | | |
| `status` _[ClusterCatalogStatus](#clustercatalogstatus)_ | | | |


#### ClusterCatalogList



ClusterCatalogList contains a list of ClusterCatalog





| Field | Description | Default | Validation |
| --- | --- | --- | --- |
| `apiVersion` _string_ | `olm.operatorframework.io/v1alpha1` | | |
| `kind` _string_ | `ClusterCatalogList` | | |
| `kind` _string_ | Kind is a string value representing the REST resource this object represents.<br />Servers may infer this from the endpoint the client submits requests to.<br />Cannot be updated.<br />In CamelCase.<br />More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds | | |
| `apiVersion` _string_ | APIVersion defines the versioned schema of this representation of an object.<br />Servers should convert recognized schemas to the latest internal value, and<br />may reject unrecognized values.<br />More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources | | |
| `metadata` _[ListMeta](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.31/#listmeta-v1-meta)_ | Refer to Kubernetes API documentation for fields of `metadata`. | | |
| `items` _[ClusterCatalog](#clustercatalog) array_ | | | |


#### ClusterCatalogSpec



ClusterCatalogSpec defines the desired state of ClusterCatalog



_Appears in:_
- [ClusterCatalog](#clustercatalog)

| Field | Description | Default | Validation |
| --- | --- | --- | --- |
| `source` _[CatalogSource](#catalogsource)_ | source is the source of a Catalog that contains catalog metadata in the FBC format<br />https://olm.operatorframework.io/docs/reference/file-based-catalogs/#docs | | |
| `priority` _integer_ | priority is used as the tie-breaker between bundles selected from different catalogs; a higher number means higher priority. | 0 | |


#### ClusterCatalogStatus



ClusterCatalogStatus defines the observed state of ClusterCatalog



_Appears in:_
- [ClusterCatalog](#clustercatalog)

| Field | Description | Default | Validation |
| --- | --- | --- | --- |
| `conditions` _[Condition](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.31/#condition-v1-meta) array_ | conditions store the status conditions of the ClusterCatalog instances | | |
| `resolvedSource` _[ResolvedCatalogSource](#resolvedcatalogsource)_ | resolvedSource contains information about the resolved source | | |
| `contentURL` _string_ | contentURL is a cluster-internal address that on-cluster components<br />can read the content of a catalog from | | |
| `observedGeneration` _integer_ | observedGeneration is the most recent generation observed for this ClusterCatalog. It corresponds to the<br />ClusterCatalog's generation, which is updated on mutation by the API Server. | | |
| `lastUnpacked` _[Time](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.31/#time-v1-meta)_ | LastUnpacked represents the time when the<br />ClusterCatalog object was last unpacked. | | |


#### ImageSource



ImageSource contains information required for sourcing a Catalog from an OCI image



_Appears in:_
- [CatalogSource](#catalogsource)

| Field | Description | Default | Validation |
| --- | --- | --- | --- |
| `ref` _string_ | ref contains the reference to a container image containing Catalog contents. | | |
| `pullSecret` _string_ | pullSecret contains the name of the image pull secret in the namespace that catalogd is deployed. | | |
| `pollInterval` _[Duration](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.31/#duration-v1-meta)_ | pollInterval indicates the interval at which the image source should be polled for new content,<br />specified as a duration (e.g., "5m", "1h", "24h", "etc".). Note that PollInterval may not be<br />specified for a catalog image referenced by a sha256 digest. | | Format: duration <br /> |
| `insecureSkipTLSVerify` _boolean_ | insecureSkipTLSVerify indicates that TLS certificate validation should be skipped.<br />If this option is specified, the HTTPS protocol will still be used to<br />fetch the specified image reference.<br />This should not be used in a production environment. | | |


#### ResolvedCatalogSource



ResolvedCatalogSource contains the information about a sourced Catalog



_Appears in:_
- [ClusterCatalogStatus](#clustercatalogstatus)

| Field | Description | Default | Validation |
| --- | --- | --- | --- |
| `type` _[SourceType](#sourcetype)_ | type defines the kind of Catalog content that was sourced. | | Enum: [image] <br />Required: \{\} <br /> |
| `image` _[ResolvedImageSource](#resolvedimagesource)_ | image is the catalog image that backs the content of this catalog. | | |


#### ResolvedImageSource



ResolvedImageSource contains information about the sourced Catalog



_Appears in:_
- [ResolvedCatalogSource](#resolvedcatalogsource)

| Field | Description | Default | Validation |
| --- | --- | --- | --- |
| `ref` _string_ | ref contains the reference to a container image containing Catalog contents. | | |
| `resolvedRef` _string_ | resolvedRef contains the resolved sha256 image ref containing Catalog contents. | | |
| `lastPollAttempt` _[Time](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.31/#time-v1-meta)_ | lastPollAtempt is the time when the source resolved was last polled for new content. | | |
| `lastUnpacked` _[Time](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.31/#time-v1-meta)_ | LastUnpacked is the time when the catalog contents were successfully unpacked. | | |


#### SourceType

_Underlying type:_ _string_





_Appears in:_
- [CatalogSource](#catalogsource)
- [ResolvedCatalogSource](#resolvedcatalogsource)

| Field | Description |
| --- | --- |
| `image` | |


7 changes: 7 additions & 0 deletions docs/refs/api/crd-ref-docs-gen-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
processor:
ignoreTypes: []
ignoreFields: []

render:
# Version of Kubernetes to use when generating links to Kubernetes API documentation.
kubernetesVersion: 1.31
Loading
Loading