cluster: migrate registry from host container to in-cluster deployment#3856
cluster: migrate registry from host container to in-cluster deployment#3856lkingland wants to merge 1 commit into
Conversation
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: lkingland The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
f96a48b to
0470fa1
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3856 +/- ##
==========================================
- Coverage 53.43% 52.89% -0.54%
==========================================
Files 200 200
Lines 23405 23388 -17
==========================================
- Hits 12506 12372 -134
- Misses 9649 9766 +117
Partials 1250 1250
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
|
||
| if err := ensureRegistry(ctx, cfg, out); err != nil { | ||
| return err | ||
| registryManifest := `apiVersion: apps/v1 |
There was a problem hiding this comment.
possible improvement: make this Go struct instead of string literal.
| return fmt.Errorf("applying registry service: %w", err) | ||
| } | ||
|
|
||
| success(out, "Registry", time.Since(start)) |
There was a problem hiding this comment.
potential improvement: we could wait until http://registry.localtest.me/v2/ returns 200.
| // installRegistry deploys the container registry as in-cluster Kubernetes | ||
| // resources (Deployment + ClusterIP Service + Contour Ingress), configures | ||
| // host-side trust, and applies the local-registry-hosting ConfigMap. | ||
| func installRegistry(ctx context.Context, cfg ClusterConfig, out io.Writer) error { |
There was a problem hiding this comment.
Not sure when/how installRegistry() is called but it preferably should be called after Contour installation (or in parallel to it). But it's not necessary.
There was a problem hiding this comment.
But it's not necessary.
Because we use generic k8s ingress not some specific Contour resource.
|
unrelated to this PR: why we use |
Replace the shared host-side func-registry container with Kubernetes-native resources deployed inside each Kind cluster: - Deployment (registry:2 with hostPort 5000 + emptyDir volume) - ClusterIP Service (port 5000) - Contour Ingress at registry.localtest.me Key changes: - registryAddr is now "registry.localtest.me" (was "localhost:50000") - containerd mirrors point at http://localhost:5000 via hostPort (was http://func-registry:5000 via Docker network DNS) - Each cluster owns its own registry, destroyed with kind delete cluster - Delete flow simplified: no shared container teardown, just host trust revert on last-cluster removal - Removed: ensureRegistry, registryStatus, teardownRegistry, setupPodmanMacOSForwarding, and all host-container lifecycle code
0470fa1 to
05b13f2
Compare
|
@lkingland: The following test failed, say
DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
Exactly right! This is simply a stepping-stone. Translating script->Go code with this structure is much less error-prone. Next step is to replace the exec's with code wherever possible! Same way we did with the builders: wrap the cli, get it working, replace with the stdlib 👍🏻 |
Summary
Migrates
func cluster createfrom running a standalonefunc-registrycontainer on the host to deploying the registry as in-cluster Kubernetes resources, matching the approach already taken inhack/cluster.sh(PR #3718).What changed:
docker runcontainer with ExternalName Service)registryAddrisregistry.localtest.me(waslocalhost:50000)http://localhost:5000via hostPort (washttp://func-registry:5000via Docker network DNS)kind delete clusterensureRegistry,registryStatus,teardownRegistry,setupPodmanMacOSForwarding, and all host-container lifecycle constantsWhat's preserved:
daemon.json/ Podmanregistries.conf) — now usesregistry.localtest.me--skip-registry-configflag behavior unchanged