Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Proposal] Kubernetes target #1441

Open
anasinnyk opened this issue Jun 1, 2023 · 2 comments
Open

[Proposal] Kubernetes target #1441

anasinnyk opened this issue Jun 1, 2023 · 2 comments
Labels
feature request Request for a new feature p0 Highest priority items

Comments

@anasinnyk
Copy link

Hi, It will be awesome if we can transform our Event to Kubernetes manifest and post it to API.

I think a bigger problem here is a templating, because we need to merge our event data with kubernetes manifest data. (I'm not sure if it's a nature for TriggerMash).

Links with similar implementations:

@anasinnyk anasinnyk changed the title Kubernetes target source Kubernetes target Jun 1, 2023
@anasinnyk anasinnyk changed the title Kubernetes target [Proposal] Kubernetes target Jun 1, 2023
@jmcx jmcx added the feature request Request for a new feature label Jun 1, 2023
@jmcx jmcx added the p0 Highest priority items label Jul 19, 2023
@jmcx
Copy link
Contributor

jmcx commented Jul 19, 2023

Raised at least 2 more times by users wanting to trigger a Kubernetes Job.

@nihar-13
Copy link

nihar-13 commented Jul 19, 2023

I have a similar requirement. I have to create and execute a container everytime a particular event is received. I have tried a lot playing around different K8S APIs, but have been half-successful. Here is what I've tried:

  1. Created a HTTPPollerSource --> listens to a webpage every 60 secs (lets use a random data generator as example)
  2. Created a memory broker (for development)
  3. Created a trigger (with no filters as of now)
  4. Created a HTTPTarget with target as K8S API (POST) - here I've tried jobs, pods, deployments - everything work once when the HTTPTarget manifest is applied. They dont get triggered upon the next event. The YAML is like this:

Target YAML:

apiVersion: targets.triggermesh.io/v1alpha1
kind: HTTPTarget
metadata:
 name: call-abi-pod
 namespace: default
spec:
  restartPolicy: Always
  response:
    eventType: CallPodResponseEvent
    eventSource: kubernetes-api-response
  skipVerify: true
  endpoint: 'https://kubernetes.docker.internal:6443/apis/batch/v1/namespaces/default/jobs'
  method: 'POST'
  headers:
    Content-type: 'application/yaml'
    data: |
apiVersion: batch/v1
kind: Job
metadata:
  name: sample-abi-job
spec:
  ttlSecondsAfterFinished: 30
  template:
    metadata:
      name: sample-abi-job
    spec:
      containers:
      - name: abi-demo
        image: busybox
        imagePullPolicy: IfNotPresent
        env:
        - name: JOB_LOG_DIR
          value: "/tmp/log/abinitio/" # This should be changed to above line in the actual Ab Initio container
        command:
        - /bin/sh
        - -c
        - mkdir -p ${JOB_LOG_DIR}; echo [`date +"%Y-%m-%d-%H:%M:%S"`]-Hello this is a sample log file from Ab>Initio job. >> ${JOB_LOG_DIR}/fl_scenario.log; echo "Log file written successfully."; cat ${JOB_LOG_DIR}/fl_scenario.log;
      restartPolicy: Never
---

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request Request for a new feature p0 Highest priority items
Projects
None yet
Development

No branches or pull requests

3 participants