Files
kubernetes/staging
Patrick Ohly 080432c46a client-go record: avoid panic when watch creation failed
The previous attempt to fix this in
6aa779f4ed (diff-efa2cd1347df22ace5a516ea794152d00ef2a079db135c81787ed920ecb73658)
didn't address the root cause (or perhaps created it, not sure): the goroutine
must not be started if watch creation failed.

Instead, the error gets logged (as before) and an empty watch gets returned to
the caller (new). This is necessary because the function doesn't have an error
return value and changing that now would be disruptive. The empty watch is
valid and usable, so callers won't crash when they calls Stop.

This showed up recently in failed unit tests, probably because test
cancellation makes this error more likely:

   "Unable start event watcher (will not retry!)" err="broadcaster already
   stopped" logger="TestGarbageCollectorConstruction leaked goroutine"

The logger value and a preceding warning show that this occurs after test
completion.
2024-05-29 14:10:49 +02:00
..
2023-05-11 16:43:38 +00:00

External Repository Staging Area

This directory is the staging area for packages that have been split to their own repository. The content here will be periodically published to respective top-level k8s.io repositories.

Repositories currently staged here:

The code in the staging/ directory is authoritative, i.e. the only copy of the code. You can directly modify such code.

Using staged repositories from Kubernetes code

Kubernetes code uses the repositories in this directory via a Go workspace and module replace statements. For example, when Kubernetes code imports a package from the k8s.io/client-go repository, that import is resolved to staging/src/k8s.io/client-go relative to the project root:

// pkg/example/some_code.go
package example

import (
  "k8s.io/client-go/dynamic" // resolves to staging/src/k8s.io/client-go/dynamic
)

Creating a new repository in staging

Adding the staging repository in kubernetes/kubernetes:

  1. Send an email to the SIG Architecture mailing list and the mailing list of the SIG which would own the repo requesting approval for creating the staging repository.

  2. Once approval has been granted, create the new staging repository.

  3. Update import-restrictions.yaml to add the list of other staging repos that this new repo can import.

  4. Add all mandatory template files to the staging repo as mentioned in https://github.com/kubernetes/kubernetes-template-project.

  5. Make sure that the .github/PULL_REQUEST_TEMPLATE.md and CONTRIBUTING.md files mention that PRs are not directly accepted to the repo.

  6. Ensure that docs.go file is added. Refer to #kubernetes/kubernetes#91354 for reference.

  7. NOTE: Do not edit go.mod or go.sum in the new repo (staging/src/k8s.io//) manually. Run the following instead:

  ./hack/update-vendor.sh
  1. Run ./hack/update-go-workspace.sh to add the module to the workspace.

Creating the published repository

  1. Create an issue in the kubernetes/org repo to request creation of the respective published repository in the Kubernetes org. The published repository must have an initial empty commit. It also needs specific access rules and branch settings. See #kubernetes/org#58 for an example.

  2. Setup branch protection and enable access to the stage-bots team by adding the repo in prow/config.yaml. See #kubernetes/test-infra#9292 for an example.

  3. Once the repository has been created in the Kubernetes org, update the publishing-bot to publish the staging repository by updating:

    • rules.yaml: Make sure that the list of dependencies reflects the staging repos in the Godeps.json file.

    • repos.sh: Add the staging repo in the list of repos to be published.

  4. Add the staging and published repositories as a subproject for the SIG that owns the repos in sigs.yaml.

  5. Add the repo to the list of staging repos in this README.md file.