mirror of
https://github.com/siderolabs/talos.git
synced 2025-08-20 22:21:13 +02:00
There are few workarounds for Drone way of running integration test: DinD runs as a separate pod, and we can only access its exposed on the "host" ports, while from Talos cluster this endpoint is not reachable. So internally Talos nodes still use addresses like "10.5.0.2", while test is using "docker" to access it (that's name of the `docker` service in the pipeline). When running locally, 127.0.0.1 is used as endpoint, which should work fine both on OS X and Linux. Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
56 lines
1.2 KiB
Go
56 lines
1.2 KiB
Go
// This Source Code Form is subject to the terms of the Mozilla Public
|
|
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
package provision
|
|
|
|
import (
|
|
"io"
|
|
"os"
|
|
)
|
|
|
|
// Option controls Provisioner.
|
|
type Option func(o *Options) error
|
|
|
|
// WithLogWriter sets logging destination.
|
|
func WithLogWriter(w io.Writer) Option {
|
|
return func(o *Options) error {
|
|
o.LogWriter = w
|
|
|
|
return nil
|
|
}
|
|
}
|
|
|
|
// WithForceInitNodeAsEndpoint uses direct IP of init node as endpoint instead of (default)
|
|
// mode.
|
|
func WithForceInitNodeAsEndpoint() Option {
|
|
return func(o *Options) error {
|
|
o.ForceInitNodeAsEndpoint = true
|
|
|
|
return nil
|
|
}
|
|
}
|
|
|
|
// WithEndpoint specifies endpoint to use when acessing Talos cluster.
|
|
func WithEndpoint(endpoint string) Option {
|
|
return func(o *Options) error {
|
|
o.ForceEndpoint = endpoint
|
|
|
|
return nil
|
|
}
|
|
}
|
|
|
|
// Options describes Provisioner parameters.
|
|
type Options struct {
|
|
LogWriter io.Writer
|
|
ForceInitNodeAsEndpoint bool
|
|
ForceEndpoint string
|
|
}
|
|
|
|
// DefaultOptions returns default options.
|
|
func DefaultOptions() Options {
|
|
return Options{
|
|
LogWriter: os.Stderr,
|
|
}
|
|
}
|