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

Add flux executor plugin with GitHub support #1170

Merged
merged 4 commits into from
Aug 2, 2023

Conversation

mszostok
Copy link
Contributor

@mszostok mszostok commented Aug 1, 2023

Description

Changes proposed in this pull request:

  • Add flux executor plugin with GitHub support

flux-demo

flux-interactivity

Testing

  1. Checkout this PR
  2. Create k3d cluster: k3d cluster create labs --image=rancher/k3s:v1.25.0-k3s1
  3. Create GitHub token: https://github.com/settings/personal-access-tokens/new
  4. Create configuration:
    communications:
      default-group:
        socketSlack:
          enabled: true
          channels:
            default:
              name: random
              bindings:
                sources: []
                executors:
                  - flux
          appToken: "xapp-1"
          botToken: "xoxb-"
    
    executors:
      flux:
        botkube/flux:
          enabled: true
          config:
            log:
              level: "debug"
            github:
              auth:
                accessToken: "ghp_"
    
          context:
            rbac:
              group:
                type: Static
                static:
                  values: [ "system:masters" ]
     
    extraEnv:
      - name: LOG_LEVEL_EXECUTOR_BOTKUBE_FLUX
        value: "debug"
    
    plugins:
      cacheDir: "/tmp/plugins"
      repositories:
        botkube:
          url: http://host.k3d.internal:3010/botkube.yaml
    
    settings:
      log:
        level: "debug"
        formatter: text
      clusterName: "labs"
      upgradeNotifier: false
    
    analytics:
      disable: true
    
    configWatcher:
      enabled: false
    
  5. Build plugin: PLUGIN_TARGETS="flux" make build-plugins
  6. Start plugin server: env PLUGIN_SERVER_HOST=http://host.k3d.internal go run test/helpers/plugin_server.go
  7. Install Botkube:
    helm upgrade botkube --install --namespace botkube ./helm/botkube --create-namespace -f /tmp/flux-config.yaml --set image.repository=kubeshop/pr/botkube --set image.pullPolicy="Always" --set image.tag=1170-PR

Flux

  1. Run @Botkube flux tutorial

  2. Click flux install

  3. Next navigate to terminal and create:

    apiVersion: source.toolkit.fluxcd.io/v1
    kind: GitRepository
    metadata:
      name: podinfo
    spec:
      interval: 5m
      url: https://github.com/mszostok/podinfo
      ref:
        branch: master
    ---
    apiVersion: kustomize.toolkit.fluxcd.io/v1
    kind: Kustomization
    metadata:
      name: podinfo
    spec:
      interval: 10m
      targetNamespace: default
      sourceRef:
        kind: GitRepository
        name: podinfo
      path: "./kustomize"
      prune: true
      timeout: 1m

    kubectl apply -f podinfo.yaml -n flux-system

  4. Run on Slack:

    • @Botkube flux get ks
    • @Botkube flux get source git
    • @Botkube flux diff ks podinfo --path ./kustomize --github-ref 3
    • @Botkube flux diff ks podinfo --path ./kustomize --github-ref https://github.com/mszostok/podinfo/pull/2

    Play with buttons.

Related issue(s)

@mszostok mszostok added the enhancement New feature or request label Aug 1, 2023
@mszostok mszostok force-pushed the flux-executor branch 4 times, most recently from 9b437bb to 08b3fb3 Compare August 1, 2023 20:57
@mszostok mszostok marked this pull request as ready for review August 1, 2023 21:38
@mszostok mszostok requested review from PrasadG193 and a team as code owners August 1, 2023 21:38
Makefile Outdated Show resolved Hide resolved
pkg/pluginx/command.go Outdated Show resolved Hide resolved
Copy link
Contributor

@huseyinbabal huseyinbabal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with minor comments, really good job ! 🚀

@mszostok mszostok enabled auto-merge (squash) August 2, 2023 10:48
@mszostok mszostok merged commit 3c3e5a9 into kubeshop:main Aug 2, 2023
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants