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

Report botkube status #978

Merged
merged 5 commits into from
Feb 17, 2023
Merged

Conversation

josefkarasek
Copy link

Description

Changes proposed in this pull request:

  • Report botkube status to the backend

Testing

Deploy backend locally:

docker run -d -p 5432:5432 --name botkube -e POSTGRES_PASSWORD=s3cr3t -d postgres
cp config.dist.yaml config.yaml`
CONFIG_LOCATION=./config.yaml go run server.go

Visit http://localhost:8080

mutation{
  createDeployment(input: {
    name: "cls1",
    plugins: [
      {
        groups: [
          {
            name: "kubernetes-info",
            displayName: "kubernetes-info"
            type: SOURCE,
            configurations: [
              {
                name: "kubernetes",
                configuration: "{\"recommendations\":{\"pod\":{\"noLatestImageTag\":true,\"labelsSet\":true},\"ingress\":{\"backendServiceValid\":true,\"tlsSecretValid\":true}}}"
              }
            ]
          }
        ]
      }
    ],
    platforms:
      {
    	 slacks: {
        name:"secondslack",
        token:"apptoken"
        notificationType:"short"
        channels: [
          {
            name: "default"
            bindings: {
              sources: ["kubernetes-info"]
              
            }
          }
        ]
      }
      }

  	})  {
    id
    status {
      phase
      lastTransitionTime
    }
  }
}

Note your Deployment ID and create k8s botkube namespace.

mutation{
  reportDeploymentStartup(id: "71cf8493-6b68-41a1-8337-792260a170a7") 
  reportDeploymentShutdown(id: "71cf8493-6b68-41a1-8337-792260a170a7") 
  reportDeploymentFailed(id: "71cf8493-6b68-41a1-8337-792260a170a7") 
  query{
  deployment(id: "71cf8493-6b68-41a1-8337-792260a170a7") {
    status {
      phase
      lastTransitionTime
    }
  }
}
}

Connect with Botkube

k3d cluster create
k create ns botkube
    CONFIG_PROVIDER_IDENTIFIER=<id>
    CONFIG_PROVIDER_ENDPOINT=http://localhost:8080/graphql
  • Run Botkube go run cmd/botkube/main.go

Related issue(s)

https://github.com/kubeshop/botkube-cloud/issues/117

@josefkarasek josefkarasek marked this pull request as ready for review February 10, 2023 11:30
@josefkarasek josefkarasek requested a review from a team February 10, 2023 11:30
@josefkarasek josefkarasek force-pushed the report-status branch 2 times, most recently from c7ee111 to 0fec4d4 Compare February 14, 2023 14:13
@huseyinbabal
Copy link
Contributor

Notes about testing 👇

Disable JWT, or else you cannot make query without JWT token

app:
  ...
  security:
    ...
    jwtValidation:
      disabled: true

Provide a valid slack token, or else application will not be started and you cannot evaluate CONNETCTED phase.

platforms:
      {
    	 slacks: {
        name:"secondslack",
        token:"xoxb....."

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.

🚀 with minor comment.

@josefkarasek josefkarasek merged commit 01a337a into kubeshop:main Feb 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants