Skip to content

Commit

Permalink
Combine the catalogd services (#402)
Browse files Browse the repository at this point in the history
Only need to define one service for:
* metrics
* webhook
* catalogd itself

Clean up the name of the service (now `catalogd-service`) and any
corresponding resources

Renumber the ports to 7443/8443/9443. The external port for the catalog
server is either 80 or 443.

Signed-off-by: Todd Short <todd.short@me.com>
  • Loading branch information
tmshort committed Sep 17, 2024
1 parent 2b49a6c commit cdf6c0b
Show file tree
Hide file tree
Showing 15 changed files with 28 additions and 51 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ only-deploy-manifest: $(KUSTOMIZE) ## Deploy just the Catalogd manifest--used in

wait:
kubectl wait --for=condition=Available --namespace=$(CATALOGD_NAMESPACE) deployment/catalogd-controller-manager --timeout=60s
kubectl wait --for=condition=Ready --namespace=$(CATALOGD_NAMESPACE) certificate/catalogd-catalogserver-cert # Avoid upgrade test flakes when reissuing cert
kubectl wait --for=condition=Ready --namespace=$(CATALOGD_NAMESPACE) certificate/catalogd-service-cert # Avoid upgrade test flakes when reissuing cert


.PHONY: cert-manager
Expand Down
2 changes: 1 addition & 1 deletion cmd/manager/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ func main() {
"Enable leader election for controller manager. "+
"Enabling this will ensure there is only one active controller manager.")
flag.StringVar(&systemNamespace, "system-namespace", "", "The namespace catalogd uses for internal state, configuration, and workloads")
flag.StringVar(&catalogServerAddr, "catalogs-server-addr", ":8083", "The address where the unpacked catalogs' content will be accessible")
flag.StringVar(&catalogServerAddr, "catalogs-server-addr", ":8443", "The address where the unpacked catalogs' content will be accessible")
flag.StringVar(&externalAddr, "external-address", "catalogd-catalogserver.olmv1-system.svc", "The external address at which the http(s) server is reachable.")
flag.StringVar(&cacheDir, "cache-dir", "/var/cache/", "The directory in the filesystem that catalogd will use for file based caching")
flag.BoolVar(&catalogdVersion, "version", false, "print the catalogd version and exit")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ metadata:
labels:
app.kubernetes.io/part-of: olm
app.kubernetes.io/name: catalogd
name: catalogserver
name: service
namespace: system
spec:
selector:
Expand All @@ -13,4 +13,12 @@ spec:
- name: http
protocol: TCP
port: 80
targetPort: 8083
targetPort: 8443
- name: webhook
protocol: TCP
port: 9443
targetPort: 9443
- name: metrics
protocol: TCP
port: 7443
targetPort: 7443
3 changes: 1 addition & 2 deletions config/base/manager/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
resources:
- manager.yaml
- catalogserver_service.yaml
- catalogd_service.yaml
- webhook/manifests.yaml
- webhook/catalogd-webhook-service.yaml
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
images:
Expand Down
6 changes: 3 additions & 3 deletions config/base/manager/manager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,13 @@ spec:
- ALL
image: gcr.io/kubebuilder/kube-rbac-proxy:v0.15.0
args:
- --secure-listen-address=0.0.0.0:8443
- --secure-listen-address=0.0.0.0:7443
- --http2-disable
- --upstream=http://127.0.0.1:8080/
- --logtostderr=true
- --v=0
ports:
- containerPort: 8443
- containerPort: 7443
protocol: TCP
name: https
resources:
Expand All @@ -76,7 +76,7 @@ spec:
args:
- --leader-elect
- --metrics-bind-address=127.0.0.1:8080
- --external-address=catalogd-catalogserver.olmv1-system.svc
- --external-address=catalogd-service.olmv1-system.svc
image: controller:latest
name: manager
volumeMounts:
Expand Down
11 changes: 0 additions & 11 deletions config/base/manager/webhook/catalogd-webhook-service.yaml

This file was deleted.

4 changes: 2 additions & 2 deletions config/base/manager/webhook/patch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
value: olmv1-system
- op: replace
path: /webhooks/0/clientConfig/service/name
value: catalogd-webhook-service
value: catalogd-service
- op: add
path: /webhooks/0/clientConfig/service/port
value: 443
value: 9443
# Make sure there's a name defined, otherwise, we can't create a label. This could happen when generateName is set
# Then, if any of the conditions are true, create the label:
# 1. No labels exist
Expand Down
2 changes: 1 addition & 1 deletion config/base/nginx-ingress/resources/nginx_ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ spec:
pathType: Prefix
backend:
service:
name: catalogd-catalogserver
name: catalogd-service
port:
number: 80
16 changes: 0 additions & 16 deletions config/base/rbac/auth_proxy_service.yaml

This file was deleted.

3 changes: 1 addition & 2 deletions config/base/rbac/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,9 @@ resources:
- role_binding.yaml
- leader_election_role.yaml
- leader_election_role_binding.yaml
# Comment the following 4 lines if you want to disable
# Comment the following 3 lines if you want to disable
# the auth proxy (https://github.com/brancz/kube-rbac-proxy)
# which protects your /metrics endpoint.
- auth_proxy_service.yaml
- auth_proxy_role.yaml
- auth_proxy_role_binding.yaml
- auth_proxy_client_clusterrole.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
- op: add
path: /spec/template/spec/volumes/-
value: {"name":"olmv1-certificate", "secret":{"secretName":"catalogd-catalogserver-cert-git-version", "optional": false, "items": [{"key": "ca.crt", "path": "olm-ca.crt"}]}}
value: {"name":"olmv1-certificate", "secret":{"secretName":"catalogd-service-cert-git-version", "optional": false, "items": [{"key": "ca.crt", "path": "olm-ca.crt"}]}}
- op: add
path: /spec/template/spec/containers/1/volumeMounts/-
value: {"name":"olmv1-certificate", "readOnly": true, "mountPath":"/var/ca-certs/"}
Expand Down
4 changes: 2 additions & 2 deletions config/components/tls/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ resources:
patches:
- target:
kind: Service
name: catalogserver
path: patches/catalogserver_service_port.yaml
name: service
path: patches/catalogd_service_port.yaml
- target:
kind: Deployment
name: controller-manager
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
- op: add
path: /spec/template/spec/volumes/-
value: {"name":"catalogserver-certs", "secret":{"secretName":"catalogd-catalogserver-cert-git-version"}}
value: {"name":"catalogserver-certs", "secret":{"secretName":"catalogd-service-cert-git-version"}}
- op: add
path: /spec/template/spec/containers/1/volumeMounts/-
value: {"name":"catalogserver-certs", "mountPath":"/var/certs"}
Expand Down
10 changes: 4 additions & 6 deletions config/components/tls/resources/certificate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,14 @@
apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
name: catalogserver-cert
name: service-cert
namespace: system
spec:
secretName: catalogd-catalogserver-cert-git-version
secretName: catalogd-service-cert-git-version
dnsNames:
- localhost
- catalogd-catalogserver.olmv1-system.svc
- catalogd-webhook-service.olmv1-system.svc
- catalogd-catalogserver.olmv1-system.svc.cluster.local
- catalogd-webhook-service.olmv1-system.svc.cluster.local
- catalogd-service.olmv1-system.svc
- catalogd-service.olmv1-system.svc.cluster.local
privateKey:
algorithm: ECDSA
size: 256
Expand Down

0 comments on commit cdf6c0b

Please sign in to comment.