Skip to content
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

Content of registries.yaml is not correct #20

Open
bk201 opened this issue Jan 13, 2022 · 0 comments
Open

Content of registries.yaml is not correct #20

bk201 opened this issue Jan 13, 2022 · 0 comments

Comments

@bk201
Copy link
Member

bk201 commented Jan 13, 2022

rancherd version: v0.0.1-alpha13

To Reproduce

Init a cluster with the following config:

# cat /etc/rancher/rancherd/config.yaml
role: cluster-init
token: somethingrandom
kubernetesVersion: v1.21.8+k3s1
rancherVersion: stable

registries:
  mirrors:
    docker.io:
      endpoint:
        - "http://192.168.2.106:5000"
    k8s.gcr.io:
      endpoint:
        - "http://192.168.2.106:5001"
    quay.io:
      endpoint:
        - "http://192.168.2.106:5002"

The generated registries.yaml file has content:

# cat /etc/rancher/k3s/registries.yaml
Auths: null
Configs: null
Mirrors:
  docker.io:
    Endpoints: null
    Rewrites: null
  k8s.gcr.io:
    Endpoints: null
    Rewrites: null
  quay.io:
    Endpoints: null
    Rewrites: null

If I changed the field endpoint to endpoints in the /etc/rancher/rancherd/config.yaml file, the generated file will be:

# cat /etc/rancher/k3s/registries.yaml
Auths: null
Configs: null
Mirrors:
  docker.io:
    Endpoints:
    - http://192.168.2.106:5000
    Rewrites: null
  k8s.gcr.io:
    Endpoints:
    - http://192.168.2.106:5001
    Rewrites: null
  quay.io:
    Endpoints:
    - http://192.168.2.106:5002
    Rewrites: null

This seems to be correct but k3s only accepts the key endpoint, not endpoints
https://rancher.com/docs/k3s/latest/en/installation/private-registry/#mirrors

Some investigation

The Endpoints field has no json field tag: https://github.com/rancher/wharfie/blob/efd07c927031e0b324f5ce56211eea0c4a13ca06/pkg/registries/types.go#L9

And package "sigs.k8s.io/yaml" is used to marshal the registry, which uses json.marshal and converts the result to yaml

data, err := yaml.Marshal(registry)

This might be the reason the generated file has key endpoint"s".

mudler added a commit to mudler/rancherd that referenced this issue Jun 17, 2022
Part of rancher#20. Will allow later on to set an emulated device.

Signed-off-by: Ettore Di Giacinto <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants