provider

package
v4.0.0-...-a162c42 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 6, 2024 License: Apache-2.0 Imports: 96 Imported by: 2

README

Provider Package

This package implements the Kubernetes provider. It provides Pulumi custom resources representing Kubernetes kinds and Pulumi component resources for working with Kubernetes manifests and with tools such as Helm and Kustomize. It also provides some invokes to support various "overlay" resources that are implemented at the SDK level.

Custom Resources

Component Resources

Each component is implemented via a sub-provider as defined by the resource.ResourceProvider interface.

Steps to add a new component provider:

  1. Create a new package for the implementation, e.g. provider/pkg/provider/helm/v4.
  2. Add an alias to the package for each SDK in provider/pkg/gen/schema.go. You want your package name to be idiomatic to the SDK.
  3. Add an exclusion to resourcesToFilterFromTemplate in provider/cmd/provider-gen-kubernetes/main.go.
  4. Define a resource schema in provider/pkg/gen/overlays.go. The term overlay here means "not a Kubernetes kind".
  5. Create a documentation file for the resource in provider/pkg/gen/examples/overlays/kustomizeDirectory.md and link from overlays.go.
  6. Create an implementation of resource.ResourceProvider into your new implementation package.
  7. Register the implementation into resourceProviders in provider/pkg/provider/provider_construct.go.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Serve

func Serve(providerName, version string, pulumiSchema, terraformMapping []byte)

Serve launches the gRPC server for the Pulumi Kubernetes resource provider.

Types

type HelmChartOpts

type HelmChartOpts struct {
	HelmFetchOpts `json:"fetch_opts,omitempty"`

	APIVersions              []string       `json:"api_versions,omitempty"`
	Chart                    string         `json:"chart,omitempty"`
	IncludeTestHookResources bool           `json:"include_test_hook_resources,omitempty"`
	SkipCRDRendering         bool           `json:"skip_crd_rendering,omitempty"`
	Namespace                string         `json:"namespace,omitempty"`
	Path                     string         `json:"path,omitempty"`
	ReleaseName              string         `json:"release_name,omitempty"`
	Repo                     string         `json:"repo,omitempty"`
	Values                   map[string]any `json:"values,omitempty"`
	Version                  string         `json:"version,omitempty"`
	HelmChartDebug           bool           `json:"helm_chart_debug,omitempty"`
	HelmRegistryConfig       string         `json:"helm_registry_config,omitempty"`
	KubeVersion              string         `json:"kube_version,omitempty"`
}

type HelmFetchOpts

type HelmFetchOpts struct {
	CAFile      string `json:"ca_file,omitempty"`
	CertFile    string `json:"cert_file,omitempty"`
	Destination string `json:"destination,omitempty"`
	Devel       bool   `json:"devel,omitempty"`
	Home        string `json:"home,omitempty"`
	KeyFile     string `json:"key_file,omitempty"`
	Keyring     string `json:"keyring,omitempty"`
	Password    string `json:"password,omitempty"`
	Prov        bool   `json:"prov,omitempty"`
	Repo        string `json:"repo,omitempty"`
	UntarDir    string `json:"untar_dir,omitempty"`
	Username    string `json:"username,omitempty"`
	Verify      bool   `json:"verify,omitempty"`
	Version     string `json:"version,omitempty"`
}

type HelmReleaseSettings

type HelmReleaseSettings struct {
	// The backend storage driver for Helm. Values are: configmap, secret, memory, sql.
	Driver *string `json:"driver"`
	// The path to the helm plugins directory.
	PluginsPath *string `json:"pluginsPath"`
	// The path to the registry config file.
	RegistryConfigPath *string `json:"registryConfigPath"`
	// The path to the directory containing cached repository indexes.
	RepositoryCache *string `json:"repositoryCache"`
	// The path to the file containing repository names and URLs.
	RepositoryConfigPath *string `json:"repositoryConfigPath"`
}

Options to configure the Helm Release resource.

type KubeClientSettings

type KubeClientSettings struct {
	// Maximum burst for throttle. Default value is 120.
	Burst *int `json:"burst"`
	// Maximum queries per second (QPS) to the API server from this client. Default value is 50.
	QPS *float64 `json:"qps"`
	// Maximum time in seconds to wait before cancelling a HTTP request to the Kubernetes server. Default value is 32.
	Timeout *int `json:"timeout"`
}

Options for tuning the Kubernetes client used by a Provider.

type KubeConfig

type KubeConfig struct {
	// contains filtered or unexported fields
}

KubeConfig is a RESTClientGetter interface implementation

func NewKubeConfig

func NewKubeConfig(config *rest.Config, clientConfig clientcmd.ClientConfig) *KubeConfig

func (*KubeConfig) ToDiscoveryClient

func (k *KubeConfig) ToDiscoveryClient() (discovery.CachedDiscoveryInterface, error)

ToDiscoveryClient implemented interface method

func (*KubeConfig) ToRESTConfig

func (k *KubeConfig) ToRESTConfig() (*rest.Config, error)

ToRESTConfig implemented interface method

func (*KubeConfig) ToRESTMapper

func (k *KubeConfig) ToRESTMapper() (meta.RESTMapper, error)

ToRESTMapper implemented interface method

func (*KubeConfig) ToRawKubeConfigLoader

func (k *KubeConfig) ToRawKubeConfigLoader() clientcmd.ClientConfig

ToRawKubeConfigLoader implemented interface method

type Release

type Release struct {
	// When combinging Values with mergeMaps, allow Nulls
	AllowNullValues bool `json:"allowNullValues,omitempty"`
	// If set, installation process purges chart on fail. The wait flag will be set automatically if atomic is used
	Atomic bool `json:"atomic,omitempty"`
	// Chart name to be installed. A path may be used.
	Chart string `json:"chart,omitempty"`
	// Allow deletion of new resources created in this upgrade when upgrade fails
	CleanupOnFail bool `json:"cleanupOnFail,omitempty"`
	// Create the namespace if it does not exist
	CreateNamespace bool `json:"createNamespace,omitempty"`
	// Run helm dependency update before installing the chart
	DependencyUpdate bool `json:"dependencyUpdate,omitempty"`
	// Add a custom description
	Description string `json:"description,omitempty"`
	// Use chart development versions, too. Equivalent to version '>0.0.0-0'. If `version` is set, this is ignored
	Devel bool `json:"devel,omitempty"`
	// Prevent CRD hooks from running, but run other hooks.  See helm install --no-crd-hook
	DisableCRDHooks bool `json:"disableCRDHooks,omitempty"`
	// If set, the installation process will not validate rendered templates against the Kubernetes OpenAPI Schema
	DisableOpenapiValidation bool `json:"disableOpenapiValidation,omitempty"`
	// Prevent hooks from running.
	DisableWebhooks bool `json:"disableWebhooks,omitempty"`
	// Force resource update through delete/recreate if needed.
	ForceUpdate bool `json:"forceUpdate,omitempty"`
	// Location of public keys used for verification. Used only if `verify` is true
	Keyring string `json:"keyring,omitempty"`
	// Run helm lint when planning
	Lint bool `json:"lint,omitempty"`
	// Limit the maximum number of revisions saved per release. Use 0 for no limit
	MaxHistory *int `json:"maxHistory,omitempty"`
	// Release name.
	Name string `json:"name,omitempty"`
	// Namespace to install the release into.
	Namespace string `json:"namespace,omitempty"`
	// Postrender command to run.
	Postrender string `json:"postrender,omitempty"`
	// Perform pods restart during upgrade/rollback
	RecreatePods bool `json:"recreatePods,omitempty"`
	// If set, render subchart notes along with the parent
	RenderSubchartNotes bool `json:"renderSubchartNotes,omitempty"`
	// Re-use the given name, even if that name is already used. This is unsafe in production
	Replace bool `json:"replace,omitempty"`
	// Specification defining the Helm chart repository to use.
	RepositoryOpts *RepositoryOpts `json:"repositoryOpts,omitempty"`
	// When upgrading, reset the values to the ones built into the chart
	ResetValues bool `json:"resetValues,omitempty"`
	// When upgrading, reuse the last release's values and merge in any overrides. If 'reset_values' is specified, this is ignored
	ReuseValues bool `json:"reuseValues,omitempty"`
	// Custom values to be merged with items loaded from values.
	Values map[string]any `json:"values,omitempty"`
	// If set, no CRDs will be installed. By default, CRDs are installed if not already present
	SkipCrds bool `json:"skipCrds,omitempty"`
	// Time in seconds to wait for any individual kubernetes operation.
	Timeout int `json:"timeout,omitempty"`
	// Verify the package before installing it.
	Verify bool `json:"verify,omitempty"`
	// Specify the exact chart version to install. If this is not specified, the latest version is installed.
	Version string `json:"version,omitempty"`
	// By default, the provider waits until all resources are in a ready state before marking the release as successful. Setting this to true will skip such await logic.
	SkipAwait bool `json:"skipAwait,omitempty"`
	// Will wait until all Jobs have been completed before marking the release as successful. This is ignored if `skipAwait` is enabled.
	WaitForJobs bool `json:"waitForJobs,omitempty"`
	// The rendered manifests.
	// Manifest map[string]interface{} `json:"manifest,omitempty"`
	// Names of resources created by the release grouped by "kind/version".
	ResourceNames map[string][]string `json:"resourceNames,omitempty"`
	// Status of the deployed release.
	Status *ReleaseStatus `json:"status,omitempty"`
}

Release should explicitly track the shape of helm.sh/v3:Release resource

type ReleaseSpec

type ReleaseSpec struct {
}

type ReleaseStatus

type ReleaseStatus struct {
	// The version number of the application being deployed.
	AppVersion string `json:"appVersion,omitempty"`
	// The name of the chart.
	Chart string `json:"chart,omitempty"`
	// Name is the name of the release.
	Name string `json:"name,omitempty"`
	// Namespace is the kubernetes namespace of the release.
	Namespace string `json:"namespace,omitempty"`
	// Version is an int32 which represents the version of the release.
	Revision *int `json:"revision,omitempty"`
	// Status of the release.
	Status string `json:"status,omitempty"`
	// A SemVer 2 conformant version string of the chart.
	Version string `json:"version,omitempty"`
}

type RepositoryOpts

type RepositoryOpts struct {
	// Repository where to locate the requested chart. If is a URL the chart is installed without installing the repository.
	Repo string `json:"repo,omitempty"`
	// The Repositories CA File
	CAFile string `json:"caFile,omitempty"`
	// The repositories cert file
	CertFile string `json:"certFile,omitempty"`
	// The repositories cert key file
	KeyFile string `json:"keyFile,omitempty"`
	// Password for HTTP basic authentication
	Password string `json:"password,omitempty"`
	// Username for HTTP basic authentication
	Username string `json:"username,omitempty"`
}

Specification defining the Helm chart repository to use.

Directories

Path Synopsis
helm
v4
kustomize
v2
yaml
v2

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL