Skip to content

Commit

Permalink
📖 update links to godoc.org to use pkg.go.dev (#1756)
Browse files Browse the repository at this point in the history
* change godoc.org to pkg.go.dev

* fix badge
  • Loading branch information
xrstf committed Jan 12, 2022
1 parent e52a8b1 commit b8db76e
Show file tree
Hide file tree
Showing 12 changed files with 26 additions and 26 deletions.
12 changes: 6 additions & 6 deletions FAQ.md
Expand Up @@ -30,13 +30,13 @@ on your situation.
take this approach: the StatefulSet controller appends a specific number
to each pod that it creates, while the Deployment controller hashes the
pod template spec and appends that.

- In the few cases when you cannot take advantage of deterministic names
(e.g. when using generateName), it may be useful in to track which
actions you took, and assume that they need to be repeated if they don't
occur after a given time (e.g. using a requeue result). This is what
the ReplicaSet controller does.

In general, write your controller with the assumption that information
will eventually be correct, but may be slightly out of date. Make sure
that your reconcile function enforces the entire state of the world each
Expand All @@ -48,17 +48,17 @@ generally cover most circumstances.
### Q: Where's the fake client? How do I use it?

**A**: The fake client
[exists](https://godoc.org/sigs.k8s.io/controller-runtime/pkg/client/fake),
[exists](https://pkg.go.dev/sigs.k8s.io/controller-runtime/pkg/client/fake),
but we generally recommend using
[envtest.Environment](https://godoc.org/sigs.k8s.io/controller-runtime/pkg/envtest#Environment)
[envtest.Environment](https://pkg.go.dev/sigs.k8s.io/controller-runtime/pkg/envtest#Environment)
to test against a real API server. In our experience, tests using fake
clients gradually re-implement poorly-written impressions of a real API
server, which leads to hard-to-maintain, complex test code.

### Q: How should I write tests? Any suggestions for getting started?

- Use the aforementioned
[envtest.Environment](https://godoc.org/sigs.k8s.io/controller-runtime/pkg/envtest#Environment)
[envtest.Environment](https://pkg.go.dev/sigs.k8s.io/controller-runtime/pkg/envtest#Environment)
to spin up a real API server instead of trying to mock one out.

- Structure your tests to check that the state of the world is as you
Expand All @@ -77,5 +77,5 @@ mapping between Go types and group-version-kinds in Kubernetes. In
general, your application should have its own Scheme containing the types
from the API groups that it needs (be they Kubernetes types or your own).
See the [scheme builder
docs](https://godoc.org/sigs.k8s.io/controller-runtime/pkg/scheme) for
docs](https://pkg.go.dev/sigs.k8s.io/controller-runtime/pkg/scheme) for
more information.
2 changes: 1 addition & 1 deletion README.md
@@ -1,5 +1,5 @@
[![Go Report Card](https://goreportcard.com/badge/sigs.k8s.io/controller-runtime)](https://goreportcard.com/report/sigs.k8s.io/controller-runtime)
[![godoc](https://godoc.org/sigs.k8s.io/controller-runtime?status.svg)](https://godoc.org/sigs.k8s.io/controller-runtime)
[![godoc](https://pkg.go.dev/badge/sigs.k8s.io/controller-runtime)](https://pkg.go.dev/sigs.k8s.io/controller-runtime)

# Kubernetes controller-runtime Project

Expand Down
6 changes: 3 additions & 3 deletions designs/README.md
Expand Up @@ -2,7 +2,7 @@ Designs
=======

These are design documents for changes to Controller Runtime They exist
to help document the design processes that go into writing Controller
to help document the design processes that go into writing Controller
Runtime, but may not be up-to-date (more below).

Not all changes to Controller Runtime need a design document -- only major
Expand All @@ -17,7 +17,7 @@ proof-of-concept process can help iron out wrinkles and can help with the
## Out-of-Date Designs

**Controller Runtime documentation
[GoDoc](https://godoc.org/sigs.k8s.io/controller-runtime) should be
[GoDoc](https://pkg.go.dev/sigs.k8s.io/controller-runtime) should be
considered the canonical, update-to-date reference and architectural
documentation** for Controller Runtime.

Expand All @@ -33,4 +33,4 @@ This change is out of date. It turns out curly braces a frustrating to
type, so we had to abandon functions entirely, and have users specify
custom functionality using strings of Common LISP instead. See #000 for
more information.
```
```
16 changes: 8 additions & 8 deletions designs/component-config.md
Expand Up @@ -37,7 +37,7 @@ Currently controllers that use `controller-runtime` need to configure the `ctrl.

## Motivation

This change is important because:
This change is important because:
- it will help make it easier for controllers to be configured by other machine processes
- it will reduce the required flags required to start a controller
- allow for configuration types which aren't natively supported by flags
Expand Down Expand Up @@ -65,7 +65,7 @@ This change is important because:

## Proposal

The `ctrl.Manager` _SHOULD_ support loading configurations from `ComponentConfig` like objects.
The `ctrl.Manager` _SHOULD_ support loading configurations from `ComponentConfig` like objects.
An interface for that object with getters for the specific configuration parameters is created to bridge existing patterns.

Without breaking the current `ctrl.NewManager` which uses an exported `ctrl.Options{}` the `manager.go` can expose a new func, `NewFromComponentConfig()` this would be able to loop through the getters to populate an internal `ctrl.Options{}` and pass that into `New()`.
Expand Down Expand Up @@ -101,7 +101,7 @@ type ManagerConfiguration interface {
func NewFromComponentConfig(config *rest.Config, scheme *runtime.Scheme, filename string, managerconfig ManagerConfiguration) (Manager, error) {
codecs := serializer.NewCodecFactory(scheme)
if err := decodeComponentConfigFileInto(codecs, filename, managerconfig); err != nil {

}
options := Options{}

Expand Down Expand Up @@ -139,7 +139,7 @@ import (

// ControllerManagerConfiguration defines the embedded RuntimeConfiguration for controller-runtime clients.
type ControllerManagerConfiguration struct {
Namespace string `json:"namespace,omitempty"`
Namespace string `json:"namespace,omitempty"`

SyncPeriod *time.Duration `json:"syncPeriod,omitempty"`

Expand Down Expand Up @@ -168,7 +168,7 @@ type ControllerManagerConfigurationHealth struct {

#### Default ComponentConfig Type

To enable `controller-runtime` to have a default `ComponentConfig` struct which can be used instead of requiring each controller or extension to build it's own `ComponentConfig` type, we can create a `DefaultControllerConfiguration` type which can exist in `pkg/api/config/v1alpha1/types.go`. This will allow the controller authors to use this before needing to implement their own type with additional configs.
To enable `controller-runtime` to have a default `ComponentConfig` struct which can be used instead of requiring each controller or extension to build its own `ComponentConfig` type, we can create a `DefaultControllerConfiguration` type which can exist in `pkg/api/config/v1alpha1/types.go`. This will allow the controller authors to use this before needing to implement their own type with additional configs.

```golang
// pkg/api/config/v1alpha1/types.go
Expand Down Expand Up @@ -212,12 +212,12 @@ if err != nil {
}
```

The above example uses `configname` which is the name of the file to load the configuration from and uses `scheme` to get the specific serializer, eg `serializer.NewCodecFactory(scheme)`. This will allow the configuration to be unmarshalled into the `runtime.Object` type and passed into the
The above example uses `configname` which is the name of the file to load the configuration from and uses `scheme` to get the specific serializer, eg `serializer.NewCodecFactory(scheme)`. This will allow the configuration to be unmarshalled into the `runtime.Object` type and passed into the
`ctrl.NewManagerFromComponentConfig()` as a `ManagerConfiguration` interface.

#### Using Flags w/ ComponentConfig

Since this design still requires setting up the initial `ComponentConfig` type and passing in a pointer to `ctrl.NewFromComponentConfig()` if you want to allow for the use of flags, your controller can use any of the different flagging interfaces. eg [`flag`](https://golang.org/pkg/flag/), [`pflag`](https://godoc.org/github.com/spf13/pflag), [`flagnum`](https://godoc.org/github.com/luci/luci-go/common/flag/flagenum) and set values on the `ComponentConfig` type prior to passing the pointer into the `ctrl.NewFromComponentConfig()`, example below.
Since this design still requires setting up the initial `ComponentConfig` type and passing in a pointer to `ctrl.NewFromComponentConfig()` if you want to allow for the use of flags, your controller can use any of the different flagging interfaces. eg [`flag`](https://golang.org/pkg/flag/), [`pflag`](https://pkg.go.dev/github.com/spf13/pflag), [`flagnum`](https://pkg.go.dev/github.com/luci/luci-go/common/flag/flagenum) and set values on the `ComponentConfig` type prior to passing the pointer into the `ctrl.NewFromComponentConfig()`, example below.

```golang
leaderElect := true
Expand Down Expand Up @@ -247,7 +247,7 @@ import (

metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
configv1alpha1 "sigs.k8s.io/controller-runtime/pkg/apis/config/v1alpha1"
)
)

type ControllerNameConfigurationSpec struct {
configv1alpha1.ControllerManagerConfiguration `json:",inline"`
Expand Down
2 changes: 1 addition & 1 deletion doc.go
Expand Up @@ -107,7 +107,7 @@ limitations under the License.
//
// Logging (pkg/log) in controller-runtime is done via structured logs, using a
// log set of interfaces called logr
// (https://godoc.org/github.com/go-logr/logr). While controller-runtime
// (https://pkg.go.dev/github.com/go-logr/logr). While controller-runtime
// provides easy setup for using Zap (https://go.uber.org/zap, pkg/log/zap),
// you can provide any implementation of logr as the base logger for
// controller-runtime.
Expand Down
2 changes: 1 addition & 1 deletion pkg/client/fake/client.go
Expand Up @@ -227,7 +227,7 @@ func (t versionedTracker) Create(gvr schema.GroupVersionResource, obj runtime.Ob

// convertFromUnstructuredIfNecessary will convert *unstructured.Unstructured for a GVK that is recocnized
// by the schema into the whatever the schema produces with New() for said GVK.
// This is required because the tracker unconditionally saves on manipulations, but it's List() implementation
// This is required because the tracker unconditionally saves on manipulations, but its List() implementation
// tries to assign whatever it finds into a ListType it gets from schema.New() - Thus we have to ensure
// we save as the very same type, otherwise subsequent List requests will fail.
func convertFromUnstructuredIfNecessary(s *runtime.Scheme, o runtime.Object) (runtime.Object, error) {
Expand Down
2 changes: 1 addition & 1 deletion pkg/controller/controllerutil/controllerutil.go
Expand Up @@ -345,7 +345,7 @@ func mutate(f MutateFn, key client.ObjectKey, obj client.Object) error {
return nil
}

// MutateFn is a function which mutates the existing object into it's desired state.
// MutateFn is a function which mutates the existing object into its desired state.
type MutateFn func() error

// AddFinalizer accepts an Object and adds the provided finalizer if not present.
Expand Down
2 changes: 1 addition & 1 deletion pkg/log/deleg.go
Expand Up @@ -177,7 +177,7 @@ func (l *DelegatingLogSink) Fulfill(actual logr.LogSink) {
}

// NewDelegatingLogSink constructs a new DelegatingLogSink which uses
// the given logger before it's promise is fulfilled.
// the given logger before its promise is fulfilled.
func NewDelegatingLogSink(initial logr.LogSink) *DelegatingLogSink {
l := &DelegatingLogSink{
logger: initial,
Expand Down
2 changes: 1 addition & 1 deletion pkg/log/log.go
Expand Up @@ -29,7 +29,7 @@ limitations under the License.
//
// All logging in controller-runtime is structured, using a set of interfaces
// defined by a package called logr
// (https://godoc.org/github.com/go-logr/logr). The sub-package zap provides
// (https://pkg.go.dev/github.com/go-logr/logr). The sub-package zap provides
// helpers for setting up logr backed by Zap (go.uber.org/zap).
package log

Expand Down
2 changes: 1 addition & 1 deletion pkg/log/warning_handler.go
Expand Up @@ -47,7 +47,7 @@ type KubeAPIWarningLogger struct {
}

// HandleWarningHeader handles logging for responses from API server that are
// warnings with code being 299 and uses a logr.Logger for it's logging purposes.
// warnings with code being 299 and uses a logr.Logger for its logging purposes.
func (l *KubeAPIWarningLogger) HandleWarningHeader(code int, agent string, message string) {
if code != 299 || len(message) == 0 {
return
Expand Down
2 changes: 1 addition & 1 deletion pkg/log/zap/zap.go
Expand Up @@ -138,7 +138,7 @@ type Options struct {
// console when Development is true and JSON otherwise
Encoder zapcore.Encoder
// EncoderConfigOptions can modify the EncoderConfig needed to initialize an Encoder.
// See https://godoc.org/go.uber.org/zap/zapcore#EncoderConfig for the list of options
// See https://pkg.go.dev/go.uber.org/zap/zapcore#EncoderConfig for the list of options
// that can be configured.
// Note that the EncoderConfigOptions are not applied when the Encoder option is already set.
EncoderConfigOptions []EncoderConfigOption
Expand Down
2 changes: 1 addition & 1 deletion tools/setup-envtest/store/store.go
Expand Up @@ -229,7 +229,7 @@ func (s *Store) Remove(ctx context.Context, matching Filter) ([]Item, error) {
func (s *Store) Path(item Item) (string, error) {
path := s.unpackedPath(item.dirName())
// NB(directxman12): we need root's realpath because RealPath only
// looks at it's own path, and so thus doesn't prepend the underlying
// looks at its own path, and so thus doesn't prepend the underlying
// root's base path.
//
// Technically, if we're fed something that's double wrapped as root,
Expand Down

0 comments on commit b8db76e

Please sign in to comment.