github.com/etecs-ru/gnomock@v0.13.2/preset/k3s/options.go (about)

     1  package k3s
     2  
     3  // Option is an optional configuration of this Gnomock preset. Use available
     4  // Options to configure the container
     5  type Option func(*P)
     6  
     7  // WithVersion sets image version.
     8  func WithVersion(version string) Option {
     9  	return func(o *P) {
    10  		o.Version = version
    11  	}
    12  }
    13  
    14  // WithPort allows to use a custom port for k3s API access instead of the
    15  // default one. If no custom port is provided, port 48443 is used instead.
    16  //
    17  // Please make sure that whichever port you choose to use (including the
    18  // default) is available on the host system. Otherwise this container won't
    19  // start.
    20  func WithPort(port int) Option {
    21  	return func(o *P) {
    22  		o.Port = port
    23  	}
    24  }