This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import ( | |
| "context" | |
| "fmt" | |
| "github.com/itchyny/gojq" | |
| "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" | |
| "k8s.io/apimachinery/pkg/runtime" | |
| "k8s.io/client-go/dynamic" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import ( | |
| "context" | |
| "fmt" | |
| v1 "k8s.io/api/apps/v1" | |
| metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | |
| "k8s.io/client-go/kubernetes" | |
| ctrl "sigs.k8s.io/controller-runtime" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import ( | |
| "context" | |
| "fmt" | |
| metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | |
| "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" | |
| "k8s.io/apimachinery/pkg/runtime/schema" | |
| "k8s.io/client-go/dynamic" | |
| ctrl "sigs.k8s.io/controller-runtime" | |
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from sklearn.datasets import make_regression | |
| import pandas as pd | |
| from xgboost import XGBRegressor | |
| import matplotlib.pyplot as plt | |
| import seaborn as sns | |
| X, y = make_regression(n_samples=500, n_features=4, n_informative=2, noise=0.3) | |
| X = pd.DataFrame(X, columns=['A', 'B', 'C', 'D']) | |
| model = XGBRegressor() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import org.apache.kafka.streams.KafkaStreams; | |
| import org.apache.kafka.streams.StreamsBuilder; | |
| import org.apache.kafka.streams.StreamsConfig; | |
| import org.apache.kafka.streams.kstream.JoinWindows; | |
| import org.apache.kafka.streams.kstream.KStream; | |
| // ... // | |
| StreamsBuilder builder = new StreamsBuilder(); | |
| KStream<String, JsonObject> inputStream = builder.stream(inputTopic); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public static final double SOME_CONSTANT = ...; | |
| // ... // | |
| // define conditions for each branch (edge) of topology | |
| Predicate<String, JsonObject> greaterThan = (String key, JsonObject value) -> { | |
| double dValue = value.get("my_double_value").getAsDouble(); | |
| return dValue > SOME_CONSTANT; | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.util.Properties; | |
| import com.google.gson.JsonObject; | |
| import org.apache.kafka.common.serialization.Serdes; | |
| import org.apache.kafka.streams.KafkaStreams; | |
| import org.apache.kafka.streams.StreamsBuilder; | |
| import org.apache.kafka.streams.StreamsConfig; | |
| import org.apache.kafka.streams.kstream.KStream; | |
| // ... // |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <dependency> | |
| <groupId>org.apache.kafka</groupId> | |
| <artifactId>kafka-streams</artifactId> | |
| <version>2.6.0</version> | |
| </dependency> | |
| <dependency> | |
| <groupId>org.apache.kafka</groupId> | |
| <artifactId>kafka-clients</artifactId> | |
| <version>2.6.0</version> | |
| </dependency> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package services | |
| import ( | |
| "fmt" | |
| v1 "k8s.io/api/core/v1" | |
| metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | |
| "k8s.io/client-go/kubernetes" | |
| ) | |
| const typeAnnotation string = "original-service-type" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package services | |
| import ( | |
| apiv1 "k8s.io/api/core/v1" | |
| metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | |
| "k8s.io/client-go/kubernetes" | |
| ) | |
| // ListServices returns a list of K8 services | |
| func ListServices(namespace string, client kubernetes.Interface) (*apiv1.ServiceList, error) { |
NewerOlder