Documentation
¶
Overview ¶
+kubebuilder:object:generate=true +groupName=rig.platform
+kubebuilder:object:generate=true +groupName=rig.platform
Index ¶
- Variables
- func CapsuleSpecToRolloutConfig(spec *platformv1.CapsuleSpec) (*capsule.RolloutConfig, error)
- func ChangesFromSpecPair(curSpec, newSpec *platformv1.CapsuleSpec) ([]*capsule.Change, error)
- func ConfigFileSpecConversion(c *platformv1.File) *capsule.ConfigFile
- func ContainerSettingsSpecConversion(spec *platformv1.CapsuleSpec) (*capsule.ContainerSettings, error)
- func CronJobConversion(j *capsule.CronJob) *v1alpha2.CronJob
- func CronJobSpecConversion(j *v1alpha2.CronJob) *capsule.CronJob
- func EnvironmentSourceConversion(source *capsule.EnvironmentSource) (*platformv1.EnvironmentSource, error)
- func EnvironmentSourceSpecConversion(source *platformv1.EnvironmentSource) *capsule.EnvironmentSource
- func FeedContainerSettings(spec *platformv1.CapsuleSpec, containerSettings *capsule.ContainerSettings) error
- func HorizontalScaleConversion(horizontal *capsule.HorizontalScale, replicas uint32) *platformv1.HorizontalScale
- func HorizontalScaleSpecConversion(spec *platformv1.HorizontalScale) *capsule.HorizontalScale
- func InterfaceConversion(i *capsule.Interface) (*v1alpha2.CapsuleInterface, error)
- func InterfaceSpecConversion(i *v1alpha2.CapsuleInterface) *capsule.Interface
- func MergeCapsuleSpecs(patch, into *platformv1.CapsuleSpec) (*platformv1.CapsuleSpec, error)
- func MergeProjectEnv(patch *platformv1.ProjEnvCapsuleBase, into *platformv1.CapsuleSpec) (*platformv1.CapsuleSpec, error)
- func RolloutConfigToCapsuleSpec(rc *capsule.RolloutConfig) (*platformv1.CapsuleSpec, error)
- func ValidString(bs []byte) bool
- func YAMLToCapsuleProto(bytes []byte) (*platformv1.Capsule, error)
- func YAMLToCapsuleSetProto(bytes []byte) (*platformv1.CapsuleSet, error)
- func YAMLToCapsuleSpecProto(bytes []byte) (*platformv1.CapsuleSpec, error)
- func YAMLToSpecProto[T interface{ ... }](bs []byte, o T, expectedKind string) error
- type Capsule
- type CapsuleSet
- type CapsuleSpec
- type Environment
- type EnvironmentSource
- type EnvironmentSourceKind
- type EnvironmentVariables
- type File
- type HorizontalScale
- type HostCapsule
- type HostNetwork
- type InterfaceOptions
- type ProjEnvCapsuleBase
- type Project
- type ProxyInterface
- type Scale
Constants ¶
This section is empty.
Variables ¶
var ( // GroupVersion is group version used to register these objects GroupVersion = schema.GroupVersion{Group: "platform.rig.dev", Version: "v1"} // SchemeBuilder is used to add go types to the GroupVersionKind scheme SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion} // AddToScheme adds the types in this group-version to the given scheme. AddToScheme = SchemeBuilder.AddToScheme )
Functions ¶
func CapsuleSpecToRolloutConfig ¶ added in v1.9.0
func CapsuleSpecToRolloutConfig(spec *platformv1.CapsuleSpec) (*capsule.RolloutConfig, error)
func ChangesFromSpecPair ¶ added in v1.9.4
func ChangesFromSpecPair(curSpec, newSpec *platformv1.CapsuleSpec) ([]*capsule.Change, error)
func ConfigFileSpecConversion ¶ added in v1.9.4
func ConfigFileSpecConversion(c *platformv1.File) *capsule.ConfigFile
func ContainerSettingsSpecConversion ¶ added in v1.9.4
func ContainerSettingsSpecConversion(spec *platformv1.CapsuleSpec) (*capsule.ContainerSettings, error)
func CronJobConversion ¶ added in v1.9.0
func CronJobSpecConversion ¶ added in v1.9.4
func EnvironmentSourceConversion ¶ added in v1.9.0
func EnvironmentSourceConversion(source *capsule.EnvironmentSource) (*platformv1.EnvironmentSource, error)
func EnvironmentSourceSpecConversion ¶ added in v1.9.4
func EnvironmentSourceSpecConversion(source *platformv1.EnvironmentSource) *capsule.EnvironmentSource
func FeedContainerSettings ¶ added in v1.9.0
func FeedContainerSettings(spec *platformv1.CapsuleSpec, containerSettings *capsule.ContainerSettings) error
func HorizontalScaleConversion ¶ added in v1.9.0
func HorizontalScaleConversion(horizontal *capsule.HorizontalScale, replicas uint32) *platformv1.HorizontalScale
func HorizontalScaleSpecConversion ¶ added in v1.9.4
func HorizontalScaleSpecConversion(spec *platformv1.HorizontalScale) *capsule.HorizontalScale
func InterfaceConversion ¶ added in v1.9.0
func InterfaceConversion(i *capsule.Interface) (*v1alpha2.CapsuleInterface, error)
func InterfaceSpecConversion ¶ added in v1.9.4
func InterfaceSpecConversion(i *v1alpha2.CapsuleInterface) *capsule.Interface
func MergeCapsuleSpecs ¶ added in v1.10.5
func MergeCapsuleSpecs(patch, into *platformv1.CapsuleSpec) (*platformv1.CapsuleSpec, error)
nolint:lll MergeCapsuleSpec merges a CapsuleSpec into another CapsuleSpec and returns a new object with the merged result It uses StrategicMergePatch (https://kubernetes.io/docs/tasks/manage-kubernetes-objects/update-api-object-kubectl-patch/)
func MergeProjectEnv ¶ added in v1.10.5
func MergeProjectEnv(patch *platformv1.ProjEnvCapsuleBase, into *platformv1.CapsuleSpec) (*platformv1.CapsuleSpec, error)
nolint:lll MergeProjectEnv merges a ProjEnvCapsuleBase into a CapsuleSpec and returns a new object with the merged result It uses StrategicMergePatch (https://kubernetes.io/docs/tasks/manage-kubernetes-objects/update-api-object-kubectl-patch/)
func RolloutConfigToCapsuleSpec ¶ added in v1.9.0
func RolloutConfigToCapsuleSpec(rc *capsule.RolloutConfig) (*platformv1.CapsuleSpec, error)
func ValidString ¶ added in v1.10.2
func YAMLToCapsuleProto ¶ added in v1.10.0
func YAMLToCapsuleProto(bytes []byte) (*platformv1.Capsule, error)
func YAMLToCapsuleSetProto ¶ added in v1.11.0
func YAMLToCapsuleSetProto(bytes []byte) (*platformv1.CapsuleSet, error)
func YAMLToCapsuleSpecProto ¶ added in v1.10.0
func YAMLToCapsuleSpecProto(bytes []byte) (*platformv1.CapsuleSpec, error)
Types ¶
type Capsule ¶ added in v1.9.0
type Capsule struct {
metav1.TypeMeta `json:",inline"`
// Name,Project,Environment is unique
// Project,Name referes to an existing Capsule type with the given name and project
// Will throw an error (in the platform) if the Capsule does not exist
Name string `json:"name" protobuf:"3"`
// Project references an existing Project type with the given name
// Will throw an error (in the platform) if the Project does not exist
Project string `json:"project" protobuf:"4"`
// Environment references an existing Environment type with the given name
// Will throw an error (in the platform) if the Environment does not exist
// The environment also needs to be present in the parent Capsule
Environment string `json:"environment" protobuf:"5"`
Spec CapsuleSpec `json:"spec" protobuf:"6"`
}
+kubebuilder:object:root=true
func CapsuleProtoToK8s ¶ added in v1.10.5
func (*Capsule) DeepCopy ¶ added in v1.9.0
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Capsule.
func (*Capsule) DeepCopyInto ¶ added in v1.9.0
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (*Capsule) DeepCopyObject ¶ added in v1.9.0
DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
type CapsuleSet ¶ added in v1.9.0
type CapsuleSet struct {
metav1.TypeMeta `json:",inline"`
// Name,Project is unique
Name string `json:"name" protobuf:"3"`
// Project references an existing Project type with the given name
// Will throw an error (in the platform) if the Project does not exist
Project string `json:"project" protobuf:"4"`
// Capsule-level defaults
Spec CapsuleSpec `json:"spec" protobuf:"5"`
Environments map[string]CapsuleSpec `json:"environments" protobuf:"6"`
EnvironmentRefs []string `json:"environmentRefs" protobuf:"7"`
}
func (*CapsuleSet) DeepCopy ¶ added in v1.9.0
func (in *CapsuleSet) DeepCopy() *CapsuleSet
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CapsuleSet.
func (*CapsuleSet) DeepCopyInto ¶ added in v1.9.0
func (in *CapsuleSet) DeepCopyInto(out *CapsuleSet)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (*CapsuleSet) DeepCopyObject ¶ added in v1.9.0
func (in *CapsuleSet) DeepCopyObject() runtime.Object
DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
type CapsuleSpec ¶ added in v1.9.0
type CapsuleSpec struct {
metav1.TypeMeta `json:",inline"`
Annotations map[string]string `json:"annotations" protobuf:"11"`
// Image specifies what image the Capsule should run.
Image string `json:"image" protobuf:"3"`
// Command is run as a command in the shell. If left unspecified, the
// container will run using what is specified as ENTRYPOINT in the
// Dockerfile.
Command string `json:"command,omitempty" protobuf:"4"`
// Args is a list of arguments either passed to the Command or if Command
// is left empty the arguments will be passed to the ENTRYPOINT of the
// docker image.
Args []string `json:"args,omitempty" protobuf:"5" patchStrategy:"replace"`
// Interfaces specifies the list of interfaces the the container should
// have. Specifying interfaces will create the corresponding kubernetes
// Services and Ingresses depending on how the interface is configured.
// nolint:lll
Interfaces []v1alpha2.CapsuleInterface `json:"interfaces,omitempty" protobuf:"6" patchMergeKey:"port" patchStrategy:"merge"`
// Files is a list of files to mount in the container. These can either be
// based on ConfigMaps or Secrets.
Files []File `json:"files" protobuf:"7" patchMergeKey:"path" patchStrategy:"merge"`
// Env defines the environment variables set in the Capsule
Env EnvironmentVariables `json:"env" protobuf:"12"`
// Scale specifies the scaling of the Capsule.
Scale Scale `json:"scale,omitempty" protobuf:"8"`
CronJobs []v1alpha2.CronJob `json:"cronJobs,omitempty" protobuf:"10" patchMergeKey:"name" patchStrategy:"replace"`
// TODO Move to plugin
AutoAddRigServiceAccounts bool `json:"autoAddRigServiceAccounts" protobuf:"13"`
}
func (*CapsuleSpec) DeepCopy ¶ added in v1.9.0
func (in *CapsuleSpec) DeepCopy() *CapsuleSpec
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CapsuleSpec.
func (*CapsuleSpec) DeepCopyInto ¶ added in v1.9.0
func (in *CapsuleSpec) DeepCopyInto(out *CapsuleSpec)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (*CapsuleSpec) DeepCopyObject ¶ added in v1.9.0
func (in *CapsuleSpec) DeepCopyObject() runtime.Object
DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
type Environment ¶
type Environment struct {
metav1.TypeMeta `json:",inline"`
// Name is unique
Name string `json:"name" protobuf:"3"`
NamespaceTemplate string `json:"namespaceTemplate" protobuf:"4"`
OperatorVersion string `json:"operatorVersion" protobuf:"5"`
Cluster string `json:"cluster" protobuf:"6"`
// Environment level defaults
Spec ProjEnvCapsuleBase `json:"spec" protobuf:"7"`
Ephemeral bool `json:"ephemeral" protobuf:"8"`
ActiveProjects []string `json:"activeProjects" protobuf:"9"`
Global bool `json:"global" protobuf:"10"`
}
func (*Environment) DeepCopy ¶
func (in *Environment) DeepCopy() *Environment
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Environment.
func (*Environment) DeepCopyInto ¶
func (in *Environment) DeepCopyInto(out *Environment)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (*Environment) DeepCopyObject ¶
func (in *Environment) DeepCopyObject() runtime.Object
DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
type EnvironmentSource ¶
type EnvironmentSource struct {
// Name is the name of the kubernetes object containing the environment source.
Name string `json:"name" protobuf:"1"`
// Kind is the kind of source, either ConfigMap or Secret.
Kind EnvironmentSourceKind `json:"kind" protobuf:"2"`
}
func (*EnvironmentSource) DeepCopy ¶
func (in *EnvironmentSource) DeepCopy() *EnvironmentSource
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EnvironmentSource.
func (*EnvironmentSource) DeepCopyInto ¶
func (in *EnvironmentSource) DeepCopyInto(out *EnvironmentSource)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type EnvironmentSourceKind ¶
type EnvironmentSourceKind string
var ( EnvironmentSourceKindConfigMap EnvironmentSourceKind = "ConfigMap" EnvironmentSourceKindSecret EnvironmentSourceKind = "Secret" )
type EnvironmentVariables ¶ added in v1.9.0
type EnvironmentVariables struct {
// Raw is a list of environment variables as key-value pairs.
Raw map[string]string `json:"raw" protobuf:"1"`
// Sources is a list of source files which will be injected as environment variables.
// They can be references to either ConfigMaps or Secrets.
Sources []EnvironmentSource `json:"sources" protobuf:"2"`
}
EnvironmentVariables defines the environment variables injected into a Capsule.
func (*EnvironmentVariables) DeepCopy ¶ added in v1.9.0
func (in *EnvironmentVariables) DeepCopy() *EnvironmentVariables
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EnvironmentVariables.
func (*EnvironmentVariables) DeepCopyInto ¶ added in v1.9.0
func (in *EnvironmentVariables) DeepCopyInto(out *EnvironmentVariables)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type File ¶ added in v1.9.0
type File struct {
Path string `json:"path,omitempty" protobuf:"1"`
AsSecret bool `json:"asSecret,omitempty" protobuf:"3"`
Bytes *[]byte `json:"bytes,omitempty" protobuf:"4"`
String *string `json:"string,omitempty" protobuf:"5"`
}
func (*File) DeepCopy ¶ added in v1.9.0
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new File.
func (*File) DeepCopyInto ¶ added in v1.9.0
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type HorizontalScale ¶ added in v1.10.5
type HorizontalScale struct {
// Min specifies the minimum amount of instances to run.
Min uint32 `json:"min" protobuf:"4"`
// Max specifies the maximum amount of instances to run. Omit to
// disable autoscaling.
Max *uint32 `json:"max,omitempty" protobuf:"5"`
// Instances specifies minimum and maximum amount of Capsule
// instances.
// Deprecated; use `min` and `max` instead.
Instances *v1alpha2.Instances `json:"instances,omitempty" protobuf:"1"`
// CPUTarget specifies that this Capsule should be scaled using CPU
// utilization.
CPUTarget *v1alpha2.CPUTarget `json:"cpuTarget,omitempty" protobuf:"2"`
// CustomMetrics specifies custom metrics emitted by the custom.metrics.k8s.io API
// which the autoscaler should scale on
CustomMetrics []v1alpha2.CustomMetric `json:"customMetrics,omitempty" protobuf:"3" patchStrategy:"replace"`
}
HorizontalScale defines the policy for the number of replicas of the capsule It can both be configured with autoscaling and with a static number of replicas
func (*HorizontalScale) DeepCopy ¶ added in v1.10.5
func (in *HorizontalScale) DeepCopy() *HorizontalScale
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HorizontalScale.
func (*HorizontalScale) DeepCopyInto ¶ added in v1.10.5
func (in *HorizontalScale) DeepCopyInto(out *HorizontalScale)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type HostCapsule ¶ added in v1.10.3
type HostCapsule struct {
metav1.TypeMeta `json:",inline"`
// Name,Project,Environment is unique
// Project,Name referes to an existing Capsule type with the given name and project
// Will throw an error (in the platform) if the Capsule does not exist
Name string `json:"name" protobuf:"3"`
// Project references an existing Project type with the given name
// Will throw an error (in the platform) if the Project does not exist
Project string `json:"project" protobuf:"4"`
// Environment references an existing Environment type with the given name
// Will throw an error (in the platform) if the Environment does not exist
// The environment also needs to be present in the parent Capsule
Environment string `json:"environment" protobuf:"5"`
// Network mapping between the host network and the Kubernetes cluster network. When activated,
// traffic between the two networks will be tunneled according to the rules specified here.
Network HostNetwork `json:"network" protobuf:"6"`
}
+kubebuilder:object:root=true
func (*HostCapsule) DeepCopy ¶ added in v1.10.3
func (in *HostCapsule) DeepCopy() *HostCapsule
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HostCapsule.
func (*HostCapsule) DeepCopyInto ¶ added in v1.10.3
func (in *HostCapsule) DeepCopyInto(out *HostCapsule)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (*HostCapsule) DeepCopyObject ¶ added in v1.10.3
func (in *HostCapsule) DeepCopyObject() runtime.Object
DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
type HostNetwork ¶ added in v1.10.3
type HostNetwork struct {
// HostInterfaces are interfaces activated on the local machine (the host) and forwarded
// to the Kubernetes cluster capsules.
HostInterfaces []ProxyInterface `json:"hostInterfaces" protobuf:"1"`
// CapsuleInterfaces are interfaces activated on the Capsule within the Kubernetes cluster
// and forwarded to the local machine (the host). The traffic is directed to a single target,
// e.g. `localhost:8080`.
CapsuleInterface []ProxyInterface `json:"capsuleInterfaces" protobuf:"2"`
// TunnelPort for which the proxy-capsule should listen on. This is automatically set by the tooling.
TunnelPort uint32 `json:"tunnelPort,omitempty" protobuf:"3"`
}
func (*HostNetwork) DeepCopy ¶ added in v1.10.3
func (in *HostNetwork) DeepCopy() *HostNetwork
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HostNetwork.
func (*HostNetwork) DeepCopyInto ¶ added in v1.10.3
func (in *HostNetwork) DeepCopyInto(out *HostNetwork)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type InterfaceOptions ¶ added in v1.10.3
type InterfaceOptions struct {
// TCP enables layer-4 proxying in favor of layer-7 HTTP proxying.
TCP bool `json:"tcp,omitempty" protobuf:"1"`
// AllowOrigin sets the `Access-Control-Allow-Origin` Header on responses to
// the provided value, allowing local by-pass of CORS rules.
// Ignored if TCP is enabled.
AllowOrigin string `json:"allowOrigin,omitempty" protobuf:"2"`
// ChangeOrigin changes the Host header to match the given target. If not set,
// the Host header will be that of the original request.
// This does not impact the Origin header - use `Headers` to set that.
// Ignored if TCP is enabled.
ChangeOrigin bool `json:"changeOrigin,omitempty" protobuf:"3"`
// Headers to set on the proxy-requests.
// Ignored if TCP is enabled.
Headers map[string]string `json:"headers,omitempty" protobuf:"4"`
}
func (*InterfaceOptions) DeepCopy ¶ added in v1.10.3
func (in *InterfaceOptions) DeepCopy() *InterfaceOptions
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InterfaceOptions.
func (*InterfaceOptions) DeepCopyInto ¶ added in v1.10.3
func (in *InterfaceOptions) DeepCopyInto(out *InterfaceOptions)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type ProjEnvCapsuleBase ¶
type ProjEnvCapsuleBase struct {
Files []File `json:"files,omitempty" protobuf:"1"`
Env EnvironmentVariables `json:"env,omitempty" protobuf:"2"`
}
func (*ProjEnvCapsuleBase) DeepCopy ¶
func (in *ProjEnvCapsuleBase) DeepCopy() *ProjEnvCapsuleBase
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ProjEnvCapsuleBase.
func (*ProjEnvCapsuleBase) DeepCopyInto ¶
func (in *ProjEnvCapsuleBase) DeepCopyInto(out *ProjEnvCapsuleBase)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type Project ¶
type Project struct {
metav1.TypeMeta `json:",inline"`
// Name is unique
Name string `json:"name" protobuf:"3"`
// Project level defaults
Spec ProjEnvCapsuleBase `json:"spec" protobuf:"4"`
}
func (*Project) DeepCopy ¶
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Project.
func (*Project) DeepCopyInto ¶
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (*Project) DeepCopyObject ¶
DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
type ProxyInterface ¶ added in v1.10.3
type ProxyInterface struct {
// Port to accept traffic from.
Port uint32 `json:"port" protobuf:"1"`
// Target is the address:port to forward traffic to.
Target string `json:"target" protobuf:"2"`
// Options to further configure the proxying aspects of the interface.
Options InterfaceOptions `json:"options,omitempty" protobuf:"3"`
}
func (*ProxyInterface) DeepCopy ¶ added in v1.10.3
func (in *ProxyInterface) DeepCopy() *ProxyInterface
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ProxyInterface.
func (*ProxyInterface) DeepCopyInto ¶ added in v1.10.3
func (in *ProxyInterface) DeepCopyInto(out *ProxyInterface)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type Scale ¶ added in v1.10.5
type Scale struct {
// Horizontal specifies the horizontal scaling of the Capsule.
Horizontal HorizontalScale `json:"horizontal,omitempty" protobuf:"1"`
// Vertical specifies the vertical scaling of the Capsule.
Vertical *v1alpha2.VerticalScale `json:"vertical,omitempty" protobuf:"2"`
}
func (*Scale) DeepCopy ¶ added in v1.10.5
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Scale.
func (*Scale) DeepCopyInto ¶ added in v1.10.5
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.