mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-14 02:43:36 +00:00
rebase: update kubernetes to 1.26.1
update kubernetes and its dependencies to v1.26.1 Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
This commit is contained in:
committed by
mergify[bot]
parent
e9e33fb851
commit
9c8de9471e
262
vendor/go.opentelemetry.io/otel/CONTRIBUTING.md
generated
vendored
262
vendor/go.opentelemetry.io/otel/CONTRIBUTING.md
generated
vendored
@ -15,11 +15,11 @@ join the meeting or get in touch on
|
||||
|
||||
You can view and edit the source code by cloning this repository:
|
||||
|
||||
```bash
|
||||
```sh
|
||||
git clone https://github.com/open-telemetry/opentelemetry-go.git
|
||||
```
|
||||
|
||||
Run `make test` to run the tests instead of `go test`.
|
||||
Run `make test` to run the tests instead of `go test`.
|
||||
|
||||
There are some generated files checked into the repo. To make sure
|
||||
that the generated files are up-to-date, run `make` (or `make
|
||||
@ -43,7 +43,7 @@ To create a new PR, fork the project in GitHub and clone the upstream
|
||||
repo:
|
||||
|
||||
```sh
|
||||
$ go get -d go.opentelemetry.io/otel
|
||||
go get -d go.opentelemetry.io/otel
|
||||
```
|
||||
|
||||
(This may print some warning about "build constraints exclude all Go
|
||||
@ -53,7 +53,7 @@ This will put the project in `${GOPATH}/src/go.opentelemetry.io/otel`. You
|
||||
can alternatively use `git` directly with:
|
||||
|
||||
```sh
|
||||
$ git clone https://github.com/open-telemetry/opentelemetry-go
|
||||
git clone https://github.com/open-telemetry/opentelemetry-go
|
||||
```
|
||||
|
||||
(Note that `git clone` is *not* using the `go.opentelemetry.io/otel` name -
|
||||
@ -66,20 +66,20 @@ current working directory.
|
||||
Enter the newly created directory and add your fork as a new remote:
|
||||
|
||||
```sh
|
||||
$ git remote add <YOUR_FORK> git@github.com:<YOUR_GITHUB_USERNAME>/opentelemetry-go
|
||||
git remote add <YOUR_FORK> git@github.com:<YOUR_GITHUB_USERNAME>/opentelemetry-go
|
||||
```
|
||||
|
||||
Check out a new branch, make modifications, run linters and tests, update
|
||||
`CHANGELOG.md`, and push the branch to your fork:
|
||||
|
||||
```sh
|
||||
$ git checkout -b <YOUR_BRANCH_NAME>
|
||||
git checkout -b <YOUR_BRANCH_NAME>
|
||||
# edit files
|
||||
# update changelog
|
||||
$ make precommit
|
||||
$ git add -p
|
||||
$ git commit
|
||||
$ git push <YOUR_FORK> <YOUR_BRANCH_NAME>
|
||||
make precommit
|
||||
git add -p
|
||||
git commit
|
||||
git push <YOUR_FORK> <YOUR_BRANCH_NAME>
|
||||
```
|
||||
|
||||
Open a pull request against the main `opentelemetry-go` repo. Be sure to add the pull
|
||||
@ -113,6 +113,7 @@ A PR is considered to be **ready to merge** when:
|
||||
one day and may be merged with a single Maintainer's approval.
|
||||
* `CHANGELOG.md` has been updated to reflect what has been
|
||||
added, changed, removed, or fixed.
|
||||
* `README.md` has been updated if necessary.
|
||||
* Urgent fix can take exception as long as it has been actively
|
||||
communicated.
|
||||
|
||||
@ -140,8 +141,28 @@ It is preferable to have contributions follow the idioms of the
|
||||
language rather than conform to specific API names or argument
|
||||
patterns in the spec.
|
||||
|
||||
For a deeper discussion, see:
|
||||
https://github.com/open-telemetry/opentelemetry-specification/issues/165
|
||||
For a deeper discussion, see
|
||||
[this](https://github.com/open-telemetry/opentelemetry-specification/issues/165).
|
||||
|
||||
## Documentation
|
||||
|
||||
Each non-example Go Module should have its own `README.md` containing:
|
||||
|
||||
- A pkg.go.dev badge which can be generated [here](https://pkg.go.dev/badge/).
|
||||
- Brief description.
|
||||
- Installation instructions (and requirements if applicable).
|
||||
- Hyperlink to an example. Depending on the component the example can be:
|
||||
- An `example_test.go` like [here](exporters/stdout/stdouttrace/example_test.go).
|
||||
- A sample Go application with its own `README.md`, like [here](example/zipkin).
|
||||
- Additional documentation sections such us:
|
||||
- Configuration,
|
||||
- Contributing,
|
||||
- References.
|
||||
|
||||
[Here](exporters/jaeger/README.md) is an example of a concise `README.md`.
|
||||
|
||||
Moreover, it should be possible to navigate to any `README.md` from the
|
||||
root `README.md`.
|
||||
|
||||
## Style Guide
|
||||
|
||||
@ -166,32 +187,40 @@ to the reasons why.
|
||||
|
||||
### Configuration
|
||||
|
||||
When creating an instantiation function for a complex `struct` it is useful
|
||||
to allow variable number of options to be applied. However, the strong type
|
||||
system of Go restricts the function design options. There are a few ways to
|
||||
solve this problem, but we have landed on the following design.
|
||||
When creating an instantiation function for a complex `type T struct`, it is
|
||||
useful to allow variable number of options to be applied. However, the strong
|
||||
type system of Go restricts the function design options. There are a few ways
|
||||
to solve this problem, but we have landed on the following design.
|
||||
|
||||
#### `config`
|
||||
|
||||
Configuration should be held in a `struct` named `config`, or prefixed with
|
||||
specific type name this Configuration applies to if there are multiple
|
||||
`config` in the package. This `struct` must contain configuration options.
|
||||
`config` in the package. This type must contain configuration options.
|
||||
|
||||
```go
|
||||
// config contains configuration options for a thing.
|
||||
type config struct {
|
||||
// options ...
|
||||
// options ...
|
||||
}
|
||||
```
|
||||
|
||||
In general the `config` `struct` will not need to be used externally to the
|
||||
In general the `config` type will not need to be used externally to the
|
||||
package and should be unexported. If, however, it is expected that the user
|
||||
will likely want to build custom options for the configuration, the `config`
|
||||
should be exported. Please, include in the documentation for the `config`
|
||||
how the user can extend the configuration.
|
||||
|
||||
It is important that `config` are not shared across package boundaries.
|
||||
Meaning a `config` from one package should not be directly used by another.
|
||||
It is important that internal `config` are not shared across package boundaries.
|
||||
Meaning a `config` from one package should not be directly used by another. The
|
||||
one exception is the API packages. The configs from the base API, eg.
|
||||
`go.opentelemetry.io/otel/trace.TracerConfig` and
|
||||
`go.opentelemetry.io/otel/metric.InstrumentConfig`, are intended to be consumed
|
||||
by the SDK therefor it is expected that these are exported.
|
||||
|
||||
When a config is exported we want to maintain forward and backward
|
||||
compatibility, to achieve this no fields should be exported but should
|
||||
instead be accessed by methods.
|
||||
|
||||
Optionally, it is common to include a `newConfig` function (with the same
|
||||
naming scheme). This function wraps any defaults setting and looping over
|
||||
@ -199,14 +228,14 @@ all options to create a configured `config`.
|
||||
|
||||
```go
|
||||
// newConfig returns an appropriately configured config.
|
||||
func newConfig([]Option) config {
|
||||
// Set default values for config.
|
||||
config := config{/* […] */}
|
||||
for _, option := range options {
|
||||
option.Apply(&config)
|
||||
}
|
||||
// Preform any validation here.
|
||||
return config
|
||||
func newConfig(options ...Option) config {
|
||||
// Set default values for config.
|
||||
config := config{/* […] */}
|
||||
for _, option := range options {
|
||||
config = option.apply(config)
|
||||
}
|
||||
// Preform any validation here.
|
||||
return config
|
||||
}
|
||||
```
|
||||
|
||||
@ -224,10 +253,17 @@ To set the value of the options a `config` contains, a corresponding
|
||||
|
||||
```go
|
||||
type Option interface {
|
||||
Apply(*config)
|
||||
apply(config) config
|
||||
}
|
||||
```
|
||||
|
||||
Having `apply` unexported makes sure that it will not be used externally.
|
||||
Moreover, the interface becomes sealed so the user cannot easily implement
|
||||
the interface on its own.
|
||||
|
||||
The `apply` method should return a modified version of the passed config.
|
||||
This approach, instead of passing a pointer, is used to prevent the config from being allocated to the heap.
|
||||
|
||||
The name of the interface should be prefixed in the same way the
|
||||
corresponding `config` is (if at all).
|
||||
|
||||
@ -250,53 +286,74 @@ func With*(…) Option { … }
|
||||
```go
|
||||
type defaultFalseOption bool
|
||||
|
||||
func (o defaultFalseOption) Apply(c *config) {
|
||||
c.Bool = bool(o)
|
||||
func (o defaultFalseOption) apply(c config) config {
|
||||
c.Bool = bool(o)
|
||||
return c
|
||||
}
|
||||
|
||||
// WithOption sets a T* to have an option included.
|
||||
// WithOption sets a T to have an option included.
|
||||
func WithOption() Option {
|
||||
return defaultFalseOption(true)
|
||||
return defaultFalseOption(true)
|
||||
}
|
||||
```
|
||||
|
||||
```go
|
||||
type defaultTrueOption bool
|
||||
|
||||
func (o defaultTrueOption) Apply(c *config) {
|
||||
c.Bool = bool(o)
|
||||
func (o defaultTrueOption) apply(c config) config {
|
||||
c.Bool = bool(o)
|
||||
return c
|
||||
}
|
||||
|
||||
// WithoutOption sets a T* to have Bool option excluded.
|
||||
// WithoutOption sets a T to have Bool option excluded.
|
||||
func WithoutOption() Option {
|
||||
return defaultTrueOption(false)
|
||||
return defaultTrueOption(false)
|
||||
}
|
||||
````
|
||||
```
|
||||
|
||||
##### Declared Type Options
|
||||
|
||||
```go
|
||||
type myTypeOption struct {
|
||||
MyType MyType
|
||||
MyType MyType
|
||||
}
|
||||
|
||||
func (o myTypeOption) Apply(c *config) {
|
||||
c.MyType = o.MyType
|
||||
func (o myTypeOption) apply(c config) config {
|
||||
c.MyType = o.MyType
|
||||
return c
|
||||
}
|
||||
|
||||
// WithMyType sets T* to have include MyType.
|
||||
// WithMyType sets T to have include MyType.
|
||||
func WithMyType(t MyType) Option {
|
||||
return myTypeOption{t}
|
||||
return myTypeOption{t}
|
||||
}
|
||||
```
|
||||
|
||||
##### Functional Options
|
||||
|
||||
```go
|
||||
type optionFunc func(config) config
|
||||
|
||||
func (fn optionFunc) apply(c config) config {
|
||||
return fn(c)
|
||||
}
|
||||
|
||||
// WithMyType sets t as MyType.
|
||||
func WithMyType(t MyType) Option {
|
||||
return optionFunc(func(c config) config {
|
||||
c.MyType = t
|
||||
return c
|
||||
})
|
||||
}
|
||||
```
|
||||
|
||||
#### Instantiation
|
||||
|
||||
Using this configuration pattern to configure instantiation with a `New*`
|
||||
Using this configuration pattern to configure instantiation with a `NewT`
|
||||
function.
|
||||
|
||||
```go
|
||||
func NewT*(options ...Option) T* {…}
|
||||
func NewT(options ...Option) T {…}
|
||||
```
|
||||
|
||||
Any required parameters can be declared before the variadic `options`.
|
||||
@ -320,12 +377,12 @@ type config struct {
|
||||
|
||||
// DogOption apply Dog specific options.
|
||||
type DogOption interface {
|
||||
ApplyDog(*config)
|
||||
applyDog(config) config
|
||||
}
|
||||
|
||||
// BirdOption apply Bird specific options.
|
||||
type BirdOption interface {
|
||||
ApplyBird(*config)
|
||||
applyBird(config) config
|
||||
}
|
||||
|
||||
// Option apply options for all animals.
|
||||
@ -335,23 +392,42 @@ type Option interface {
|
||||
}
|
||||
|
||||
type weightOption float64
|
||||
func (o weightOption) ApplyDog(c *config) { c.Weight = float64(o) }
|
||||
func (o weightOption) ApplyBird(c *config) { c.Weight = float64(o) }
|
||||
func WithWeight(w float64) Option { return weightOption(w) }
|
||||
|
||||
func (o weightOption) applyDog(c config) config {
|
||||
c.Weight = float64(o)
|
||||
return c
|
||||
}
|
||||
|
||||
func (o weightOption) applyBird(c config) config {
|
||||
c.Weight = float64(o)
|
||||
return c
|
||||
}
|
||||
|
||||
func WithWeight(w float64) Option { return weightOption(w) }
|
||||
|
||||
type furColorOption string
|
||||
func (o furColorOption) ApplyDog(c *config) { c.Color = string(o) }
|
||||
func WithFurColor(c string) DogOption { return furColorOption(c) }
|
||||
|
||||
func (o furColorOption) applyDog(c config) config {
|
||||
c.Color = string(o)
|
||||
return c
|
||||
}
|
||||
|
||||
func WithFurColor(c string) DogOption { return furColorOption(c) }
|
||||
|
||||
type maxAltitudeOption float64
|
||||
func (o maxAltitudeOption) ApplyBird(c *config) { c.MaxAltitude = float64(o) }
|
||||
func WithMaxAltitude(a float64) BirdOption { return maxAltitudeOption(a) }
|
||||
|
||||
func (o maxAltitudeOption) applyBird(c config) config {
|
||||
c.MaxAltitude = float64(o)
|
||||
return c
|
||||
}
|
||||
|
||||
func WithMaxAltitude(a float64) BirdOption { return maxAltitudeOption(a) }
|
||||
|
||||
func NewDog(name string, o ...DogOption) Dog {…}
|
||||
func NewBird(name string, o ...BirdOption) Bird {…}
|
||||
```
|
||||
|
||||
### Interface Type
|
||||
### Interfaces
|
||||
|
||||
To allow other developers to better comprehend the code, it is important
|
||||
to ensure it is sufficiently documented. One simple measure that contributes
|
||||
@ -359,21 +435,91 @@ to this aim is self-documenting by naming method parameters. Therefore,
|
||||
where appropriate, methods of every exported interface type should have
|
||||
their parameters appropriately named.
|
||||
|
||||
#### Interface Stability
|
||||
|
||||
All exported stable interfaces that include the following warning in their
|
||||
doumentation are allowed to be extended with additional methods.
|
||||
|
||||
> Warning: methods may be added to this interface in minor releases.
|
||||
|
||||
Otherwise, stable interfaces MUST NOT be modified.
|
||||
|
||||
If new functionality is needed for an interface that cannot be changed it MUST
|
||||
be added by including an additional interface. That added interface can be a
|
||||
simple interface for the specific functionality that you want to add or it can
|
||||
be a super-set of the original interface. For example, if you wanted to a
|
||||
`Close` method to the `Exporter` interface:
|
||||
|
||||
```go
|
||||
type Exporter interface {
|
||||
Export()
|
||||
}
|
||||
```
|
||||
|
||||
A new interface, `Closer`, can be added:
|
||||
|
||||
```go
|
||||
type Closer interface {
|
||||
Close()
|
||||
}
|
||||
```
|
||||
|
||||
Code that is passed the `Exporter` interface can now check to see if the passed
|
||||
value also satisfies the new interface. E.g.
|
||||
|
||||
```go
|
||||
func caller(e Exporter) {
|
||||
/* ... */
|
||||
if c, ok := e.(Closer); ok {
|
||||
c.Close()
|
||||
}
|
||||
/* ... */
|
||||
}
|
||||
```
|
||||
|
||||
Alternatively, a new type that is the super-set of an `Exporter` can be created.
|
||||
|
||||
```go
|
||||
type ClosingExporter struct {
|
||||
Exporter
|
||||
Close()
|
||||
}
|
||||
```
|
||||
|
||||
This new type can be used similar to the simple interface above in that a
|
||||
passed `Exporter` type can be asserted to satisfy the `ClosingExporter` type
|
||||
and the `Close` method called.
|
||||
|
||||
This super-set approach can be useful if there is explicit behavior that needs
|
||||
to be coupled with the original type and passed as a unified type to a new
|
||||
function, but, because of this coupling, it also limits the applicability of
|
||||
the added functionality. If there exist other interfaces where this
|
||||
functionality should be added, each one will need their own super-set
|
||||
interfaces and will duplicate the pattern. For this reason, the simple targeted
|
||||
interface that defines the specific functionality should be preferred.
|
||||
|
||||
## Approvers and Maintainers
|
||||
|
||||
Approvers:
|
||||
|
||||
- [Evan Torrie](https://github.com/evantorrie), Verizon Media
|
||||
- [Josh MacDonald](https://github.com/jmacd), LightStep
|
||||
- [Sam Xie](https://github.com/XSAM)
|
||||
- [Sam Xie](https://github.com/XSAM), Cisco/AppDynamics
|
||||
- [David Ashpole](https://github.com/dashpole), Google
|
||||
- [Gustavo Silva Paiva](https://github.com/paivagustavo), LightStep
|
||||
- [Robert Pająk](https://github.com/pellared), Splunk
|
||||
- [Chester Cheung](https://github.com/hanyuancheung), Tencent
|
||||
- [Damien Mathieu](https://github.com/dmathieu), Auth0/Okta
|
||||
|
||||
Maintainers:
|
||||
|
||||
- [Aaron Clawson](https://github.com/MadVikingGod), LightStep
|
||||
- [Anthony Mirabella](https://github.com/Aneurysm9), AWS
|
||||
- [Tyler Yahn](https://github.com/MrAlias), Splunk
|
||||
|
||||
Emeritus:
|
||||
|
||||
- [Gustavo Silva Paiva](https://github.com/paivagustavo), LightStep
|
||||
|
||||
### Become an Approver or a Maintainer
|
||||
|
||||
See the [community membership document in OpenTelemetry community
|
||||
|
Reference in New Issue
Block a user