KubernetesConnection

Stores information and configuration for the access to a Kubernetes cluster.

Example. Adds a new Connection that allows TeamCity to store and manage a Kubernetes Cluster using a Bearer Token

project {
// Other Project settings ...
features {
// Other Project Features ...
        kubernetesConnection {
id = "PROJECT_EXT_3"
name = "Connection"
apiServerUrl = "http://cluster.com"
caCertificate = "credentialsJSON:c77bc0a7-f461-4ca8-959b-ef5c8f6359b2"
namespace = "namespace"
authStrategy = token {
token = "credentialsJSON:fa92592e-ec16-4543-add0-1cdd4de87e5e"
}
}
}
}

Example. Adds a new Connection that allows TeamCity to store and manage a Kubernetes Cluster using a username and password

project {
// Other Project settings ...
features {
// Other Project Features ...
        kubernetesConnection {
id = "PROJECT_EXT_3"
name = "Connection"
apiServerUrl = "http://cluster.com"
caCertificate = "credentialsJSON:c77bc0a7-f461-4ca8-959b-ef5c8f6359b2"
namespace = "namespace"
authStrategy = usernameAndPassword {
username = "username"
password = "credentialsJSON:aaef5e7e-5a51-427c-b0ea-3af364cacedd"
}
}
}
}

Example. Adds a new Connection that allows TeamCity to store and manage a Kubernetes Cluster using the OpenID Connect (OIDC) protocol

project {
// Other Project settings ...
features {
// Other Project Features ...
        kubernetesConnection {
id = "PROJECT_EXT_3"
name = "Connection"
apiServerUrl = "http://cluster.com"
caCertificate = "credentialsJSON:c77bc0a7-f461-4ca8-959b-ef5c8f6359b2"
namespace = "namespace"
authStrategy = openId {
idpIssuerUrl = "idpurl"
clientId = "clientId"
clientSecret = "credentialsJSON:612f3414-2b25-41ec-9520-12c9669d1f85"
refreshToken = "credentialsJSON:0bb3f85a-7ff4-474e-9c14-8da47099595a"
}
}
}
}

Example. Adds a new Connection that allows TeamCity to store and manage a Kubernetes Cluster using a Client Certificate and Key

project {
// Other Project settings ...
features {
// Other Project Features ...
        kubernetesConnection {
id = "PROJECT_EXT_3"
name = "Connection"
apiServerUrl = "http://cluster.com"
caCertificate = "credentialsJSON:c77bc0a7-f461-4ca8-959b-ef5c8f6359b2"
namespace = "namespace"
authStrategy = clientCertificateAndKey {
clientKey = "credentialsJSON:43b46ece-15a7-4621-a271-7d2b33e9e356"
clientCertificate = "credentialsJSON:87a6537c-cb8f-4684-b44d-e0ea183e9fa1"
}
}
}
}

Example. Adds a new Connection that allows TeamCity to store and manage a Kubernetes Cluster in AWS EKS using an access key and secret key

project {
// Other Project settings ...
features {
// Other Project Features ...
        kubernetesConnection {
id = "PROJECT_EXT_3"
name = "Connection"
apiServerUrl = "http://cluster.com"
caCertificate = "credentialsJSON:c77bc0a7-f461-4ca8-959b-ef5c8f6359b2"
namespace = "namespace"
authStrategy = eks {
accessId = "accessId"
secretKey = "credentialsJSON:3507800f-ae64-49f1-bbb5-0a4deec5c7b3"
clusterName = "cluster-name"
}
}
}
}

Example. Adds a new Connection that allows TeamCity to store and manage a Kubernetes Cluster.

project {
// Other Project settings ...
features {
// Other Project Features ...
        kubernetesConnection {
id = "PROJECT_EXT_3"
name = "Connection"
apiServerUrl = "http://cluster.com"
caCertificate = "credentialsJSON:c77bc0a7-f461-4ca8-959b-ef5c8f6359b2"
namespace = "namespace"
authStrategy = unauthorized()
}
}
}

See also

Constructors

Link copied to clipboard
constructor(init: KubernetesConnection.() -> Unit)
constructor()

Types

Properties

Link copied to clipboard

Target Kubernetes API server URL

Link copied to clipboard

The way how to obtain credentials

Link copied to clipboard

The CA Certificate to connect to the cluster. Leave empty to skip TLS verification (insecure option)

Link copied to clipboard
var id: String?

Project feature id, if not specified will be generated

Link copied to clipboard
var name: String?

Kubernetes connection display name

Link copied to clipboard

The Kubernetes namespace to use. Leave empty to use the default namespace.

Link copied to clipboard
Link copied to clipboard

Project feature type

Functions

Link copied to clipboard
fun booleanParameter(customName: String? = null, trueValue: String? = "true", falseValue: String? = "false"): DelegateProvider<Boolean?>
Link copied to clipboard
fun clear()
Link copied to clipboard

Connecting to a Kubernetes cluster using a client certificate and key

Link copied to clipboard
fun <T : CompoundParam<T>> compoundParameter(customName: String? = null): DelegateProvider<T>
Link copied to clipboard
fun <T : Parametrized> copyParamsTo(target: T): T

Copies parameters of this object to the specified target

Link copied to clipboard

Creates an instance of this project feature via reflection using a no argument constructor, used during copying. Throws an error if this class doesn't have a default constructor. Subclasses can override it to create an instance without using a default constructor.

Link copied to clipboard
fun doubleParameter(customName: String? = null): DelegateProvider<Double>
Link copied to clipboard

Connecting to an AWS EKS (Elastic Kubernetes Service)

Link copied to clipboard
fun <E : Enum<E>> enumParameter(customName: String? = null, mapping: Map<E, String?>? = null): DelegateProvider<E>
Link copied to clipboard
fun findRawParam(paramName: String): Parameter?
Link copied to clipboard
fun hasParam(paramName: String): Boolean
Link copied to clipboard
fun intParameter(customName: String? = null): DelegateProvider<Int>
Link copied to clipboard

Connecting to a Kubernetes cluster using the OpenID Connect (OIDC) protocol

Link copied to clipboard
fun param(name: String, value: String)

Adds parameter with specified name and value

Link copied to clipboard
fun removeRawParam(paramName: String)
Link copied to clipboard

Uses the Kubernetes credentials provided in the TeamCity Instance. Should be available under /var/run/secrets/kubernetes.io/serviceaccount/token

Link copied to clipboard
open fun stringParameter(customName: String? = null): DelegateProvider<String>
Link copied to clipboard

Connecting to a Kubernetes cluster using a Bearer Token

Link copied to clipboard
open override fun toString(): String
Link copied to clipboard

Use unauthorized access to the Kubernetes API server

Link copied to clipboard

Connecting to a Kubernetes cluster using a username and password

Link copied to clipboard
open override fun validate(consumer: ErrorConsumer)

Validates this object and reports found errors to the provided consumer