harbor

package
v0.7.5-alpha Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 28, 2021 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DockerConfigTempl = template.Must(template.New("DockerConfig").Parse(
		dedent.Dedent(`{
  "log-opts": {
    "max-size": "5m",
    "max-file":"3"
  }
  {{- if .Mirrors }}
  ,"registry-mirrors": [{{ .Mirrors }}]
  {{- end}}
  {{- if .InsecureRegistries }}
  ,"insecure-registries": ["{{ .InsecureRegistries }}"]
  {{- end}}
}
    `)))

	HarborConfigTmpl = template.Must(template.New("HarborConfig").Parse(dedent.Dedent(`
hostname: {{ .domain }}

# http related config
http:
  # port for http, default is 80. If https enabled, this port will redirect to https port
  port: {{ .http_port }}

# https related config
# https:
  # https port for harbor, default is 443
  # port: 443
  # The path of cert and key files for nginx
  # certificate: /your/certificate/path
  # private_key: /your/private/key/path
harbor_admin_password: {{ .admin_password }}
database:
  password: root123
  max_idle_conns: 50
  max_open_conns: 1000
data_volume: {{ .data_dir }}
clair:
  updaters_interval: 12
trivy:
  ignore_unfixed: false
  skip_update: false
jobservice:
  max_job_workers: 40
notification:
  webhook_job_max_retry: 10
chart:
  absolute_url: disabled
log:
  level: info
  local:
    rotate_size: 200M
    location: /var/log/harbor
_version: 2.0.0
proxy:
  http_proxy:
  https_proxy:
  no_proxy:
  components:
    - core
    - jobservice
    - clair
    - trivy
`)))
	HarborPrepareTmpl = template.Must(template.New("HarborPrepareCmd").Parse(dedent.Dedent(`
sed -i '/docker-compose/d' /etc/rc.local
cat <<EOF >>/etc/rc.local
docker-compose -f /usr/local/harbor/docker-compose.yml down
docker-compose -f /usr/local/harbor/docker-compose.yml up -d
EOF

chmod +x /etc/rc.local

sed -i "/{{ .domain }}/d" /etc/hosts
echo "{{ .address }} {{ .domain }}" >> /etc/hosts

sh -c /usr/local/harbor/prepare
`)))
	HarborInstallTmpl = template.Must(template.New("HarborInstallCmd").Parse(dedent.Dedent(`
/usr/local/harbor/install.sh --with-clair --with-trivy --with-chartmuseum
sed -i "/volumes:/a\      - /etc/hosts:/etc/hosts" /usr/local/harbor/docker-compose.yml
cd /usr/local/harbor
docker-compose down
docker-compose up -d

firewall-cmd --zone=public --add-port={{ .http_port }}/tcp --permanent
firewall-cmd --reload
`)))
)

Functions

func Harbor

func Harbor(i runner.Installer)

Types

type ArtifactReservePolicy

type ArtifactReservePolicy struct {
	Algorithm string `json:"algorithm"`
	Rules     []rule `json:"rules"`
	Trigger   struct {
		Kind       string `json:"kind"`
		References struct {
		} `json:"references"`
		Settings struct {
			Cron string `json:"cron"`
		} `json:"settings"`
	} `json:"trigger"`
	Scope struct {
		Level string `json:"level"`
		Ref   int    `json:"ref"`
	} `json:"scope"`
}

ArtifactReservePolicy -> 配置项目保留策略对象

type GCSettingObject

type GCSettingObject struct {
	Schedule struct {
		Type string `json:"type"`
		Cron string `json:"cron"`
	} `json:"schedule"`

	Parameters struct {
		DeleteUntagged bool `json:"delete_untagged"`
	} `json:"parameters"`
}

GCSettingObject 配置Gc策略对象

type ProjectMetadata

type ProjectMetadata struct {
	CreationTime       time.Time `json:"creation_time"`
	CurrentUserRoleId  int       `json:"current_user_role_id"`
	CurrentUserRoleIds []int     `json:"current_user_role_ids"`
	CveAllowlist       struct {
		CreationTime time.Time     `json:"creation_time"`
		Id           int           `json:"id,omitempty"`
		Items        []interface{} `json:"items"`
		ProjectId    int           `json:"project_id"`
		UpdateTime   time.Time     `json:"update_time"`
	} `json:"cve_allowlist"`
	Metadata struct {
		Public      string `json:"public"`
		RetentionId string `json:"retention_id"`
	} `json:"metadata"`
	Name       string    `json:"name"`
	OwnerId    int       `json:"owner_id"`
	OwnerName  string    `json:"owner_name"`
	ProjectId  int       `json:"project_id"`
	UpdateTime time.Time `json:"update_time"`
}

type ProjectMetadataSub

type ProjectMetadataSub struct {
	Name        string
	RetentionID string
}

type Repository

type Repository struct {
	Kind       string `json:"kind"`
	Decoration string `json:"decoration"`
	Pattern    string `json:"pattern"`
}

type ScopeSelectors

type ScopeSelectors struct {
	Repository []Repository `json:"repository"`
}

type TagSelector

type TagSelector struct {
	Kind       string `json:"kind"`
	Decoration string `json:"decoration"`
	Pattern    string `json:"pattern"`
	Extras     string `json:"extras"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL