Skip to content

Commit

Permalink
update harbor v2.8.4 and fix harbor setup
Browse files Browse the repository at this point in the history
  • Loading branch information
gjmzj committed Sep 5, 2023
1 parent e32dd8f commit 87d265f
Show file tree
Hide file tree
Showing 10 changed files with 319 additions and 141 deletions.
1 change: 0 additions & 1 deletion example/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -227,4 +227,3 @@ HARBOR_SELF_SIGNED_CERT: true
# install extra component
HARBOR_WITH_NOTARY: false
HARBOR_WITH_TRIVY: false
HARBOR_WITH_CHARTMUSEUM: true
6 changes: 3 additions & 3 deletions ezdown
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ K8S_BIN_VER=v1.28.1
EXT_BIN_VER=1.8.0
# https://github.com/easzlab/dockerfile-kubeasz-sys-pkg
SYS_PKG_VER=1.0.0
HARBOR_VER=v2.6.4
HARBOR_VER=v2.8.4
REGISTRY_MIRROR=CN

# images downloaded by default(with 'ezdown -D')
Expand Down Expand Up @@ -153,8 +153,8 @@ function download_docker() {
fi

tar zxf "$BASE/down/docker-$DOCKER_VER.tgz" -C "$BASE/down" && \
mkdir -p "$BASE/docker-bin" && \
cp -f "$BASE"/down/docker/* "$BASE/docker-bin" && \
mkdir -p "$BASE/bin/docker-bin" && \
cp -f "$BASE"/down/docker/* "$BASE/bin/docker-bin" && \
mv -f "$BASE"/down/docker/* /opt/kube/bin && \
ln -sf /opt/kube/bin/docker /bin/docker
}
Expand Down
10 changes: 1 addition & 9 deletions playbooks/11.harbor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,8 @@
- { role: prepare, when: "NEW_INSTALL|bool" }
- { role: docker, when: "NEW_INSTALL|bool" }
- { role: harbor, when: "NEW_INSTALL|bool" }
tasks:
- name: Fetching the HARBOR SERVER's CA cert
fetch:
src: "{{ ca_dir }}/ca.pem"
dest: "{{ base_dir }}/down/"
flat: yes
when: 'HARBOR_SELF_SIGNED_CERT|bool'
#when: hostvars[groups.harbor[0]]['SELF_SIGNED_CERT']|bool

### --- config k8s nodes to use with harbor ---
### --- config k8s nodes to work with harbor ---
- hosts:
- kube_master
- kube_node
Expand Down
20 changes: 20 additions & 0 deletions roles/docker/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,26 @@
shell: 'systemctl is-active docker || echo "NoFound"'
register: docker_svc

- name: 获取docker版本信息
shell: "{{ base_dir }}/bin/docker-bin/dockerd --version|cut -d' ' -f3"
register: docker_ver
connection: local
run_once: true
tags: upgrade_docker, download_docker

- name: debug info
debug: var="docker_ver"
connection: local
run_once: true
tags: upgrade_docker, download_docker

- name: 转换docker版本信息为浮点数
set_fact:
DOCKER_VER: "{{ docker_ver.stdout.split('.')[0]|int + docker_ver.stdout.split('.')[1]|int/100 }}"
connection: local
run_once: true
tags: upgrade_docker, download_docker

- name: 已安装提示
debug:
msg: "docker 服务已安装"
Expand Down
2 changes: 1 addition & 1 deletion roles/docker/templates/daemon.json.j2
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
{% if DOCKER_ENABLE_REMOTE_API %}
"hosts": ["tcp://0.0.0.0:2376", "unix:///var/run/docker.sock"],
{% endif %}
"insecure-registries": {{ INSECURE_REG }},
"insecure-registries": [{{ INSECURE_REG_STRING }}],
"max-concurrent-downloads": 10,
"live-restore": true,
"log-driver": "json-file",
Expand Down
4 changes: 4 additions & 0 deletions roles/docker/vars/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,7 @@ CGROUP_DRIVER: "{%- if DOCKER_VER|float >= 20.10 -%} \
{%- else -%} \
cgroupfs \
{%- endif -%}"

#
INSECURE_REG_STR: "{% for reg in INSECURE_REG %}\"{{ reg }}\",{% endfor %}"
INSECURE_REG_STRING: "{{ INSECURE_REG_STR.rstrip(',') }}"
7 changes: 0 additions & 7 deletions roles/harbor/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,6 @@
- name: 准备 harbor 配置文件
template: src=harbor-{{ HARBOR_VER_MAIN }}.yml.j2 dest={{ HARBOR_PATH }}/harbor/harbor.yml

#- name: 配置 harbor.yml 文件
#template: src=harbor-{{ HARBOR_VER_MAIN }}.yml.j2 dest={{ HARBOR_PATH }}/harbor/harbor.yml
#when: HARBOR_VER_MAIN in ["v1.8", "v1.9", "v1.10"]

- set_fact: HARBOR_INST_OPS="{{ HARBOR_INST_OPS }} --with-chartmuseum"
when: "HARBOR_WITH_CHARTMUSEUM|bool"

- set_fact: HARBOR_INST_OPS="{{ HARBOR_INST_OPS }} --with-notary"
when: "HARBOR_WITH_NOTARY|bool"

Expand Down
118 changes: 0 additions & 118 deletions roles/harbor/templates/harbor-v2.1.yml.j2

This file was deleted.

Loading

0 comments on commit 87d265f

Please sign in to comment.