harness.service.Kubernetes
Explore with Pulumi AI
Resource for creating a Kubernetes service. This resource uses the config-as-code API’s. When updating the name
or path
of this resource you should typically also set the create_before_destroy = true
lifecycle setting.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as harness from "@pulumi/harness";
const example = new harness.Application("example", {name: "example"});
const exampleKubernetes = new harness.service.Kubernetes("example", {
appId: example.id,
name: "k8s-svc",
helmVersion: "V3",
description: "Service for deploying Kubernetes manifests",
variables: [
{
name: "test",
value: "test_value",
type: "TEXT",
},
{
name: "test2",
value: "test_value2",
type: "TEXT",
},
],
});
import pulumi
import pulumi_harness as harness
example = harness.Application("example", name="example")
example_kubernetes = harness.service.Kubernetes("example",
app_id=example.id,
name="k8s-svc",
helm_version="V3",
description="Service for deploying Kubernetes manifests",
variables=[
{
"name": "test",
"value": "test_value",
"type": "TEXT",
},
{
"name": "test2",
"value": "test_value2",
"type": "TEXT",
},
])
package main
import (
"github.com/pulumi/pulumi-harness/sdk/go/harness"
"github.com/pulumi/pulumi-harness/sdk/go/harness/service"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
example, err := harness.NewApplication(ctx, "example", &harness.ApplicationArgs{
Name: pulumi.String("example"),
})
if err != nil {
return err
}
_, err = service.NewKubernetes(ctx, "example", &service.KubernetesArgs{
AppId: example.ID(),
Name: pulumi.String("k8s-svc"),
HelmVersion: pulumi.String("V3"),
Description: pulumi.String("Service for deploying Kubernetes manifests"),
Variables: service.KubernetesVariableArray{
&service.KubernetesVariableArgs{
Name: pulumi.String("test"),
Value: pulumi.String("test_value"),
Type: pulumi.String("TEXT"),
},
&service.KubernetesVariableArgs{
Name: pulumi.String("test2"),
Value: pulumi.String("test_value2"),
Type: pulumi.String("TEXT"),
},
},
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Harness = Pulumi.Harness;
return await Deployment.RunAsync(() =>
{
var example = new Harness.Application("example", new()
{
Name = "example",
});
var exampleKubernetes = new Harness.Service.Kubernetes("example", new()
{
AppId = example.Id,
Name = "k8s-svc",
HelmVersion = "V3",
Description = "Service for deploying Kubernetes manifests",
Variables = new[]
{
new Harness.Service.Inputs.KubernetesVariableArgs
{
Name = "test",
Value = "test_value",
Type = "TEXT",
},
new Harness.Service.Inputs.KubernetesVariableArgs
{
Name = "test2",
Value = "test_value2",
Type = "TEXT",
},
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.harness.Application;
import com.pulumi.harness.ApplicationArgs;
import com.pulumi.harness.service.Kubernetes;
import com.pulumi.harness.service.KubernetesArgs;
import com.pulumi.harness.service.inputs.KubernetesVariableArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var example = new Application("example", ApplicationArgs.builder()
.name("example")
.build());
var exampleKubernetes = new Kubernetes("exampleKubernetes", KubernetesArgs.builder()
.appId(example.id())
.name("k8s-svc")
.helmVersion("V3")
.description("Service for deploying Kubernetes manifests")
.variables(
KubernetesVariableArgs.builder()
.name("test")
.value("test_value")
.type("TEXT")
.build(),
KubernetesVariableArgs.builder()
.name("test2")
.value("test_value2")
.type("TEXT")
.build())
.build());
}
}
resources:
example:
type: harness:Application
properties:
name: example
exampleKubernetes:
type: harness:service:Kubernetes
name: example
properties:
appId: ${example.id}
name: k8s-svc
helmVersion: V3
description: Service for deploying Kubernetes manifests
variables:
- name: test
value: test_value
type: TEXT
- name: test2
value: test_value2
type: TEXT
Create Kubernetes Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new Kubernetes(name: string, args: KubernetesArgs, opts?: CustomResourceOptions);
@overload
def Kubernetes(resource_name: str,
args: KubernetesArgs,
opts: Optional[ResourceOptions] = None)
@overload
def Kubernetes(resource_name: str,
opts: Optional[ResourceOptions] = None,
app_id: Optional[str] = None,
description: Optional[str] = None,
helm_version: Optional[str] = None,
name: Optional[str] = None,
variables: Optional[Sequence[KubernetesVariableArgs]] = None)
func NewKubernetes(ctx *Context, name string, args KubernetesArgs, opts ...ResourceOption) (*Kubernetes, error)
public Kubernetes(string name, KubernetesArgs args, CustomResourceOptions? opts = null)
public Kubernetes(String name, KubernetesArgs args)
public Kubernetes(String name, KubernetesArgs args, CustomResourceOptions options)
type: harness:service:Kubernetes
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
Parameters
- name string
- The unique name of the resource.
- args KubernetesArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- args KubernetesArgs
- The arguments to resource properties.
- opts ResourceOptions
- Bag of options to control resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args KubernetesArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args KubernetesArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args KubernetesArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
Constructor example
The following reference example uses placeholder values for all input properties.
var harnessKubernetesResource = new Harness.Service.Kubernetes("harnessKubernetesResource", new()
{
AppId = "string",
Description = "string",
HelmVersion = "string",
Name = "string",
Variables = new[]
{
new Harness.Service.Inputs.KubernetesVariableArgs
{
Name = "string",
Type = "string",
Value = "string",
},
},
});
example, err := service.NewKubernetes(ctx, "harnessKubernetesResource", &service.KubernetesArgs{
AppId: pulumi.String("string"),
Description: pulumi.String("string"),
HelmVersion: pulumi.String("string"),
Name: pulumi.String("string"),
Variables: service.KubernetesVariableArray{
&service.KubernetesVariableArgs{
Name: pulumi.String("string"),
Type: pulumi.String("string"),
Value: pulumi.String("string"),
},
},
})
var harnessKubernetesResource = new Kubernetes("harnessKubernetesResource", KubernetesArgs.builder()
.appId("string")
.description("string")
.helmVersion("string")
.name("string")
.variables(KubernetesVariableArgs.builder()
.name("string")
.type("string")
.value("string")
.build())
.build());
harness_kubernetes_resource = harness.service.Kubernetes("harnessKubernetesResource",
app_id="string",
description="string",
helm_version="string",
name="string",
variables=[{
"name": "string",
"type": "string",
"value": "string",
}])
const harnessKubernetesResource = new harness.service.Kubernetes("harnessKubernetesResource", {
appId: "string",
description: "string",
helmVersion: "string",
name: "string",
variables: [{
name: "string",
type: "string",
value: "string",
}],
});
type: harness:service:Kubernetes
properties:
appId: string
description: string
helmVersion: string
name: string
variables:
- name: string
type: string
value: string
Kubernetes Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
The Kubernetes resource accepts the following input properties:
- App
Id string - The id of the application the service belongs to
- Description string
- Description of th service
- Helm
Version string - The version of Helm to use. Options are
V2
andV3
. Defaults to 'V2'. Only used whentype
isKUBERNETES
orHELM
. - Name string
- Name of the service
- Variables
List<Kubernetes
Variable> - Variables to be used in the service
- App
Id string - The id of the application the service belongs to
- Description string
- Description of th service
- Helm
Version string - The version of Helm to use. Options are
V2
andV3
. Defaults to 'V2'. Only used whentype
isKUBERNETES
orHELM
. - Name string
- Name of the service
- Variables
[]Kubernetes
Variable Args - Variables to be used in the service
- app
Id String - The id of the application the service belongs to
- description String
- Description of th service
- helm
Version String - The version of Helm to use. Options are
V2
andV3
. Defaults to 'V2'. Only used whentype
isKUBERNETES
orHELM
. - name String
- Name of the service
- variables
List<Kubernetes
Variable> - Variables to be used in the service
- app
Id string - The id of the application the service belongs to
- description string
- Description of th service
- helm
Version string - The version of Helm to use. Options are
V2
andV3
. Defaults to 'V2'. Only used whentype
isKUBERNETES
orHELM
. - name string
- Name of the service
- variables
Kubernetes
Variable[] - Variables to be used in the service
- app_
id str - The id of the application the service belongs to
- description str
- Description of th service
- helm_
version str - The version of Helm to use. Options are
V2
andV3
. Defaults to 'V2'. Only used whentype
isKUBERNETES
orHELM
. - name str
- Name of the service
- variables
Sequence[Kubernetes
Variable Args] - Variables to be used in the service
- app
Id String - The id of the application the service belongs to
- description String
- Description of th service
- helm
Version String - The version of Helm to use. Options are
V2
andV3
. Defaults to 'V2'. Only used whentype
isKUBERNETES
orHELM
. - name String
- Name of the service
- variables List<Property Map>
- Variables to be used in the service
Outputs
All input properties are implicitly available as output properties. Additionally, the Kubernetes resource produces the following output properties:
- Id string
- The provider-assigned unique ID for this managed resource.
- Id string
- The provider-assigned unique ID for this managed resource.
- id String
- The provider-assigned unique ID for this managed resource.
- id string
- The provider-assigned unique ID for this managed resource.
- id str
- The provider-assigned unique ID for this managed resource.
- id String
- The provider-assigned unique ID for this managed resource.
Look up Existing Kubernetes Resource
Get an existing Kubernetes resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.
public static get(name: string, id: Input<ID>, state?: KubernetesState, opts?: CustomResourceOptions): Kubernetes
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
app_id: Optional[str] = None,
description: Optional[str] = None,
helm_version: Optional[str] = None,
name: Optional[str] = None,
variables: Optional[Sequence[KubernetesVariableArgs]] = None) -> Kubernetes
func GetKubernetes(ctx *Context, name string, id IDInput, state *KubernetesState, opts ...ResourceOption) (*Kubernetes, error)
public static Kubernetes Get(string name, Input<string> id, KubernetesState? state, CustomResourceOptions? opts = null)
public static Kubernetes get(String name, Output<String> id, KubernetesState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- resource_name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- App
Id string - The id of the application the service belongs to
- Description string
- Description of th service
- Helm
Version string - The version of Helm to use. Options are
V2
andV3
. Defaults to 'V2'. Only used whentype
isKUBERNETES
orHELM
. - Name string
- Name of the service
- Variables
List<Kubernetes
Variable> - Variables to be used in the service
- App
Id string - The id of the application the service belongs to
- Description string
- Description of th service
- Helm
Version string - The version of Helm to use. Options are
V2
andV3
. Defaults to 'V2'. Only used whentype
isKUBERNETES
orHELM
. - Name string
- Name of the service
- Variables
[]Kubernetes
Variable Args - Variables to be used in the service
- app
Id String - The id of the application the service belongs to
- description String
- Description of th service
- helm
Version String - The version of Helm to use. Options are
V2
andV3
. Defaults to 'V2'. Only used whentype
isKUBERNETES
orHELM
. - name String
- Name of the service
- variables
List<Kubernetes
Variable> - Variables to be used in the service
- app
Id string - The id of the application the service belongs to
- description string
- Description of th service
- helm
Version string - The version of Helm to use. Options are
V2
andV3
. Defaults to 'V2'. Only used whentype
isKUBERNETES
orHELM
. - name string
- Name of the service
- variables
Kubernetes
Variable[] - Variables to be used in the service
- app_
id str - The id of the application the service belongs to
- description str
- Description of th service
- helm_
version str - The version of Helm to use. Options are
V2
andV3
. Defaults to 'V2'. Only used whentype
isKUBERNETES
orHELM
. - name str
- Name of the service
- variables
Sequence[Kubernetes
Variable Args] - Variables to be used in the service
- app
Id String - The id of the application the service belongs to
- description String
- Description of th service
- helm
Version String - The version of Helm to use. Options are
V2
andV3
. Defaults to 'V2'. Only used whentype
isKUBERNETES
orHELM
. - name String
- Name of the service
- variables List<Property Map>
- Variables to be used in the service
Supporting Types
KubernetesVariable, KubernetesVariableArgs
Import
Import using the Harness application id and service id
$ pulumi import harness:service/kubernetes:Kubernetes example <app_id>/<svc_id>
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- harness pulumi/pulumi-harness
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
harness
Terraform Provider.