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 Ingress overlay to access Catalog contents outside of the cluster #209

Merged
Merged
Show file tree
Hide file tree
Changes from 3 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
7 changes: 7 additions & 0 deletions config/nginx-ingress/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

resources:
- ../default
- resources/nginx_ingress.yaml
- https://raw.githubusercontent.com/kubernetes/ingress-nginx/main/deploy/static/provider/kind/deploy.yaml
rashmigottipati marked this conversation as resolved.
Show resolved Hide resolved
17 changes: 17 additions & 0 deletions config/nginx-ingress/resources/nginx_ingress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: catalogd-ingress
namespace: catalogd-system
spec:
ingressClassName: nginx
everettraven marked this conversation as resolved.
Show resolved Hide resolved
rules:
- http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: catalogd-catalogserver
port:
number: 80
78 changes: 78 additions & 0 deletions docs/fetching-catalog-contents.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,81 @@ An example `curl` request that assumes the port-forwarding is mapped to port 808
```sh
curl http://localhost:8080/catalogs/operatorhubio/all.json
```

# Fetching `Catalog` contents from the `Catalogd` Service outside of the cluster

This section outlines a way of exposing the `Catalogd` Service's endpoints outside the cluster and then accessing the catalog contents using `Ingress`.

**Prerequisites**

- [Install kind](https://kind.sigs.k8s.io/docs/user/quick-start/#installation)
- Assuming `kind` is installed, create a `kind` cluster with `extraPortMappings` and `node-labels` as shown in the [kind documentation](https://kind.sigs.k8s.io/docs/user/ingress/)
- Install latest version of `Catalogd` by navigating to the [releases page](https://github.com/operator-framework/catalogd/releases) and following the install instructions included in the release you want to install.
rashmigottipati marked this conversation as resolved.
Show resolved Hide resolved
- Install the `Ingress NGINX` Controller by running the below command:
rashmigottipati marked this conversation as resolved.
Show resolved Hide resolved

```sh
$ kubectl apply -k https://github.com/operator-framework/catalogd/tree/main/config/nginx-ingress
```
By running tha above command, the `Ingress` Controller is installed. Along with it, the `Ingress` Resource will be applied automatically as well, thereby creating an `Ingress` Object on the cluster.
rashmigottipati marked this conversation as resolved.
Show resolved Hide resolved

1. Once the prerequisites are satisfied, create a `Catalog` object that points to the OperatorHub Community catalog by running the following command:

```sh
$ kubectl apply -f - << EOF
apiVersion: catalogd.operatorframework.io/v1alpha1
kind: Catalog
metadata:
name: operatorhubio
spec:
source:
type: image
image:
ref: quay.io/operatorhubio/catalog:latest
EOF
```

1. Before proceeding further, let's verify that the `Catalog` object was created successfully by running the below command:

```sh
$ kubectl describe catalog/operatorhubio
```

1. At this point the `Catalog` object exists and `Ingress` controller is ready to process requests. The sample `Ingress` Resource that was created during Step 4 of Prerequisites is shown as below:

```yaml
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: catalogd-nginx-ingress
namespace: catalogd-system
spec:
ingressClassName: nginx
rules:
- http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: catalogd-catalogserver
port:
number: 80
```
Let's verify that the `Ingress` object got created successfully from the sample by running the following command:

```sh
$ kubectl describe ingress/catalogd-ingress -n catalogd-system
```

1. Run the below example `curl` request to retrieve all of the catalog contents:

```sh
$ curl http://<address>/catalogs/operatorhubio/all.json
```

To obtain `address` of the ingress object, you can run the below command and look for the value in the `ADDRESS` field from output:
```sh
$ kubectl -n catalogd-system get ingress
```

You can further use the `curl` commands outlined in the [Catalogd README](https://github.com/operator-framework/catalogd/blob/main/README.md) to filter out the JSON content by list of bundles, channels & packages.