Skip to content
This repository was archived by the owner on Mar 3, 2025. It is now read-only.
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
16 changes: 13 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,20 @@ controller-gen: $(CONTROLLER_GEN) ## Download controller-gen locally if necessar
$(CONTROLLER_GEN): $(LOCALBIN)
GOBIN=$(LOCALBIN) go install sigs.k8s.io/controller-tools/cmd/controller-gen@$(CONTROLLER_TOOLS_VERSION)

KUSTOMIZE = $(shell pwd)/bin/kustomize
## Tool Binaries
KUSTOMIZE ?= $(LOCALBIN)/kustomize
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The deploy target is broken
(KUSTOMIZE) edit set image controller=${IMG}

That should be CONTROLLER_IMG

## Tool Versions
KUSTOMIZE_VERSION ?= v5.0.1

KUSTOMIZE_INSTALL_SCRIPT ?= "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh"
.PHONY: kustomize
kustomize: ## Download kustomize locally if necessary.
$(call go-get-tool,$(KUSTOMIZE),sigs.k8s.io/kustomize/kustomize/v3@v3.8.7)
kustomize: $(KUSTOMIZE) ## Download kustomize locally if necessary. If wrong version is installed, it will be removed before downloading.
$(KUSTOMIZE): $(LOCALBIN)
@if test -x $(LOCALBIN)/kustomize && ! $(LOCALBIN)/kustomize version | grep -q $(KUSTOMIZE_VERSION); then \
echo "$(LOCALBIN)/kustomize version is not expected $(KUSTOMIZE_VERSION). Removing it before installing."; \
rm -rf $(LOCALBIN)/kustomize; \
fi
test -s $(LOCALBIN)/kustomize || { curl -Ss $(KUSTOMIZE_INSTALL_SCRIPT) | bash -s -- $(subst v,,$(KUSTOMIZE_VERSION)) $(LOCALBIN); }

ENVTEST = $(shell pwd)/bin/setup-envtest
.PHONY: envtest
Expand Down
4 changes: 0 additions & 4 deletions config/00_namespace.yaml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,12 +1,42 @@
apiVersion: apiregistration.k8s.io/v1
kind: APIService
metadata:
name: v1beta1.catalogd.operatorframework.io
labels:
api: catalogd
apiserver: "true"
app.kubernetes.io/name: apiservice
app.kubernetes.io/instance: system
app.kubernetes.io/component: apiservice
app.kubernetes.io/created-by: catalogd
app.kubernetes.io/part-of: catalogd
app.kubernetes.io/managed-by: kustomize
annotations:
# Have cert manager inject the caBundle field using the cert we created
cert-manager.io/inject-ca-from: catalogd-system/server-cert
spec:
version: v1beta1
group: catalogd.operatorframework.io
groupPriorityMinimum: 2000
service:
name: catalogd
namespace: system
versionPriority: 10
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: catalogd-apiserver
namespace: catalogd-system
name: apiserver
namespace: system
labels:
api: catalogd
apiserver: "true"
app.kubernetes.io/name: deployment
app.kubernetes.io/instance: system
app.kubernetes.io/component: apiservice
app.kubernetes.io/created-by: catalogd
app.kubernetes.io/part-of: catalogd
app.kubernetes.io/managed-by: kustomize
spec:
selector:
matchLabels:
Expand All @@ -19,18 +49,19 @@ spec:
api: catalogd
apiserver: "true"
spec:
serviceAccountName: apiserver
containers:
- name: apiserver
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

For follow-up: we should setup the security context to make sure this can run under restricted PSA.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Yea I just remembered, there's already some pending work to make this compatible with restricted PSA : ref
I'll create an issue so that we can track this.

image: quay.io/operator-framework/catalogd-server:latest
image: apiserver:latest
imagePullPolicy: IfNotPresent
volumeMounts:
- name: apiserver-certs
- name: catalogd-apiserver-certs
mountPath: /apiserver.local.config/certificates
readOnly: true
command:
- "./apiserver"
args:
- "--etcd-servers=http://etcd-svc:2379"
- "--etcd-servers=http://catalogd-etcd-svc:2379"
- "--tls-cert-file=/apiserver.local.config/certificates/tls.crt"
- "--tls-private-key-file=/apiserver.local.config/certificates/tls.key"
- "--audit-log-path=-"
Expand All @@ -46,15 +77,15 @@ spec:
cpu: 100m
memory: 30Mi
volumes:
- name: apiserver-certs
- name: catalogd-apiserver-certs
secret:
secretName: catalogd
secretName: catalogd-apiserver
---
apiVersion: v1
kind: Service
metadata:
name: catalogd
namespace: catalogd-system
name: apiserver
namespace: system
labels:
api: catalogd
apiserver: "true"
Expand All @@ -74,7 +105,7 @@ metadata:
api: catalogd
apiserver: "true"
name: selfsigned-issuer
namespace: catalogd-system
namespace: system
spec:
selfSigned: {}
---
Expand All @@ -84,14 +115,14 @@ metadata:
labels:
api: catalogd
apiserver: "true"
name: catalogd-cert
namespace: catalogd-system
name: server-cert
namespace: system
spec:
dnsNames:
- catalogd.catalogd-system.svc
- catalogd.catalogd-system.svc.cluster.local
- catalogd-apiserver.catalogd.svc
- catalogd-apiserver.catalogd.svc.cluster.local
- localhost
issuerRef:
kind: Issuer
name: selfsigned-issuer
secretName: catalogd
name: catalogd-selfsigned-issuer
secretName: catalogd-apiserver
8 changes: 8 additions & 0 deletions config/apiserver/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
resources:
- apiserver.yaml
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
images:
- name: apiserver
newName: quay.io/operator-framework/catalogd-server
newTag: latest
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Based on discussion in the other PR?

Suggested change
newTag: latest
newTag: devel

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I was going to wait and make the necessary changes based on whichever PR gets in first

18 changes: 0 additions & 18 deletions config/apiservice.yaml

This file was deleted.

44 changes: 0 additions & 44 deletions config/controller-manager.yaml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Wait, I'm confused. If the Package and BundleMetadata APIs are CRDs what are we getting out of the apiservice and our separate etcd? Seems like I need to go read code.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

My understanding is we are offloading the storage of those resources to the custom apiservice to handle and it was storing them in the separate etcd instance. That being said, I have extremely limited knowledge on custom apiservices and have no idea if this one is working as expected.

cc @anik120

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

If that were true, there would be no CRDs for Package and BundleMetadata.

metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.9.0
creationTimestamp: null
name: bundlemetadata.catalogd.operatorframework.io
spec:
group: catalogd.operatorframework.io
names:
kind: BundleMetadata
listKind: BundleMetadataList
plural: bundlemetadata
singular: bundlemetadata
scope: Cluster
versions:
- name: v1beta1
schema:
openAPIV3Schema:
description: BundleMetadata
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
type: string
kind:
description: 'Kind is a string value representing the REST resource this
object represents. Servers may infer this from the endpoint the client
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
metadata:
type: object
spec:
description: BundleMetadataSpec defines the desired state of BundleMetadata
properties:
catalogSource:
description: CatalogSource is the name of the CatalogSource that provides
this bundle
type: string
image:
description: Image is a reference to the image that provides the bundle
contents
type: string
package:
description: Package is the name of the package that provides this
bundle
type: string
properties:
description: Properties is a string of references to property objects
that are part of the bundle
items:
description: 'TODO: In the future we should remove this in favor
of using `property.Property` from https://pkg.go.dev/github.com/operator-framework/operator-registry@v1.26.3/alpha/property#Property
This will likely require some changes to the `property.Property`
type to make it suitable for usage within the Spec for a CustomResource'
properties:
type:
type: string
value:
format: byte
type: string
required:
- type
- value
type: object
type: array
relatedImages:
description: RelatedImages are the RelatedImages in the bundle
items:
description: 'TODO: In the future we should remove this in favor
of using `model.RelatedImage` (or similar) from https://pkg.go.dev/github.com/operator-framework/operator-registry@v1.26.3/alpha/model#RelatedImage
This will likely require some changes to the `model.RelatedImage`
type to make it suitable for usage within the Spec for a CustomResource'
properties:
image:
type: string
name:
type: string
required:
- image
- name
type: object
type: array
required:
- catalogSource
- image
- package
- properties
- relatedImages
type: object
status:
description: BundleMetadataStatus defines the observed state of BundleMetadata
type: object
type: object
served: true
storage: true
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.9.0
creationTimestamp: null
name: catalogsources.catalogd.operatorframework.io
spec:
group: catalogd.operatorframework.io
names:
kind: CatalogSource
listKind: CatalogSourceList
plural: catalogsources
singular: catalogsource
scope: Cluster
versions:
- name: v1beta1
schema:
openAPIV3Schema:
description: CatalogSource
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
type: string
kind:
description: 'Kind is a string value representing the REST resource this
object represents. Servers may infer this from the endpoint the client
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
metadata:
type: object
spec:
description: CatalogSourceSpec defines the desired state of CatalogSource
properties:
image:
description: Image is the Catalog image that contains Operators' metadata
in the FBC format https://olm.operatorframework.io/docs/reference/file-based-catalogs/#docs
type: string
pollingInterval:
description: PollingInterval is used to determine the time interval
between checks of the latest index image version. The image is polled
to see if a new version of the image is available. If available,
the latest image is pulled and the cache is updated to contain the
new content.
type: string
required:
- image
type: object
status:
description: CatalogSourceStatus defines the observed state of CatalogSource
properties:
latestImagePoll:
description: The last time the image has been polled to ensure the
image is up-to-date
format: date-time
type: string
required:
- latestImagePoll
type: object
type: object
served: true
storage: true
Loading