Skip to content

Commit

Permalink
feature(main): delete registry code from fork (#2875)
Browse files Browse the repository at this point in the history
* feature(main): delete registry code from fork

Signed-off-by: cuisongliu <[email protected]>

* feature(main): delete registry code from fork

Signed-off-by: cuisongliu <[email protected]>

# Conflicts:
#	fork/github.com/heroku/docker-registry-client/registry/json.go
#	fork/github.com/heroku/docker-registry-client/registry/manifest.go

---------

Signed-off-by: cuisongliu <[email protected]>
  • Loading branch information
cuisongliu authored Mar 29, 2023
1 parent 41d2092 commit 22baae1
Show file tree
Hide file tree
Showing 62 changed files with 785 additions and 4,489 deletions.
58 changes: 1 addition & 57 deletions .github/workflows/test_registry.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,62 +37,6 @@ jobs:
with:
name: sealctl
path: /usr/bin/sealctl
verify-registry:
needs: [build]
runs-on: ubuntu-20.04
steps:
- name: Download sealctl
uses: actions/download-artifact@v3
with:
name: sealctl
path: /tmp/
- name: Download sealos
uses: actions/download-artifact@v3
with:
name: sealos
path: /tmp/
- name: Verify sealctl
run: |
sudo chmod a+x /tmp/{sealos,sealctl}
sudo mv /tmp/{sealos,sealctl} /usr/bin/
sudo sealctl version
sudo sealos version
- name: Remove containerd && docker
uses: labring/[email protected]
with:
type: prune
- name: Auto install k8s using sealos
run: |
sudo sealos run labring/kubernetes:v1.25.0 --single --debug
mkdir -p "$HOME/.kube"
sudo cp -i /etc/kubernetes/admin.conf "$HOME/.kube/config"
sudo chown "$(whoami)" "$HOME/.kube/config"
kubectl get svc
kubectl get pod -A
sudo cat /root/.sealos/default/etc/kubeadm-init.yaml
sudo cat /root/.sealos/default/Clusterfile
- name: Verify Registry Status
run: |
sealctl login --username admin --password passw0rd sealos.hub:5000
sealctl pull alpine:3
sealctl tag alpine:3 sealos.hub:5000/library/alpine:3
sealctl push sealos.hub:5000/library/alpine:3
sealctl registry status
- name: Verify Registry Images
run: |
sealctl registry images
sealctl registry images -n sealos.hub:5000 --filter tag=*5.4*
sealctl registry images -n sealos.hub:5000 --filter name=kube*,tag=3
sealctl registry images -n sealos.hub:5000 --filter name=library/alpine,tag=3
sealctl registry images -n sealos.hub:5000 --filter name=library/alpine,tag=3 --json
- name: Verify Registry Image
run: |
sealctl registry image -n sealos.hub:5000 --image library/alpine:3
sealctl registry image -n sealos.hub:5000 --image library/alpine:3 --json
- name: Verify Registry Rmi Image
run: |
sealctl registry rmi -n sealos.hub:5000 --debug library/alpine:3
sudo sealctl registry prune --debug
verify-registry-save:
needs: [build]
runs-on: ubuntu-20.04
Expand Down Expand Up @@ -131,4 +75,4 @@ jobs:
# nginx:1.23.3
# busybox:1.35
# EOF
# sealctl registry save default --data-dir default --max-pull-procs 8 --debug .
# sealctl registry save default --data-dir default --max-pull-procs 8 --debug .
4 changes: 2 additions & 2 deletions cmd/sealctl/cmd/registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ package cmd
import (
"github.com/spf13/cobra"

"github.com/labring/sealos/pkg/registry/cmd"
"github.com/labring/sealos/pkg/registry/commands"
)

func init() {
Expand All @@ -31,6 +31,6 @@ func newRegistryImageCmd() *cobra.Command {
Use: "registry",
Short: "registry images manager",
}
cmd.RegisterRootCommand(registryImageCmd, rootCmd)
commands.RegisterRootCommand(registryImageCmd, rootCmd)
return registryImageCmd
}
160 changes: 0 additions & 160 deletions docs/4.0/docs/examples/sealctl-registry.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,163 +65,3 @@ Global Flags:
```shell
sealctl registry save raw --images nginx
```

## Check registry status

To use this command, you need to `sealctl login` or `sealos login` first.

```
registry status
Usage:
sealctl registry status [flags]
Examples:
sealctl registry status
Flags:
-h, --help help for status
--json output in JSON format
Global Flags:
--debug enable debug logger
--root string storage root dir (default "/var/lib/containers/storage")
--runroot string storage state dir (default "/run/containers/storage")
--show-path enable show code path
--storage-driver string storage-driver (default "overlay")
--storage-opt strings storage driver option
```

#### Usage
```shell
$ sealctl registry status
+--------------------+---------------------------+----------+----------+---------+
| Name | URL | UserName | Password | Healthy |
+--------------------+---------------------------+----------+----------+---------+
| 192.168.64.63:5000 | http://192.168.64.63:5000 | admin | passw0rd | ok |
+--------------------+---------------------------+----------+----------+---------+
```


## List registry image

```
registry image list
Usage:
sealctl registry images [flags]
Examples:
Example:
sealctl registry images --filter name=public*
sealctl registry images --filter tag=*1.1*
sealctl registry images --filter tag=*sec
sealctl registry images --filter name=public,tag=v1.1.1
sealctl registry images --filter tag=<none>
Flags:
--filter string Filter support 'name' and 'tag' , strategy support prefix (eg key*),suffix(eg *key),equals(eg key),empty(eg <none>),like(eg *key*)
-h, --help help for images
--json output in JSON format
-n, --name string registry name (default "sealos.hub:5000")
Global Flags:
--debug enable debug logger
--root string storage root dir (default "/var/lib/containers/storage")
--runroot string storage state dir (default "/run/containers/storage")
--show-path enable show code path
--storage-driver string storage-driver (default "overlay")
--storage-opt strings storage driver option
```

#### Usage

```shell
$ sealctl registry images -n 192.168.64.63:5000 --filter name=kube*,tag=*
+--------------------+-------------------------+---------+-------------------------------------------------------------------------+
| RegistryName | ImageName | Tag | ImageID |
+--------------------+-------------------------+---------+-------------------------------------------------------------------------+
| 192.168.64.63:5000 | kube-apiserver | v1.19.0 | sha256:522d17d35a8994637d27d1232bebd35cfae8e3e21ab359431403f2b8023e332c |
| 192.168.64.63:5000 | kube-controller-manager | v1.19.0 | sha256:6c11a3d4d06385f7547a5ea0c3f0d5e7b12baa558111d01406ac1f778cb3f00b |
| 192.168.64.63:5000 | kube-proxy | v1.19.0 | sha256:c752ecbd04bc4517168a19323bb60fb45324eee1e480b2b97d3fd6ea0a54f42d |
| 192.168.64.63:5000 | kube-scheduler | v1.19.0 | sha256:529a1566960a5b3024f2c94128e1cbd882ca1804f222ec5de99b25567858ecb9 |
+--------------------+-------------------------+---------+-------------------------------------------------------------------------+
2023-01-01T12:31:49 info Image count 4
2023-01-01T12:31:49 info Images Version count 4
```

### Filtering

Keys for `--filter`:
- `name`
- `tag`

Expressions:
- `*val`: suffix
- `val*`: prefix
- `value`: equals
- `<none>`: empty
- `*val*`: contains



## Remove registry image

```
registry rmi image
Usage:
sealctl registry rmi [flags]
Examples:
sealctl registry rmi labring/lvscare:v4.1.3
Flags:
-h, --help help for rmi
-n, --name string registry name (default "sealos.hub:5000")
Global Flags:
--debug enable debug logger
--root string storage root dir (default "/var/lib/containers/storage")
--runroot string storage state dir (default "/run/containers/storage")
--show-path enable show code path
--storage-driver string storage-driver (default "overlay")
--storage-opt strings storage driver option
```

#### Usage

```shell
$ sealctl registry rmi 192.168.64.63:5000/kube-apiserver:v1.19.0 -n 192.168.64.63:5000
```

## Prune registry

This command can only be run on a registry node, which used the binary deploy mode. Does not support nodes using container deploy mode.

```
registry `garbage-collect` deletes layers not referenced by any manifests
Usage:
sealctl registry prune [flags]
Flags:
-c, --config string registry config path (default "/etc/registry/registry_config.yml")
-u, --delete-untagged delete manifests that are not currently referenced via tag
-d, --dry-run do everything except remove the blobs
-h, --help help for prune
Global Flags:
--debug enable debug logger
--root string storage root dir (default "/var/lib/containers/storage")
--runroot string storage state dir (default "/run/containers/storage")
--show-path enable show code path
--storage-driver string storage-driver (default "overlay")
--storage-opt strings storage driver option
```

#### Usage

```shell
$ sealctl registry prune
```

This file was deleted.

43 changes: 0 additions & 43 deletions fork/github.com/google/go-containerregistry/pkg/name/check.go

This file was deleted.

98 changes: 0 additions & 98 deletions fork/github.com/google/go-containerregistry/pkg/name/digest.go

This file was deleted.

Loading

0 comments on commit 22baae1

Please sign in to comment.