Skip to content

Instantly share code, notes, and snippets.

View huseyinbabal's full-sized avatar
🏠
Working from home

Hüseyin BABAL huseyinbabal

🏠
Working from home
View GitHub Profile
@huseyinbabal
huseyinbabal / kubectl_krew_node.md
Created September 27, 2023 11:29
kubectl, krew, nodejs docker image

Dockerfile

# Use the official Docker image as a parent image
FROM docker:latest

# Install dependencies
RUN apk add --no-cache \
    curl \
    git \
 bash \
func streamLogs(clientset kubernetes.Interface, namespace, labelSelector string) error {
ctx := context.TODO()
// Watch for changes to pods that match the label selector
listWatcher := cache.NewListWatchFromClient(
clientset.CoreV1().RESTClient(),
"pods",
namespace,
fields.Everything(),
labels.SelectorFromSet(labels.Set(labelSelector)),
@huseyinbabal
huseyinbabal / keptn_plugin_comm_config.yaml
Created May 22, 2023 13:42
Keptn Plugin Communication Config
...
slack:
enabled: true
token: "xoxb-..."
channels:
'default':
name: botkube-demo
bindings:
sources:
- keptn
@huseyinbabal
huseyinbabal / keptn_plugin_source_configuration.yaml
Created May 22, 2023 13:41
Keptn Plugin Source Configuration
'keptn':
## Keptn source configuration
## Plugin name syntax: <repo>/<plugin>[@<version>]. If version is not provided, the latest version from repository is used.
botkube/keptn:
# -- If true, enables `keptn` source.
enabled: true
config:
project: "botkube"
url: "http://localhost:8080/api"
token: "keptn_token"
@huseyinbabal
huseyinbabal / botkube_repo_config.yaml
Created May 22, 2023 13:39
Botkube Plugin Repository Config
// config.yaml
...
plugins:
repositories:
botkube:
url: http://localhost:8080/plugins-dev-index.yaml
...
npx serve --listen 8080
@huseyinbabal
huseyinbabal / botkube_plugin_index_generate.sh
Created May 22, 2023 13:37
Botkube Plugin Index Generate
PLUGIN_DOWNLOAD_URL_BASE_PATH=http://localhost:8080/plugin-dist make gen-plugins-index
@huseyinbabal
huseyinbabal / keptn_consume_events.go
Created May 22, 2023 13:35
Keptn Consume Events
// source.go
package keptn
const pollPeriodInSeconds = 5
...
func (p *Source) consumeEvents(ctx context.Context, cfg Config, ch chan<- source.Event) {
keptn, err := NewClient(cfg.URL, cfg.Token)
log := loggerx.New(cfg.Log)
exitOnError(err, log)
for {
req := GetEventsRequest{
@huseyinbabal
huseyinbabal / keptn_plugin_core_contract.go
Created May 22, 2023 13:34
Keptn Plugin Core Contract
// source.go
Stream(ctx context.Context, input source.StreamInput) (source.StreamOutput, error)
Metadata(_ context.Context) (api.MetadataOutput, error)
@huseyinbabal
huseyinbabal / keptn_client_implementation.go
Created May 22, 2023 13:33
Keptn Client Implementation
// client.go
package keptn
import (
api "github.com/keptn/go-utils/pkg/api/utils/v2"
"time"
)
// Client Keptn client
type Client struct {
// API refers to Keptn client. https://github.com/keptn/go-utils
API *api.APISet