generated from open-component-model/repository-template
-
Notifications
You must be signed in to change notification settings - Fork 1
feat: in-cluster zot registry as part of deployment #112
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
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
af2b6b4
in-cluster zot registry as part of deployment
ikhandamirov 108cc4f
Merge branch 'main' into zot-deployment
ikhandamirov 9020222
fix e2e test
ikhandamirov 625ca7b
Merge branch 'zot-deployment' of https://github.com/open-component-mo…
ikhandamirov fc62934
docker compat removed from https config
ikhandamirov 59aceee
Merge branch 'main' into zot-deployment
ikhandamirov File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
apiVersion: cert-manager.io/v1 | ||
kind: ClusterIssuer | ||
metadata: | ||
name: ocm-k8s-toolkit-bootstrap-issuer | ||
namespace: ocm-k8s-toolkit-system | ||
spec: | ||
selfSigned: {} | ||
--- | ||
apiVersion: cert-manager.io/v1 | ||
kind: Certificate | ||
metadata: | ||
name: ocm-k8s-toolkit-bootstrap-certificate | ||
namespace: ocm-k8s-toolkit-system | ||
spec: | ||
# this is discouraged but required by ios | ||
commonName: cert-manager-ocm-tls | ||
isCA: true | ||
secretName: ocm-k8s-toolkit-registry-tls-certs | ||
subject: | ||
organizations: | ||
- ocm.software | ||
dnsNames: | ||
- ocm-k8s-toolkit-zot-registry.ocm-k8s-toolkit-system.svc.cluster.local | ||
- localhost | ||
ipAddresses: | ||
- 127.0.0.1 | ||
- ::1 | ||
privateKey: | ||
algorithm: RSA | ||
encoding: PKCS8 | ||
size: 2048 | ||
issuerRef: | ||
name: ocm-k8s-toolkit-bootstrap-issuer | ||
kind: ClusterIssuer | ||
group: cert-manager.io | ||
--- | ||
apiVersion: cert-manager.io/v1 | ||
kind: ClusterIssuer | ||
metadata: | ||
name: ocm-k8s-toolkit-certificate-issuer | ||
namespace: ocm-k8s-toolkit-system | ||
spec: | ||
ca: | ||
secretName: ocm-k8s-toolkit-registry-tls-certs |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: zot-config | ||
data: | ||
config.json: | | ||
{ | ||
"storage": { | ||
"rootDirectory": "/tmp/zot", | ||
"commit": true, | ||
"dedupe": true, | ||
"gc": true, | ||
"gcDelay": "1h", | ||
"gcInterval": "24h" | ||
}, | ||
"http": { | ||
"address":"0.0.0.0", | ||
"port": "5000", | ||
"tls": { | ||
"cert":"/etc/zot/tls/tls.crt", | ||
"key":"/etc/zot/tls/tls.key" | ||
} | ||
}, | ||
"log": { | ||
"level": "debug" | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: zot-registry | ||
spec: | ||
template: | ||
spec: | ||
containers: | ||
- name: zot-registry | ||
volumeMounts: | ||
- name: zot-tls | ||
mountPath: /etc/zot/tls | ||
readOnly: true | ||
volumes: | ||
- name: zot-tls | ||
secret: | ||
secretName: ocm-k8s-toolkit-registry-tls-certs | ||
# Registry is accessible in-cluster under: | ||
# https://ocm-k8s-toolkit-zot-registry.ocm-k8s-toolkit-system.svc.cluster.local:5000/v2/_catalog |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Hack: extract secret from cluster to local dir, e.g. for testing or debugging | ||
kubectl get secret ocm-k8s-toolkit-registry-tls-certs -n ocm-k8s-toolkit-system -o jsonpath="{.data['tls\.crt']}" | base64 -d > config/zot-https/rootCA.pem | ||
|
||
# Alternatively `curl` can be used (https://curl.se/docs/sslcerts.html): | ||
# curl -k -w %{certs} https://localhost:31000/v2/_catalog > config/zot-https/rootCA.pem | ||
# curl --cacert config/zot-https/rootCA.pem https://localhost:31000/v2/_catalog | ||
|
||
# The pem file can be added to the system trust store (https://github.com/FiloSottile/mkcert): | ||
# CAROOT=config/zot-https mkcert -install |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
apiVersion: kustomize.config.k8s.io/v1beta1 | ||
kind: Kustomization | ||
resources: | ||
- certificate.yaml | ||
- ../default | ||
patches: | ||
- path: configmap-patch.yaml | ||
- path: deployment-patch.yaml |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: zot-config | ||
data: | ||
# for docker compatibility, add '"http": { "compat": "docker2s2" }' | ||
config.json: | | ||
{ | ||
"storage": { | ||
"rootDirectory": "/tmp/zot", | ||
"commit": true, | ||
"dedupe": true, | ||
"gc": true, | ||
"gcDelay": "1h", | ||
"gcInterval": "24h" | ||
}, | ||
"http": { | ||
"address":"0.0.0.0", | ||
"port": "5000" | ||
}, | ||
"log": { | ||
"level": "debug" | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: zot-registry | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
app: zot | ||
template: | ||
metadata: | ||
labels: | ||
app: zot | ||
spec: | ||
containers: | ||
- name: zot-registry | ||
image: zot-minimal:latest | ||
ports: | ||
- containerPort: 5000 | ||
volumeMounts: | ||
- name: zot-config-volume | ||
mountPath: /etc/zot/config.json | ||
subPath: config.json | ||
- name: zot-storage | ||
mountPath: /tmp/zot | ||
volumes: | ||
- name: zot-config-volume | ||
configMap: | ||
name: zot-config | ||
- name: zot-storage | ||
emptyDir: {} | ||
# Manual test if the registry is running: | ||
# % kubectl run -i --tty --rm debug --image=busybox --restart=Never -- /bin/sh | ||
# # wget -qO- http://ocm-k8s-toolkit-zot-registry.ocm-k8s-toolkit-system.svc.cluster.local:5000/v2/_catalog | ||
# {"repositories":[]} | ||
# # exit |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
apiVersion: kustomize.config.k8s.io/v1beta1 | ||
kind: Kustomization | ||
resources: | ||
- configmap.yaml | ||
- deployment.yaml | ||
- service.yaml | ||
images: | ||
- name: zot-minimal | ||
newName: ghcr.io/project-zot/zot-minimal | ||
newTag: latest |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: zot-registry | ||
spec: | ||
type: ClusterIP | ||
ports: | ||
- port: 5000 | ||
targetPort: 5000 | ||
selector: | ||
app: zot | ||
# --- | ||
# Uncomment if you need an external port to the image registry | ||
# Can be reached e.g. from the host with 'localhost:31000' | ||
# apiVersion: v1 | ||
# kind: Service | ||
# metadata: | ||
# name: zot-registry-external | ||
# spec: | ||
# type: NodePort | ||
# ports: | ||
# - port: 5000 | ||
# targetPort: 5000 | ||
# nodePort: 31000 | ||
# selector: | ||
# app: zot |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.