provider

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2025 License: Apache-2.0 Imports: 103 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsNamespacedKind

func IsNamespacedKind(gvk schema.GroupVersionKind, disco discovery.DiscoveryInterface, objs ...unstructured.Unstructured) (bool, error)

IsNamespacedKind checks if a given GVK is namespace-scoped. Known GVKs are compared against a static lookup table. For GVKs not in the table, look at the given objects for a matching CRD. Finally, attempt to look up the GVK from the API server. If the GVK cannot be found, a NoNamespaceInfoErr is returned. --------Customized Method--------------No Client Set required----------------

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 KubeProvider

type KubeProvider struct {
	pulumirpc.UnimplementedResourceProviderServer
	// contains filtered or unexported fields
}

func MakeKubeProvider

func MakeKubeProvider(
	host host.HostClient, name, version string, pulumiSchema, terraformMapping []byte,
) (*KubeProvider, error)

func (*KubeProvider) Attach

Attach sends the engine address to an already running plugin.

func (*KubeProvider) Call

Call dynamically executes a method in the provider associated with a component resource.

func (*KubeProvider) Cancel

Cancel signals the provider to gracefully shut down and abort any ongoing resource operations. Operations aborted in this way will return an error (e.g., `Update` and `Create` will either a creation error or an initialization error). Since Cancel is advisory and non-blocking, it is up to the host to decide how long to wait after Cancel is called before (e.g.) hard-closing any gRPC connection.

func (*KubeProvider) Check

Check validates that the given property bag is valid for a resource of the given type and returns the inputs that should be passed to successive calls to Diff, Create, or Update for this resource. As a rule, the provider inputs returned by a call to Check should preserve the original representation of the properties as present in the program inputs. Though this rule is not required for correctness, violations thereof can negatively impact the end-user experience, as the provider inputs are using for detecting and rendering diffs.

func (*KubeProvider) CheckConfig

CheckConfig validates the configuration for this provider.

func (*KubeProvider) Configure

Configure configures the resource provider with "globals" that control its behavior.

func (*KubeProvider) Construct

Construct creates a new instance of the provided component resource and returns its state.

func (*KubeProvider) Create

Create allocates a new instance of the provided resource and returns its unique ID. (The input ID must be blank.) If this call fails, the resource must not have been created (i.e., it is "transactional").

func (*KubeProvider) DecodeYaml

func (k *KubeProvider) DecodeYaml(text string, defaultNamespace string) ([]interface{}, error)

func (*KubeProvider) Delete

Delete tears down an existing resource with the given ID. If it fails, the resource is assumed to still exist.

func (*KubeProvider) Diff

Diff checks what impacts a hypothetical update will have on the resource's properties.

func (*KubeProvider) DiffConfig

func (k *KubeProvider) DiffConfig(_ context.Context, req *pulumirpc.DiffRequest) (resp *pulumirpc.DiffResponse, err error)

DiffConfig diffs the configuration for this provider.

func (*KubeProvider) GetMapping

GetMapping fetches the mapping for this resource provider, if any. A provider should return an empty response (not an error) if it doesn't have a mapping for the given key.

func (*KubeProvider) GetPluginInfo

GetPluginInfo returns generic information about this plugin, like its version.

func (*KubeProvider) GetSchema

GetSchema returns the JSON-encoded schema for this provider's package.

func (*KubeProvider) HelmTemplate

func (k *KubeProvider) HelmTemplate(opts HelmChartOpts) (string, error)

func (*KubeProvider) Invoke

Invoke dynamically executes a built-in function in the provider.

func (*KubeProvider) Parameterize

Parameterize is called by the engine when the Kubernetes provider is used for CRDs.

func (*KubeProvider) Read

Read the current live state associated with a resource. Enough state must be included in the inputs to uniquely identify the resource; this is typically just the resource ID, but may also include some properties.

func (*KubeProvider) StreamInvoke

StreamInvoke dynamically executes a built-in function in the provider. The result is streamed back as a series of messages.

func (*KubeProvider) Update

Update updates an existing resource with new values. This client uses a Server-side Apply (SSA) patch by default, but also supports the older three-way JSON patch and the strategic merge patch as fallback options. See references [1], [2], [3].

nolint [1]: https://kubernetes.io/docs/tasks/run-application/update-api-object-kubectl-patch/#use-a-json-merge-patch-to-update-a-deployment [2]: https://kubernetes.io/docs/concepts/overview/object-management-kubectl/declarative-config/#how-apply-calculates-differences-and-merges-changes [3]: https://kubernetes.io/docs/reference/using-api/server-side-apply

type ParameterizedArgs

type ParameterizedArgs struct {
	PackageVersion   string
	CRDManifestPaths []string
}

ParameterizedArgs is the struct that holds the arguments for the Kubernetes Provider parameterization. Currently, this is only used for generating types from CRD manifests.

func (ParameterizedArgs) String

func (p ParameterizedArgs) String() string

String returns a string representation of the ParameterizedArgs. This is used for logging purposes.

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 it's 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.

Jump to

Keyboard shortcuts

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