ConfigGroup class
ConfigGroup creates a set of Kubernetes resources from Kubernetes YAML text. The YAML text may be supplied using any of the following methods:
- Using a filename or a list of filenames:
- Using a file pattern or a list of file patterns:
- Using a literal string containing YAML, or a list of such strings:
- Any combination of files, patterns, or YAML strings:
Dependency ordering
Sometimes resources must be applied in a specific order. For example, a namespace resource must be created before any namespaced resources, or a Custom Resource Definition (CRD) must be pre-installed.
Pulumi uses heuristics to determine which order to apply and delete objects within the ConfigGroup. Pulumi also
waits for each object to be fully reconciled, unless skipAwait is enabled.
Explicit Dependency Ordering
Pulumi supports the config.kubernetes.io/depends-on annotation to declare an explicit dependency on a given resource.
The annotation accepts a list of resource references, delimited by commas.
Note that references to resources outside the ConfigGroup aren't supported.
Resource reference
A resource reference is a string that uniquely identifies a resource.
It consists of the group, kind, name, and optionally the namespace, delimited by forward slashes.
| Resource Scope | Format |
|---|---|
| namespace-scoped | <group>/namespaces/<namespace>/<kind>/<name> |
| cluster-scoped | <group>/<kind>/<name> |
For resources in the “core” group, the empty string is used instead (for example: /namespaces/test/Pod/pod-a).
Ordering across ConfigGroups
The dependsOn resource option creates a list of explicit dependencies between Pulumi resources.
Use it on another resource to make it dependent on the ConfigGroup and to wait for the resources within
the group to be deployed.
A best practice is to deploy each application using its own ConfigGroup, especially when that application installs custom resource definitions.
{{% examples %}}
Example Usage
{{% example %}}
Local File(s)
name: example
runtime: yaml
resources:
example:
type: kubernetes:yaml/v2:ConfigGroup
properties:
files:
- ./manifest.yaml
import * as pulumi from "@pulumi/pulumi";
import * as k8s from "@pulumi/kubernetes";
const example = new k8s.yaml.v2.ConfigGroup("example", {
files: ["./manifest.yaml"],
});
import pulumi
from pulumi_kubernetes.yaml.v2 import ConfigGroup
example = ConfigGroup(
"example",
files=["./manifest.yaml"]
)
using Pulumi;
using Pulumi.Kubernetes.Types.Inputs.Yaml.V2;
using Pulumi.Kubernetes.Yaml.V2;
using System.Collections.Generic;
return await Deployment.RunAsync(() =>
{
var example = new ConfigGroup("example", new ConfigGroupArgs
{
Files = new[] { "./manifest.yaml" }
});
});
package main
import (
yamlv2 "github.com/pulumi/pulumi-kubernetes/sdk/v4/go/kubernetes/yaml/v2"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := yamlv2.NewConfigGroup(ctx, "example", &yamlv2.ConfigGroupArgs{
Files: pulumi.ToStringArray([]string{"manifest.yaml"}),
})
if err != nil {
return err
}
return nil
})
}
package myproject;
import com.pulumi.Pulumi;
import com.pulumi.kubernetes.yaml.v2.ConfigGroup;
import com.pulumi.kubernetes.yaml.v2.ConfigGroupArgs;
public class App {
public static void main(String[] args) {
Pulumi.run(ctx -> {
var example = new ConfigGroup("example", ConfigGroupArgs.builder()
.files("./manifest.yaml")
.build());
});
}
}
{{% /example %}}
Local File Pattern
name: example
runtime: yaml
resources:
example:
type: kubernetes:yaml/v2:ConfigGroup
properties:
files:
- ./manifests/*.yaml
import * as pulumi from "@pulumi/pulumi";
import * as k8s from "@pulumi/kubernetes";
const example = new k8s.yaml.v2.ConfigGroup("example", {
files: ["./manifests/*.yaml"],
});
import pulumi
from pulumi_kubernetes.yaml.v2 import ConfigGroup
example = ConfigGroup(
"example",
files=["./manifests/*.yaml"]
)
using Pulumi;
using Pulumi.Kubernetes.Types.Inputs.Yaml.V2;
using Pulumi.Kubernetes.Yaml.V2;
using System.Collections.Generic;
return await Deployment.RunAsync(() =>
{
var example = new ConfigGroup("example", new ConfigGroupArgs
{
Files = new[] { "./manifests/*.yaml" }
});
});
package main
import (
yamlv2 "github.com/pulumi/pulumi-kubernetes/sdk/v4/go/kubernetes/yaml/v2"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := yamlv2.NewConfigGroup(ctx, "example", &yamlv2.ConfigGroupArgs{
Files: pulumi.ToStringArray([]string{"./manifests/*.yaml"}),
})
if err != nil {
return err
}
return nil
})
}
package myproject;
import com.pulumi.Pulumi;
import com.pulumi.kubernetes.yaml.v2.ConfigGroup;
import com.pulumi.kubernetes.yaml.v2.ConfigGroupArgs;
public class App {
public static void main(String[] args) {
Pulumi.run(ctx -> {
var example = new ConfigGroup("example", ConfigGroupArgs.builder()
.files("./manifests/*.yaml")
.build());
});
}
}
{{% /example %}} {{% example %}}
Literal YAML String
name: example
runtime: yaml
resources:
example:
type: kubernetes:yaml/v2:ConfigGroup
properties:
yaml: |
apiVersion: v1
kind: ConfigMap
metadata:
name: my-map
import * as pulumi from "@pulumi/pulumi";
import * as k8s from "@pulumi/kubernetes";
const example = new k8s.yaml.v2.ConfigGroup("example", {
yaml: `
apiVersion: v1
kind: ConfigMap
metadata:
name: my-map
`
});
import pulumi
from pulumi_kubernetes.yaml.v2 import ConfigGroup
example = ConfigGroup(
"example",
yaml="""
apiVersion: v1
kind: ConfigMap
metadata:
name: my-map
"""
)
using Pulumi;
using Pulumi.Kubernetes.Types.Inputs.Yaml.V2;
using Pulumi.Kubernetes.Yaml.V2;
using System.Collections.Generic;
return await Deployment.RunAsync(() =>
{
var example = new ConfigGroup("example", new ConfigGroupArgs
{
Yaml = @"
apiVersion: v1
kind: ConfigMap
metadata:
name: my-map
"
});
});
package main
import (
yamlv2 "github.com/pulumi/pulumi-kubernetes/sdk/v4/go/kubernetes/yaml/v2"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := yamlv2.NewConfigGroup(ctx, "example", &yamlv2.ConfigGroupArgs{
Yaml: pulumi.StringPtr(`
apiVersion: v1
kind: ConfigMap
metadata:
name: my-map
`),
})
if err != nil {
return err
}
return nil
})
}
package myproject;
import com.pulumi.Pulumi;
import com.pulumi.kubernetes.yaml.v2.ConfigGroup;
import com.pulumi.kubernetes.yaml.v2.ConfigGroupArgs;
public class App {
public static void main(String[] args) {
Pulumi.run(ctx -> {
var example = new ConfigGroup("example", ConfigGroupArgs.builder()
.yaml("""
apiVersion: v1
kind: ConfigMap
metadata:
name: my-map
"""
)
.build());
});
}
}
{{% /example %}} {{% example %}}
Literal Object
name: example
runtime: yaml
resources:
example:
type: kubernetes:yaml/v2:ConfigGroup
properties:
objs:
- apiVersion: v1
kind: ConfigMap
metadata:
name: my-map
import * as pulumi from "@pulumi/pulumi";
import * as k8s from "@pulumi/kubernetes";
const example = new k8s.yaml.v2.ConfigGroup("example", {
objs: [
{
apiVersion: "v1",
kind: "ConfigMap",
metadata: {
name: "my-map"
}
}
]
});
import pulumi
from pulumi_kubernetes.yaml.v2 import ConfigGroup
example = ConfigGroup(
"example",
objs=[
{
"apiVersion": "v1",
"kind": "ConfigMap",
"metadata": {
"name": "my-map",
},
}
]
)
using Pulumi;
using Pulumi.Kubernetes.Types.Inputs.Yaml.V2;
using Pulumi.Kubernetes.Yaml.V2;
using System.Collections.Generic;
return await Deployment.RunAsync(() =>
{
var example = new ConfigGroup("example", new ConfigGroupArgs
{
Objs = new[]
{
new Dictionary<string, object>
{
["apiVersion"] = "v1",
["kind"] = "ConfigMap",
["metadata"] = new Dictionary<string, object>
{
["name"] = "my-map",
},
},
},
});
});
package main
import (
yamlv2 "github.com/pulumi/pulumi-kubernetes/sdk/v4/go/kubernetes/yaml/v2"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := yamlv2.NewConfigGroup(ctx, "example", &yamlv2.ConfigGroupArgs{
Objs: pulumi.Array{
pulumi.Map{
"apiVersion": pulumi.String("v1"),
"kind": pulumi.String("ConfigMap"),
"metadata": pulumi.Map{
"name": pulumi.String("my-map"),
},
},
},
})
if err != nil {
return err
}
return nil
})
}
package myproject;
import java.util.Map;
import com.pulumi.Pulumi;
import com.pulumi.kubernetes.yaml.v2.ConfigGroup;
import com.pulumi.kubernetes.yaml.v2.ConfigGroupArgs;
public class App {
public static void main(String[] args) {
Pulumi.run(ctx -> {
var example = new ConfigGroup("example", ConfigGroupArgs.builder()
.objs(Map.ofEntries(
Map.entry("apiVersion", "v1"),
Map.entry("kind", "ConfigMap"),
Map.entry("metadata", Map.ofEntries(
Map.entry("name", "my-map")
))
))
.build());
});
}
}
{{% /example %}} {% /examples %}}
Constructors
- ConfigGroup(String name, {ConfigGroupArgs? args, ComponentResourceOptions? options})
-
Creates a new ConfigGroup.
nameThe Pulumi resource name.argsArguments used to configure this ConfigGroup. The set of arguments for ConfigGroup.optionsResource options controlling this resource's behavior.
Properties
-
childResources
→ Set<
Resource> -
finalinherited
-
completionSources
↔ Map<
String, IOutputCompletionSource> -
latefinalinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- isCustom → bool
-
Returns whether this resource is provider-managed.
no setterinherited
- isProtected → bool
-
Returns whether this resource is protected from deletion.
no setterinherited
- isRemote → bool
-
Whether this resource is registered as remote.
no setterinherited
-
resources
↔ Output<
List< Map< ?>String, dynamic> > -
Resources created by the ConfigGroup.
latefinal
-
resourceTransforms
→ List<
ResourceTransform> -
Inherited/explicit async transforms.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
transformations
→ List<
ResourceTransformation> -
Inherited/explicit legacy transformations.
no setterinherited
-
urn
↔ Output<
String> -
latefinalinherited
Methods
-
failOutputs(
Object error) → void -
Completes all output properties with
error.inherited -
failUrn(
Object error) → void -
Completes this resource URN with an error when registration fails.
inherited
-
getProvider(
String moduleMember) → ProviderResource? -
Returns provider for
moduleMember's package, if configured.inherited -
getResourceName(
) → String -
Returns this resource's logical name.
inherited
-
getResourceType(
) → String -
Returns this resource's Pulumi type token.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
registerOutput<
T> (String propertyName, {Object? decoder(Object?)?, bool isSecret = false}) → Output< T> -
Registers a dynamic output property for this resource.
inherited
-
registerOutputs(
[Map< String, dynamic> ? outputs]) → void -
Registers component outputs with the engine.
inherited
-
registerOutputsAsync(
Future< Map< outputs) → Future<String, dynamic> >void> -
Async variant of
registerOutputs.inherited -
registerOutputsOutput(
Output< Map< outputs) → voidString, dynamic> > -
Registers an already-computed output map.
inherited
-
resolveOutputs(
Struct outputs) → void -
Resolves all output properties from a monitor response payload.
inherited
-
resolveUrn(
String value) → void -
Resolves this resource's URN once assigned by the engine.
inherited
-
serializeProperties(
Map< String, dynamic> properties) → Future<Struct> -
Serializes resource properties for RPC transmission.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited