kestra-io / kestra-io/plugin-oci

[Plugin] OCI — Container Engine / Kubernetes (OKE)

Open
#14 0 comments 0 reactions 0 assignees View on GitHub
area/plugin
Dominant language
Java
Stars
0
Forks
0
Avg merge
18h 3m
Merged PRs (30d)
1

Description

## Summary

The OCI Container Engine sub-plugin for `plugin-oci` enables Kestra flows to manage Oracle Container Engine for Kubernetes (OKE) clusters and node pools — creating, scaling, upgrading, and deleting clusters as part of platform automation pipelines. Teams can provision ephemeral OKE clusters for load testing, manage node pool scaling in response to workload events, or orchestrate cluster lifecycle across multiple environments from a single flow.

## Motivation

Platform engineering teams managing OKE clusters need to automate cluster lifecycle operations that today require OCI CLI scripts or Terraform: spinning up a staging cluster, scaling node pools before a batch workload, or tearing down a cluster after a pipeline run. Without a native Kestra plugin, these operations can't be composed with upstream or downstream tasks in a typed, expression-aware way. An OKE sub-plugin makes cluster management a first-class orchestration concern.

## Context

Part of the OCI Plugin Suite EPIC: https://github.com/kestra-io/plugin-oci/issues/2
Reference: `plugin-aws` EKS tasks, `plugin-gcp` GKE tasks.

## API Reference

- **Official docs**: https://docs.oracle.com/en-us/iaas/api/#/en/containerengine/latest/
- **Authentication**: Config-file (`~/.oci/config`), instance principal, or `SimpleAuthenticationDetailsProvider`
- **Base URL pattern**: `https://containerengine.{region}.oraclecloud.com/20180222/`
- **SDK**: OCI Java SDK v3.87.0 via BOM

## Gradle Dependencies

Add to `build.gradle`:

```groovy
// OCI Java SDK BOM
implementation platform("com.oracle.oci.sdk:oci-java-sdk-bom:3.87.0")
// Container Engine (OKE)
implementation "com.oracle.oci.sdk:oci-java-sdk-containerengine"
implementation "com.oracle.oci.sdk:oci-java-sdk-common"
```

## Plugin Structure

- **Repository**: `plugin-oci`
- **Namespace**: `io.kestra.plugin.oci.containerengine`
- **Sub-plugins**: `containerengine` (clusters, node pools)

## Suggested Tasks

1. `CreateCluster` — provision a new OKE cluster (Kubernetes version, VCN, API endpoint config)
2. `DeleteCluster` — delete a cluster by OCID
3. `GetCluster` — fetch cluster details and emit lifecycle state, kubeconfig endpoint as outputs
4. `ListClusters` — list clusters in a compartment
5. `CreateNodePool` — add a node pool to a cluster (shape, image, node count)
6. `UpdateNodePool` — scale a node pool (change node count or shape config)
7. `DeleteNodePool` — delete a node pool from a cluster
8. `GetNodePool` — fetch node pool details and lifecycle state
9. Add `ClusterLifecycleTrigger` — poll until a cluster reaches ACTIVE or FAILED state
10. Write unit + integration tests

## YAML Examples

### Example 1 — Provision an OKE cluster and wait until ACTIVE

```yaml
id: provision_oke_cluster
namespace: company.platform

inputs:
- id: compartment_ocid
type: STRING
- id: vcn_ocid
type: STRING

tasks:
- id: create_cluster
type: io.kestra.plugin.oci.containerengine.CreateCluster
region: eu-frankfurt-1
tenancyOcid: "{{ secret('OCI_TENANCY_OCID') }}"
userId: "{{ secret('OCI_USER_OCID') }}"
fingerprint: "{{ secret('OCI_FINGERPRINT') }}"
privateKey: "{{ secret('OCI_PRIVATE_KEY') }}"
compartmentId: "{{ inputs.compartment_ocid }}"
name: kestra-test-cluster-{{ execution.id }}
kubernetesVersion: v1.31.1
vcnId: "{{ inputs.vcn_ocid }}"
waitForLifecycleState: ACTIVE

- id: log_cluster
type: io.kestra.plugin.core.log.Log
message: "Cluster {{ outputs.create_cluster.clusterId }} is ACTIVE"
```

### Example 2 — Scale a node pool and log the new count

```yaml
id: scale_oke_node_pool
namespace: company.platform

inputs:
- id: node_pool_ocid
type: STRING
- id: node_count
type: INT

tasks:
- id: scale
type: io.kestra.plugin.oci.containerengine.UpdateNodePool
region: eu-frankfurt-1
tenancyOcid: "{{ secret('OCI_TENANCY_OCID') }}"
userId: "{{ secret('OCI_USER_OCID') }}"
fingerprint: "{{ secret('OCI_FINGERPRINT') }}"
privateKey: "{{ secret('OCI_PRIVATE_KEY') }}"
nodePoolId: "{{ inputs.node_pool_ocid }}"
size: "{{ inputs.node_count }}"

- id: log_scale
type: io.kestra.plugin.core.log.Log
message: "Node pool scaled to {{ inputs.node_count }} nodes"
```

### Example 3 — Trigger a flow when a cluster becomes ACTIVE

```yaml
id: on_oke_cluster_active
namespace: company.platform

triggers:
- id: cluster_watcher
type: io.kestra.plugin.oci.containerengine.ClusterLifecycleTrigger
region: eu-frankfurt-1
tenancyOcid: "{{ secret('OCI_TENANCY_OCID') }}"
userId: "{{ secret('OCI_USER_OCID') }}"
fingerprint: "{{ secret('OCI_FINGERPRINT') }}"
privateKey: "{{ secret('OCI_PRIVATE_KEY') }}"
clusterId: "{{ secret('OCI_CLUSTER_OCID') }}"
targetLifecycleState: ACTIVE
interval: PT3M

tasks:
- id: deploy
type: io.kestra.plugin.core.log.Log
message: "OKE cluster {{ trigger.clusterId }} is ready — deploying workloads"
```

## Acceptance Criteria

- [ ] `CreateCluster`, `DeleteCluster`, `GetCluster`, `ListClusters` tasks implemented
- [ ] `CreateNodePool`, `UpdateNodePool`, `DeleteNodePool`, `GetNodePool` tasks implemented
- [ ] `CreateCluster` supports `waitForLifecycleState` parameter
- [ ] `ClusterLifecycleTrigger` polling trigger implemented
- [ ] `GetCluster` emits cluster endpoint and kubeconfig-ready outputs
- [ ] All `Property` fields support Kestra expression language
- [ ] Unit + integration tests pass (`./gradlew test`)
- [ ] `package-info.java` with `@PluginSubGroup(category = PluginSubGroup.PluginCategory.CLOUD)`
- [ ] Build passes with `./gradlew build`

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reviewing the existing plugin-aws EKS and plugin-gcp GKE tasks, then inspect build.gradle for OCI SDK dependencies and package-info.java for plugin metadata. Implement the listed cluster, node pool, and lifecycle trigger tasks with expression-aware Property fields, and run ./gradlew test and ./gradlew build to verify completion.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, kubernetes
Domain
cloud, devops
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.