Giter Club home page Giter Club logo

provider-temporal's Introduction

Temporal Provider

Temporal Provider is a Crossplane provider. It was build based on the Crossplane Template. It is used to manage and configure Temporal. It uses the Temporal Go SDK

How to use

Repository and package:

xpkg.upbound.io/denniskniep/provider-temporal:<version>

Provider Credentials:

{
  "HostPort": "temporal:7233"
}

Example:

apiVersion: pkg.crossplane.io/v1
kind: Provider
metadata:
  name: provider-temporal
spec:
  package: xpkg.upbound.io/denniskniep/provider-temporal:v1.2.0
  packagePullPolicy: IfNotPresent
  revisionActivationPolicy: Automatic
---
apiVersion: v1
kind: Secret
metadata:
  name: provider-temporal-config-creds
  namespace: crossplane-system
type: Opaque
stringData:
  credentials: |
    {
      "HostPort": "temporal:7233"
    }
---
apiVersion: temporal.crossplane.io/v1alpha1
kind: ProviderConfig
metadata:
  name: provider-temporal-config
spec: 
  credentials:
    source: Secret
    secretRef:
      namespace: crossplane-system
      name: provider-temporal-config-creds
      key: credentials  

Troubleshooting

Create a DeploymentRuntimeConfig and set the arg --debug on the package-runtime container:

apiVersion: pkg.crossplane.io/v1beta1
kind: DeploymentRuntimeConfig
metadata:
  name: debug-config
spec:
  deploymentTemplate:
    spec:
      selector: {}
      template:
        spec:
          containers:
            - name: package-runtime
              args:
                - --debug
---
apiVersion: pkg.crossplane.io/v1
kind: Provider
metadata:
  name: provider-temporal
spec:
  package: xpkg.upbound.io/denniskniep/provider-temporal:v1.2.0
  packagePullPolicy: IfNotPresent
  revisionActivationPolicy: Automatic
  runtimeConfigRef:
    name: debug-config

Covered Managed Resources

Currently covered Managed Resources:

TemporalNamespace

A Namespace is a unit of isolation within the Temporal Platform

temporal docs

temporal cli

Hint: Currently its not possible to name this managed resource simply Namespace, because of this and this.

Example:

apiVersion: core.temporal.crossplane.io/v1alpha1
kind: TemporalNamespace
metadata:
  name: namespace1
spec:
  forProvider:
    name: "Test1"
    description: "Desc 1"
    ownerEmail: "[email protected]"
    workflowExecutionRetentionDays: 30
    data:
      - key1: value1
      - key2: value2
    historyArchivalState: "Disabled"
    historyArchivalUri: ""
    visibilityArchivalState: "Disabled"
    visibilityArchivalUri: ""
  providerConfigRef:
    name: provider-temporal-config

SearchAttribute

Search Attributes enable complex and business-logic-focused search queries for Workflow Executions. These are often queried through the Temporal Web UI, but you can also query from within your Workflow code. For more debugging and monitoring, you might want to add your own domain-specific Search Attributes, such as customerId or numItems, that can serve as useful search filters.

temporal docs

temporal cli

Example 1:

apiVersion: core.temporal.crossplane.io/v1alpha1
kind: SearchAttribute
metadata:
  name: searchattr1
spec:
  forProvider:
    name: "Test1"
    type: "Keyword"
    temporalNamespaceName: "Test1"
  providerConfigRef:
    name: local-temporal-instance-config

Example 2:

apiVersion: core.temporal.crossplane.io/v1alpha1
kind: SearchAttribute
metadata:
  name: searchattr1
spec:
  forProvider:
    name: "Test1"
    type: "Keyword"
    temporalNamespaceNameRef:
      name: "namespace1"
  providerConfigRef:
    name: local-temporal-instance-config

Contribute

Developing

  1. Add new type by running the following command:
  export provider_name=temporal
  export group=core # lower case e.g. core, cache, database, storage, etc.
  export type=MyType # Camel casee.g. Bucket, Database, CacheCluster, etc.
  make provider.addtype provider=${provider_name} group=${group} kind=${type}
  1. Replace the core group with your new group in apis/{provider}.go
  2. Replace the MyType type with your new type in internal/controller/{provider}.go
  3. Run make reviewable to run code generation, linters, and tests. (make generate to only run code generation)
  4. Run make build to build the provider.

Refer to Crossplane's CONTRIBUTING.md file for more information on how the Crossplane community prefers to work. The Provider Development guide may also be of use.

Tests

Start temporal environment for tests

sudo docker-compose -f tests/docker-compose.yaml up 

provider-temporal's People

Contributors

denniskniep avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

provider-temporal's Issues

TCP connections to temporal are never closed causing frontend pod to increase consumed memory indefinitely (OOM killed)

I am testing provider-temporal in Kubernetes cluster along with self hosted Temporal. Provider is connecting to Temporal using Kubernetes service name for temporal-frontend. Functionality wise, all is good and namespaces and search_attributes are being created and deleted as expected.

However, the provider never closes the established connections to temporal-frontend and, with the default poll interval set to 1 minute, the open connections keep accumulating until the temporal-frontend pod consumes all its memory and is OOM killed. The temporal has no workflows or other load than the one caused by the provider.
We are using ArgoCD to push the config to the provider but the config itself is small: 1 namespace and 9 search attributes.
With this small config and the poll interval set to 1 minute, the provider opens 5000+ connections to temporal-frontend which quickly consumes its 1GB memory request and is OOM killed (in a few minutes).

Below is a sample of TCP connections between provider and temporal-frontend:

tcp        0      0 ::ffff:10.21.18.39:7233 ::ffff:10.21.25.251:48384 ESTABLISHED 1/temporal-server
tcp        0      0 ::ffff:10.21.18.39:7233 ::ffff:10.21.25.251:48208 ESTABLISHED 1/temporal-server
tcp        0      0 ::ffff:10.21.18.39:7233 ::ffff:10.21.25.251:51404 ESTABLISHED 1/temporal-server
tcp        0      0 ::ffff:10.21.18.39:7233 ::ffff:10.21.25.251:48428 ESTABLISHED 1/temporal-server
tcp        0      0 ::ffff:10.21.18.39:7233 ::ffff:10.21.25.251:48540 ESTABLISHED 1/temporal-server
tcp        0      0 ::ffff:10.21.18.39:7233 ::ffff:10.21.25.251:48716 ESTABLISHED 1/temporal-server
tcp        0      0 ::ffff:10.21.18.39:7233 ::ffff:10.21.25.251:51496 ESTABLISHED 1/temporal-server
tcp        0      0 ::ffff:10.21.18.39:7233 ::ffff:10.21.25.251:51546 ESTABLISHED 1/temporal-server
tcp        0      0 ::ffff:10.21.18.39:7233 ::ffff:10.21.25.251:51542 ESTABLISHED 1/temporal-server
tcp        0      0 ::ffff:10.21.18.39:7233 ::ffff:10.21.25.251:51312 ESTABLISHED 1/temporal-server
tcp        0      0 ::ffff:10.21.18.39:7233 ::ffff:10.21.25.251:48850 ESTABLISHED 1/temporal-server
tcp        0      0 ::ffff:10.21.18.39:7233 ::ffff:10.21.25.251:48672 ESTABLISHED 1/temporal-server
tcp        0      0 ::ffff:10.21.18.39:7233 ::ffff:10.21.25.251:48982 ESTABLISHED 1/temporal-server
tcp        0      0 ::ffff:10.21.18.39:7233 ::ffff:10.21.25.251:51390 ESTABLISHED 1/temporal-server
tcp        0      0 ::ffff:10.21.18.39:7233 ::ffff:10.21.25.251:37748 ESTABLISHED 1/temporal-server
tcp        0      0 ::ffff:10.21.18.39:7233 ::ffff:10.21.25.251:48580 ESTABLISHED 1/temporal-server
tcp        0      0 ::ffff:10.21.18.39:7233 ::ffff:10.21.25.251:51194 ESTABLISHED 1/temporal-server
tcp        0      0 ::ffff:10.21.18.39:7233 ::ffff:10.21.25.251:48780 ESTABLISHED 1/temporal-server
tcp        0      0 ::ffff:10.21.18.39:7233 ::ffff:10.21.25.251:51162 ESTABLISHED 1/temporal-server
tcp        0      0 ::ffff:10.21.18.39:7233 ::ffff:10.21.25.251:48840 ESTABLISHED 1/temporal-server
tcp        0      0 ::ffff:10.21.18.39:7233 ::ffff:10.21.25.251:51330 ESTABLISHED 1/temporal-server
tcp        0      0 ::ffff:10.21.18.39:7233 ::ffff:10.21.25.251:51296 ESTABLISHED 1/temporal-server
tcp        0      0 ::ffff:10.21.18.39:7233 ::ffff:10.21.25.251:51196 ESTABLISHED 1/temporal-server
tcp        0      0 ::ffff:10.21.18.39:7233 ::ffff:10.21.25.251:48788 ESTABLISHED 1/temporal-server
tcp        0      0 ::ffff:10.21.18.39:7233 ::ffff:10.21.25.251:48900 ESTABLISHED 1/temporal-server
tcp        0      0 ::ffff:10.21.18.39:7233 ::ffff:10.21.25.251:48942 ESTABLISHED 1/temporal-server
tcp        0      0 ::ffff:10.21.18.39:7233 ::ffff:10.21.25.251:48480 ESTABLISHED 1/temporal-server
tcp        0      0 ::ffff:10.21.18.39:7233 ::ffff:10.21.25.251:48210 ESTABLISHED 1/temporal-server
tcp        0      0 ::ffff:10.21.18.39:7233 ::ffff:10.21.25.251:48556 ESTABLISHED 1/temporal-server
tcp        0      0 ::ffff:10.21.18.39:7233 ::ffff:10.21.25.251:51124 ESTABLISHED 1/temporal-server
tcp        0      0 ::ffff:10.21.18.39:7233 ::ffff:10.21.25.251:48740 ESTABLISHED 1/temporal-server
tcp        0      0 ::ffff:10.21.18.39:7233 ::ffff:10.21.25.251:48610 ESTABLISHED 1/temporal-server
tcp        0      0 ::ffff:10.21.18.39:7233 ::ffff:10.21.25.251:48890 ESTABLISHED 1/temporal-server
tcp        0      0 ::ffff:10.21.18.39:7233 ::ffff:10.21.25.251:51436 ESTABLISHED 1/temporal-server

Workaround: set poll interval to 60 minutes; TCP connections are accumulating but in a lower amount and the pod is not consuming all its memory

Temporal-provider version: v1.3.0
Crossplane version: v1.15.2
Kubernetes version: v1.28.7
Kubernetes distribution: EKS

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.