Skip to content

Commit

Permalink
1. 添加k8s相关的配置
Browse files Browse the repository at this point in the history
  • Loading branch information
bboysoulcn committed Jun 14, 2024
1 parent 67fb550 commit 393eff3
Show file tree
Hide file tree
Showing 40 changed files with 594 additions and 1 deletion.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
16 changes: 16 additions & 0 deletions kubernetes/dockerhub/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
version: 0.1
storage:
filesystem:
rootdirectory: /var/lib/registry
delete:
enabled: true
maintenance:
uploadpurging:
enabled: true
age: 168h
dryrun: false
interval: 45m
http:
addr: 0.0.0.0:5000
proxy:
remoteurl: https://registry-1.docker.io
10 changes: 10 additions & 0 deletions kubernetes/dockerhub/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
resources:
- sts.yaml
- svc.yaml

configMapGenerator:
- name: dockerhub-cnf
files:
- config.yml
options:
disableNameSuffixHash: true
46 changes: 46 additions & 0 deletions kubernetes/dockerhub/sts.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: dockerhub
namespace: registry
spec:
selector:
matchLabels:
app: dockerhub
serviceName: dockerhub
replicas: 1
template:
metadata:
labels:
app: dockerhub
spec:
containers:
- name: dockerhub
image: registry:2.8.1
ports:
- containerPort: 5000
name: dockerhub
volumeMounts:
- name: dockerhub-data
mountPath: /var/lib/registry
- name: timezone
mountPath: /etc/localtime
readOnly: true
- name: dockerhub-cnf
mountPath: /etc/docker/registry/config.yml
subPath: config.yml
volumes:
- name: dockerhub-cnf
configMap:
name: dockerhub-cnf
- name: timezone
hostPath:
path: /usr/share/zoneinfo/Asia/Shanghai
volumeClaimTemplates:
- metadata:
name: dockerhub-data
spec:
accessModes: [ "ReadWriteOnce" ]
resources:
requests:
storage: 50Gi
11 changes: 11 additions & 0 deletions kubernetes/dockerhub/svc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: v1
kind: Service
metadata:
name: dockerhub
namespace: registry
spec:
selector:
app: dockerhub
ports:
- port: 5000
targetPort: 5000
16 changes: 16 additions & 0 deletions kubernetes/gcr/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
version: 0.1
storage:
filesystem:
rootdirectory: /var/lib/registry
delete:
enabled: true
maintenance:
uploadpurging:
enabled: true
age: 168h
dryrun: false
interval: 1m
http:
addr: 0.0.0.0:5000
proxy:
remoteurl: https://gcr.io
10 changes: 10 additions & 0 deletions kubernetes/gcr/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
resources:
- sts.yaml
- svc.yaml

configMapGenerator:
- name: gcr-cnf
files:
- config.yml
options:
disableNameSuffixHash: true
46 changes: 46 additions & 0 deletions kubernetes/gcr/sts.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: gcr
namespace: registry
spec:
selector:
matchLabels:
app: gcr
serviceName: gcr
replicas: 1
template:
metadata:
labels:
app: gcr
spec:
containers:
- name: gcr
image: registry:2.8.1
ports:
- containerPort: 5000
name: gcr
volumeMounts:
- name: gcr-data
mountPath: /var/lib/registry
- name: timezone
mountPath: /etc/localtime
readOnly: true
- name: gcr-cnf
mountPath: /etc/docker/registry/config.yml
subPath: config.yml
volumes:
- name: gcr-cnf
configMap:
name: gcr-cnf
- name: timezone
hostPath:
path: /usr/share/zoneinfo/Asia/Shanghai
volumeClaimTemplates:
- metadata:
name: gcr-data
spec:
accessModes: [ "ReadWriteOnce" ]
resources:
requests:
storage: 50Gi
11 changes: 11 additions & 0 deletions kubernetes/gcr/svc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: v1
kind: Service
metadata:
name: gcr
namespace: registry
spec:
selector:
app: gcr
ports:
- port: 5000
targetPort: 5000
16 changes: 16 additions & 0 deletions kubernetes/ghcr/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
version: 0.1
storage:
filesystem:
rootdirectory: /var/lib/registry
delete:
enabled: true
maintenance:
uploadpurging:
enabled: true
age: 168h
dryrun: false
interval: 1m
http:
addr: 0.0.0.0:5000
proxy:
remoteurl: https://ghcr.io
10 changes: 10 additions & 0 deletions kubernetes/ghcr/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
resources:
- sts.yaml
- svc.yaml

configMapGenerator:
- name: ghcr-cnf
files:
- config.yml
options:
disableNameSuffixHash: true
46 changes: 46 additions & 0 deletions kubernetes/ghcr/sts.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: ghcr
namespace: registry
spec:
selector:
matchLabels:
app: ghcr
serviceName: ghcr
replicas: 1
template:
metadata:
labels:
app: ghcr
spec:
containers:
- name: ghcr
image: registry:2.8.1
ports:
- containerPort: 5000
name: ghcr
volumeMounts:
- name: ghcr-data
mountPath: /var/lib/registry
- name: timezone
mountPath: /etc/localtime
readOnly: true
- name: ghcr-cnf
mountPath: /etc/docker/registry/config.yml
subPath: config.yml
volumes:
- name: ghcr-cnf
configMap:
name: ghcr-cnf
- name: timezone
hostPath:
path: /usr/share/zoneinfo/Asia/Shanghai
volumeClaimTemplates:
- metadata:
name: ghcr-data
spec:
accessModes: [ "ReadWriteOnce" ]
resources:
requests:
storage: 50Gi
11 changes: 11 additions & 0 deletions kubernetes/ghcr/svc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: v1
kind: Service
metadata:
name: ghcr
namespace: registry
spec:
selector:
app: ghcr
ports:
- port: 5000
targetPort: 5000
75 changes: 75 additions & 0 deletions kubernetes/ingress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: registry-ingress
namespace: registry
annotations:
kubernetes.io/ingress.class: "nginx"
nginx.ingress.kubernetes.io/ssl-passthrough: "true"
nginx.ingress.kubernetes.io/force-ssl-redirect: "true"
spec:
rules:
- host: "quay.example.com"
http:
paths:
- pathType: Prefix
path: "/"
backend:
service:
name: quay
port:
number: 5000
- host: "registryk8s.example.com"
http:
paths:
- pathType: Prefix
path: "/"
backend:
service:
name: registryk8s
port:
number: 5000
- host: "gcr.example.com"
http:
paths:
- pathType: Prefix
path: "/"
backend:
service:
name: gcr
port:
number: 5000
- host: "ghcr.example.com"
http:
paths:
- pathType: Prefix
path: "/"
backend:
service:
name: ghcr
port:
number: 5000
- host: "k8sgcr.example.com"
http:
paths:
- pathType: Prefix
path: "/"
backend:
service:
name: k8sgcr
port:
number: 5000
- host: "hub.example.com"
http:
paths:
- pathType: Prefix
path: "/"
backend:
service:
name: dockerhub
port:
number: 5000
tls:
- hosts:
- example.com
secretName: example.com-tls
16 changes: 16 additions & 0 deletions kubernetes/k8sgcr/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
version: 0.1
storage:
filesystem:
rootdirectory: /var/lib/registry
delete:
enabled: true
maintenance:
uploadpurging:
enabled: true
age: 168h
dryrun: false
interval: 1m
http:
addr: 0.0.0.0:5000
proxy:
remoteurl: https://k8s.gcr.io
10 changes: 10 additions & 0 deletions kubernetes/k8sgcr/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
resources:
- sts.yaml
- svc.yaml

configMapGenerator:
- name: k8sgcr-cnf
files:
- config.yml
options:
disableNameSuffixHash: true
Loading

0 comments on commit 393eff3

Please sign in to comment.