Documentation ¶
Index ¶
- Constants
- type Deb
- func (d *Deb) Apply(runner plan.Runner, diff plan.Diff) (propagate bool, err error)
- func (d *Deb) QueryState(runner plan.Runner) (plan.State, error)
- func (d *Deb) State() plan.State
- func (d *Deb) Undo(runner plan.Runner, current plan.State) error
- func (d *Deb) WouldChangeState(r plan.Runner) (bool, error)
- type Dir
- type File
- type GatherFactFunc
- type KubeSecret
- type KubeadmInit
- type KubeadmJoin
- type KubectlApply
- type KubectlWait
- type OS
- func (p *OS) Apply(r plan.Runner, _ plan.Diff) (bool, error)
- func (p *OS) GetMachineID(r plan.Runner) (string, error)
- func (p *OS) GetSELinuxStatus() (SELinuxStatus, SELinuxMode, error)
- func (p *OS) GetSystemUUID(r plan.Runner) (string, error)
- func (p *OS) HasCommand(cmd string) (bool, error)
- func (p *OS) IsOSInContainerVM() (bool, error)
- func (p *OS) IsSELinuxMode(mode string) (bool, error)
- func (p *OS) QueryState(r plan.Runner) (plan.State, error)
- func (p *OS) State() plan.State
- func (p *OS) Undo(r plan.Runner, current plan.State) error
- type PkgType
- type RPM
- type ReadFileCmdFunc
- type Run
- type RunScript
- type SELinuxMode
- type SELinuxStatus
- type Service
Constants ¶
const ( // ServiceInactive is a non-started service. ServiceInactive = "inactive" // ServiceActivating is a starting service. ServiceActivating = "activating" // ServiceActive is a started service. ServiceActive = "active" // ServiceFailed is a service that failed to start ServiceFailed = "failed" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Deb ¶
type Deb struct { Name string `structs:"name"` // Suffix is either "=" followed by the version, or "/" followed by the release stream (stable|testing|unstable). // Examples: // Name: "busybox" // Name: "busybox", Suffix: "/stable" // Name: "busybox", Suffix: "=1:1.27.2-2ubuntu3.2" Suffix string `structs:"suffix"` }
Deb represents a .deb package.
func DebResourceFromPackage ¶
func DebResourceFromPackage(p debPkgInfo) *Deb
type Dir ¶
type Dir struct { // Path at which to create directory Path fmt.Stringer `structs:"path,omitempty"` // RecursiveDelete makes the undo operation recursive RecursiveDelete bool }
Dir represents a directory on the file system.
func (*Dir) QueryState ¶
QueryState implements plan.Resource.
type File ¶
type File struct { // Source is a path to a local file. Only of of (Source, Content) can be // specified at once. Source string `structs:"source,omitempty"` // Content is the file content. Only of of (Source, Content) can be specified // at once. Content string `structs:"content,omitempty"` // Destination is the file destination path (required). Destination string `structs:"destination"` // File MD5 checksum. We use md5sum as it's part of coreutils and even part of // the default alpine image. Checksum string `structs:"checksum" plan:"hide"` }
File represents a file on the file system.
func (*File) QueryState ¶
QueryState implements plan.Resource.
type KubeSecret ¶
type KubeSecret struct { // SecretName is the name of the secret to read SecretName string `structs:"secretName"` // Checksum contains the sha256 checksum of the secret data Checksum [sha256.Size]byte `structs:"checksum"` // DestinationDirectory is the location in which to write stored file data DestinationDirectory string `structs:"destinationDirectory"` // SecretData holds the actual secret contents -- not serialized SecretData map[string][]byte `structs:"-" plan:"hide"` // FileNameTransform transforms a secret key into the file name for its contents FileNameTransform func(string) string // contains filtered or unexported fields }
KubeSecret is a resource that reads a value out of a secret and writes it to the filesystem. It can only be created when running in code deployed within the cluster because we want to store the hash of the secret data in the Resource before the Plan is run so we can compare it against a later version of the Plan when the secret is updated.
func NewKubeSecretResource ¶
func NewKubeSecretResource(secretName, destinationDirectory, ns string, fileNameTransform func(string) string) (*KubeSecret, error)
func (*KubeSecret) QueryState ¶
type KubeadmInit ¶
type KubeadmInit struct { // PublicIP is public IP of the master node we are trying to setup here. PublicIP string `structs:"publicIP"` // PrivateIP is private IP of the master node we are trying to setup here. PrivateIP string `structs:"privateIP"` // NodeName, if non-empty, will override the default node name guessed by kubeadm. NodeName string // KubeletConfig groups all options & flags which need to be passed to kubelet. KubeletConfig *config.KubeletConfig `structs:"kubeletConfig"` // ConntrackMax is the maximum number of NAT connections for kubeproxy to track (0 to leave as-is). ConntrackMax int32 `structs:"conntrackMax"` // UseIPTables controls whether the following command is called or not: // sysctl net.bridge.bridge-nf-call-iptables=1 // prior to running kubeadm init. UseIPTables bool `structs:"useIPTables"` // kubeadmInitScriptPath is the path to the "kubeadm init" script to use. KubeadmInitScriptPath string `structs:"kubeadmInitScriptPath"` // IgnorePreflightErrors is optionally used to skip kubeadm's preflight checks. IgnorePreflightErrors []string `structs:"ignorePreflightErrors"` // SSHKeyPath is the path to the private SSH key used by WKS to SSH into // nodes to add/remove them to/from the Kubernetes cluster. SSHKeyPath string `structs:"sshKeyPath"` // BootstrapToken is the token used by kubeadm init and kubeadm join to // safely form new clusters. BootstrapToken *kubeadmapi.BootstrapTokenString `structs:"bootstrapToken"` // The version of Kubernetes to install KubernetesVersion string `structs:"kubernetesVersion"` // ControlPlaneEndpoint is the IP:port of the control plane load balancer. // Default: localhost:6443 // See also: https://kubernetes.io/docs/setup/independent/high-availability/#stacked-control-plane-and-etcd-nodes ControlPlaneEndpoint string `structs:"controlPlaneEndpoint"` // Cloud provider setting which is needed for kubeadm and kubelet CloudProvider string `structs:"cloudProvider"` // ImageRepository sets the container registry to pull images from. If empty, // `k8s.gcr.io` will be used by default. ImageRepository string `structs:"imageRepository"` // ExternalLoadBalancer is the name or IP of the external load balancer setup // in from the the API master nodes. ExternalLoadBalancer string // AdditionalSANs can hold additional SANs to add to the API server certificate. AdditionalSANs []string // The namespace in which to init kubeadm Namespace fmt.Stringer // Extra arguments to pass to the APIServer ExtraAPIServerArgs map[string]string // contains filtered or unexported fields }
KubeadmInit represents an attempt to init a Kubernetes node via kubeadm.
func (*KubeadmInit) Apply ¶
Apply implements plan.Resource. TODO: find a way to make this idempotent. TODO: should such a resource be split into smaller resources?
func (*KubeadmInit) QueryState ¶
QueryState implements plan.Resource.
func (*KubeadmInit) State ¶
func (ki *KubeadmInit) State() plan.State
State implements plan.Resource.
type KubeadmJoin ¶
type KubeadmJoin struct { // IsMaster should be true if this node should join as a master, or false otherwise. IsMaster bool `structs:"isMaster"` // NodeIP is the IP of the node trying to join the cluster. NodeIP string `structs:"nodeIP"` // NodeName, if non-empty, will override the default node name guessed by kubeadm. NodeName string // MasterIP is the IP of the master node to connect to in order to join the cluster -- // hidden because the value can change in multi-master configurations but should not make the node plan // appear to have changed. MasterIP string `structs:"masterIP" plan:"hide"` // MasterPort is the port of the master node to connect to in order to join the cluster. MasterPort int `structs:"masterPort"` // Token is used to authenticate with the Kubernetes API server. Token string `structs:"token" plan:"hide"` // DiscoveryTokenCaCertHash is used to validate that the root CA public key of the cluster we are trying to join matches. DiscoveryTokenCaCertHash string `structs:"discoveryTokenCaCertHash" plan:"hide"` // CertificateKey is used to add master nodes to the cluster. CertificateKey string `structs:"certificateKey" plan:"hide"` // IgnorePreflightErrors is optionally used to skip kubeadm's preflight checks. IgnorePreflightErrors []string `structs:"ignorePreflightErrors"` // External Load Balancer name or IP address to be used instead of the master's IP ExternalLoadBalancer string `structs:"externalLoadBalancer"` // Kubernetes Version is used to prepare different parameters KubernetesVersion string `structs:"version"` // contains filtered or unexported fields }
KubeadmJoin represents an attempt to join a Kubernetes node via kubeadm.
func (*KubeadmJoin) Apply ¶
Apply implements plan.Resource. TODO: find a way to make this idempotent. TODO: should such a resource be splitted in smaller resources?
func (*KubeadmJoin) QueryState ¶
QueryState implements plan.Resource.
func (*KubeadmJoin) State ¶
func (kj *KubeadmJoin) State() plan.State
State implements plan.Resource.
type KubectlApply ¶
type KubectlApply struct { // Filename is the remote manifest file name. // Only provide this if you do NOT provide ManifestPath or ManifestURL. Filename fmt.Stringer `structs:"filename"` // Manifest is the actual YAML/JSON content of the manifest to apply. // If this is provided, then there is no need to provide ManifestPath, but // Filename should be provided in order to name the remote manifest file. Manifest []byte `structs:"manifest"` // ManifestPath is the path to the manifest to apply. // If this is provided, then there is no need to provide Manifest. ManifestPath fmt.Stringer `structs:"manifestPath"` // ManifestURL is the URL of a remote manifest; if specified, // neither Filename, Manifest, nor ManifestPath should be specified. ManifestURL fmt.Stringer `structs:"manifestURL"` // WaitCondition, if not empty, makes Apply() perform "kubectl wait --for=<value>" on the resource. Namespace fmt.Stringer `structs:"namespace"` // OpaqueManifest is an alternative to Manifest for a resource to // apply whose content should not be exposed in a serialized plan. // If this is provided, then there is no need to provide // ManifestPath, but Filename should be provided in order to name // the remote manifest file. OpaqueManifest []byte `structs:"-" plan:"hide"` // ManifestPath is the path to the manifest to apply. // If this is provided, then there is no need to provide Manifest. // For example, waiting for "condition=established" is required after creating a CRD - see issue #530. WaitCondition string `structs:"afterApplyWaitsFor"` // contains filtered or unexported fields }
KubectlApply is a resource applying the provided manifest. It doesn't realise any state, Apply will always apply the manifest.
func (*KubectlApply) QueryState ¶
QueryState implements plan.Resource.
func (*KubectlApply) State ¶
func (ka *KubectlApply) State() plan.State
State implements plan.Resource.
type KubectlWait ¶
type KubectlWait struct { // Namespace specifies the namespace in which to search for the object being waited on WaitNamespace string `structs:"namespace"` // WaitType specifies the object type to wait for WaitType string `structs:"typeWaitedFor"` // WaitSelector, if not empty, specifies which instances of the type to wait for WaitSelector string `structs:"itemsWaitedFor"` // WaitCondition specifies the condition to wait for WaitCondition string `structs:"waitFor"` // WaitTimeout, if specified, indicates how long to wait for the WaitCondition to become true before failing (default 30s) WaitTimeout string `structs:"waitTimeout"` // contains filtered or unexported fields }
KubectlWait waits for an object to reach a required state
func (*KubectlWait) QueryState ¶
QueryState implements plan.Resource.
func (*KubectlWait) State ¶
func (kw *KubectlWait) State() plan.State
State implements plan.Resource.
type OS ¶
type OS struct { // Name is the OS name, eg. 'centos' or 'debian'. On systemd OSes, this is the ID // field of /etc/os-release. See: // https://www.freedesktop.org/software/systemd/man/os-release.html Name string `structs:"Name"` // Version the OS version. On systemd OSes, this is the VERSION_ID field of // /etc/os-release. See: // https://www.freedesktop.org/software/systemd/man/os-release.html Version string `structs:"Version"` MachineID string `structs:"MachineID"` SystemUUID string `structs:"SystemUUID"` // contains filtered or unexported fields }
OS is a set of OS properties.
func (*OS) GetSELinuxStatus ¶
func (p *OS) GetSELinuxStatus() (SELinuxStatus, SELinuxMode, error)
func (*OS) IsOSInContainerVM ¶
func (*OS) QueryState ¶
QueryState implements plan.Resource.
type RPM ¶
type RPM struct { Name string `structs:"name"` // Version is optional Version string `structs:"version,omitempty"` Release string `structs:"release,omitempty"` DisableExcludes string `structs:"disableExcludes,omitempty"` }
RPM represents an RPM package.
It isn't legal to provide a Release if no Version is specified. TODO: What about epoch?
func (*RPM) QueryState ¶
QueryState implements plan.Resource.
type ReadFileCmdFunc ¶
type Run ¶
type Run struct { Script fmt.Stringer `structs:"script"` UndoScript fmt.Stringer `structs:"undoScript,omitempty"` UndoResource plan.Resource `structs:"undoResource,omitempty"` Output *string // for later resources to use // contains filtered or unexported fields }
Run is a resource running a script (which can be just a single command). Run doesn't realise any state, Apply will always run the given script.
func (*Run) QueryState ¶
QueryState implements plan.Resource.
type RunScript ¶
type RunScript struct { Path string `structs:"path"` Args interface{} `structs:"args"` // contains filtered or unexported fields }
RunScript is a resource running the script available at the provided path. Run doesn't realise any state, Apply will always run the given script.
func (*RunScript) QueryState ¶
QueryState implements plan.Resource.
type SELinuxMode ¶
type SELinuxMode int
const ( SELinuxModeUnknown SELinuxMode = iota SELinuxEnforcing SELinuxPermissive SELinuxDisabled )
func (SELinuxMode) IsDisabled ¶
func (m SELinuxMode) IsDisabled() bool
func (SELinuxMode) IsEnforcing ¶
func (m SELinuxMode) IsEnforcing() bool
func (SELinuxMode) IsPermissive ¶
func (m SELinuxMode) IsPermissive() bool
func (SELinuxMode) IsUnknown ¶
func (m SELinuxMode) IsUnknown() bool
type SELinuxStatus ¶
type SELinuxStatus int
const ( SELinuxUnknown SELinuxStatus = iota SELinuxNotInstalled SELinuxInstalled )
func (SELinuxStatus) IsInstalled ¶
func (s SELinuxStatus) IsInstalled() bool
func (SELinuxStatus) IsNotInstalled ¶
func (s SELinuxStatus) IsNotInstalled() bool
func (SELinuxStatus) IsUnknown ¶
func (s SELinuxStatus) IsUnknown() bool
type Service ¶
type Service struct { // Name of the systemd unit. Name string `structs:"name"` // Status is the desired service status. Only "active" or "inactive" are valid // input. Status string `structs:"status"` // Whether the service is enabled (systemctl enable) or not. Enabled bool `structs:"enabled"` }
Service represents a systemd service.
func (*Service) QueryState ¶
QueryState implements plan.Resource.