Develop Kubernetes Operators in Java without Breaking a Sweat

Developing Kubernetes operators in Java is not yet the norm. So far, Go has been the language of choice here, not least because of its excellent support for writing corresponding tests. 

One challenge in developing Java-based projects has been the lack of easy automated integration testing that interacts with a Kubernetes API server. However, thanks to the open source library Kindcontainer, based on the widely used Testcontainers integration test library, this gap can be bridged, enabling easier development of Java-based Kubernetes projects. 

In this article, we’ll show how to use Testcontainers to test custom Kubernetes controllers and operators implemented in Java.

Kubernetes in Docker

Testcontainers allows starting arbitrary infrastructure components and processes running in Docker containers from tests running within a Java virtual machine (JVM). The framework takes care of binding the lifecycle and cleanup of Docker containers to the test execution. Even if the JVM is terminated abruptly during debugging, for example, it ensures that the started Docker containers are also stopped and removed. In addition to a generic class for any Docker image, Testcontainers offers specialized implementations in the form of subclasses — for components with sophisticated configuration options, for example. 

These specialized implementations can also be provided by third-party libraries. The open source project Kindcontainer is one such third-party library that provides specialized implementations for various Kubernetes containers based on Testcontainers:

ApiServerContainer

K3sContainer

KindContainer

Although ApiServerContainer focuses on providing only a small part of the Kubernetes control plane, namely the Kubernetes API server, K3sContainer and KindContainer launch complete single-node Kubernetes clusters in Docker containers. 

This allows for a trade-off depending on the requirements of the respective tests: If only interaction with the API server is necessary for testing, then the significantly faster-starting ApiServerContainer is usually sufficient. However, if testing complex interactions with other components of the Kubernetes control plane or even other operators is in the scope, then the two “larger” implementations provide the necessary tools for that — albeit at the expense of startup time. For perspective, depending on the hardware configuration, startup times can reach a minute or more.

A first example

To illustrate how straightforward testing against a Kubernetes container can be, let’s look at an example using JUnit 5:

@Testcontainers
public class SomeApiServerTest {
@Container
public ApiServerContainer<?> K8S = new ApiServerContainer<>();

@Test
public void verify_no_node_is_present() {
Config kubeconfig = Config.fromKubeconfig(K8S.getKubeconfig());
try (KubernetesClient client = new KubernetesClientBuilder().withConfig(kubeconfig).build()) {
// Verify that ApiServerContainer has no nodes
assertTrue(client.nodes().list().getItems().isEmpty());
}
}
}

Thanks to the @Testcontainers JUnit 5 extension, lifecycle management of the ApiServerContainer is easily handled by marking the container that should be managed with the @Container annotation. Once the container is started, a YAML document containing the necessary details to establish a connection with the API server can be retrieved via the getKubeconfig() method. 

This YAML document represents the standard way of presenting connection information in the Kubernetes world. The fabric8 Kubernetes client used in the example can be configured using Config.fromKubeconfig(). Any other Kubernetes client library will offer similar interfaces. Kindcontainer does not impose any specific requirements in this regard.

All three container implementations rely on a common API. Therefore, if it becomes clear at a later stage of development that one of the heavier implementations is necessary for a test, you can simply switch to it without any further code changes — the already implemented test code can remain unchanged.

Customizing your Testcontainers

In many situations, after the Kubernetes container has started, a lot of preparatory work needs to be done before the actual test case can begin. For an operator, for example, the API server must first be made aware of a Custom Resource Definition (CRD), or another controller must be installed via a Helm chart. What may sound complicated at first is made simple by Kindcontainer along with intuitively usable Fluent APIs for the command-line tools kubectl and helm.

The following listing shows how a CRD is first applied from the test’s classpath using kubectl, followed by the installation of a Helm chart:

@Testcontainers
public class FluentApiTest {
@Container
public static final K3sContainer<?> K3S = new K3sContainer<>()
.withKubectl(kubectl -> {
kubectl.apply.fileFromClasspath(“manifests/mycrd.yaml”).run();
})
.withHelm3(helm -> {
helm.repo.add.run(“repo”, “https://repo.example.com”);
helm.repo.update.run();
helm.install.run(“release”, “repo/chart”);
);
// Tests go here
}

Kindcontainer ensures that all commands are executed before the first test starts. If there are dependencies between the commands, they can be easily resolved; Kindcontainer guarantees that they are executed in the order they are specified.

The Fluent API is translated into calls to the respective command-line tools. These are executed in separate containers, which are automatically started with the necessary connection details and connected to the Kubernetes container via the Docker internal network. This approach avoids dependencies on the Kubernetes image and version conflicts regarding the available tooling within it.

Selecting your Kubernetes version

If nothing else is specified by the developer, Kindcontainer starts the latest supported Kubernetes version by default. However, this approach is generally discouraged, so the best practice would require you to explicitly specify one of the supported versions when creating the container, as shown:

@Testcontainers
public class SpecificVersionTest {
@Container
KindContainer<?> container=new KindContainer<>(KindContainerVersion.VERSION_1_24_1);
// Tests go here
}

Each of the three container implementations has its own Enum, through which one of the supported Kubernetes versions can be selected. The test suite of the Kindcontainer project itself ensures — with the help of an elaborate matrix-based integration test setup — that the full feature set can be easily utilized for each of these versions. This elaborate testing process is necessary because the Kubernetes ecosystem evolves rapidly, and different initialization steps need to be performed depending on the Kubernetes version.

Generally, the project places great emphasis on supporting all currently maintained Kubernetes major versions, which are released every 4 months. Older Kubernetes versions are marked as @Deprecated and eventually removed when supporting them in Kindcontainer becomes too burdensome. However, this should only happen at a time when using the respective Kubernetes version is no longer recommended.

Bring your own Docker registry

Accessing Docker images from public sources is often not straightforward, especially in corporate environments that rely on an internal Docker registry with manual or automated auditing. Kindcontainer allows developers to specify their own coordinates for the Docker images used for this purpose. However, because Kindcontainer still needs to know which Kubernetes version is being used due to potentially different initialization steps, these custom coordinates are appended to the respective Enum value:

@Testcontainers
public class CustomKubernetesImageTest {
@Container
KindContainer<?> container=new KindContainer<>(KindContainerVersion.VERSION_1_24_1.withImage(
“my-registry/kind:1.24.1”));
// Tests go here
}

In addition to the Kubernetes images themselves, Kindcontainer also uses several other Docker images. As already explained, command-line tools such as kubectl and helm are executed in their own containers. Appropriately, the Docker images required for these tools are configurable as well. Fortunately, no version-dependent code paths are needed for their execution. 

Therefore, the configuration shown in the following is simpler than in the case of the Kubernetes image:

@Testcontainers
public class CustomFluentApiImageTest {
@Container
KindContainer<?> container=new KindContainer<>()
.withKubectlImage(DockerImageName.parse(“my-registry/kubectl:1.21.9-debian-10-r10”))
.withHelm3Image(DockerImageName.parse(“my-registry/helm:3.7.2”));
// Tests go here
}

The coordinates of the images for all other containers started can also be easily chosen manually. However, it is always the developer’s responsibility to ensure the use of the same or at least compatible images. For this purpose, a complete list of the Docker images used and their versions can be found in the documentation of Kindcontainer on GitHub.

Admission controller webhooks

For the test scenarios shown so far, the communication direction is clear: A Kubernetes client running in the JVM accesses the locally or remotely running Kubernetes container over the network to communicate with the API server running inside it. Docker makes this standard case incredibly straightforward: A port is opened on the Docker container for the API server, making it accessible. 

Kindcontainer automatically performs the necessary configuration steps for this process and provides suitable connection information as Kubeconfig for the respective network configuration.

However, admission controller webhooks present a technically more challenging testing scenario. For these, the API server must be able to communicate with external webhooks via HTTPS when processing manifests. In our case, these webhooks typically run in the JVM where the test logic is executed. However, they may not be easily accessible from the Docker container.

To facilitate testing of these webhooks independently of the network setup, yet still make it simple, Kindcontainer employs a trick. In addition to the Kubernetes container itself, two more containers are started. An SSH server provides the ability to establish a tunnel from the test JVM into the Kubernetes container and set up reverse port forwarding, allowing the API server to communicate back to the JVM. 

Because Kubernetes requires TLS-secured communication with webhooks, an Nginx container is also started to handle TLS termination for the webhooks. Kindcontainer manages the administration of the required certificate material for this. 

The entire setup of processes, containers, and their network communication is illustrated in Figure 1.

Figure 1: Network setup for testing webhooks.

Fortunately, Kindcontainer hides this complexity behind an easy-to-use API:

@Testcontainers
public class WebhookTest {
@Container
ApiServerContainer<?> container=new ApiServerContainer<>().withAdmissionController(admission -> {
admission.mutating()
.withNewWebhook("mutating.example.com")
.atPort(webhookPort) // Local port of webhook
.withNewRule()
.withApiGroups("")
.withApiVersions("v1")
.withOperations("CREATE", "UPDATE")
.withResources("configmaps")
.withScope("Namespaced")
.endRule()
.endWebhook()
.build();
});

// Tests go here
}

The developer only needs to provide the port of the locally running webhook along with some necessary information for setting up in Kubernetes. Kindcontainer then automatically handles the configuration of SSH tunneling, TLS termination, and Kubernetes.

Consider Java

Starting from the simple example of a minimal JUnit test, we have shown how to test custom Kubernetes controllers and operators implemented in Java. We have explained how to use familiar command-line tools from the ecosystem with the help of Fluent APIs and how to easily execute integration tests even in restricted network environments. Finally, we have shown how even the technically challenging use case of testing admission controller webhooks can be implemented simply and conveniently with Kindcontainer. 

Thanks to these new testing possibilities, we hope more developers will consider Java as the language of choice for their Kubernetes-related projects in the future.

Learn more

Visit the Testcontainers website.

Get started with Testcontainers Cloud by creating a free account.

Get the latest release of Docker Desktop.

Vote on what’s next! Check out our public roadmap.

Have questions? The Docker community is here to help.

New to Docker? Get started.

Subscribe to the Docker Newsletter.

Quelle: https://blog.docker.com/feed/

Build Your Own AI-Driven Code Analysis Chatbot for Developers with the GenAI Stack

The topic of GenAI is everywhere now, but even with so much interest, many developers are still trying to understand what the real-world use cases are. Last year, Docker hosted an AI/ML Hackathon, and genuinely interesting projects were submitted. 

In this AI/ML Hackathon post, we will dive into a winning submission, Code Explorer, in the hope that it sparks project ideas for you. 

For developers, understanding and navigating codebases can be a constant challenge. Even popular AI assistant tools like ChatGPT can fail to understand the context of your projects through code access and struggle with complex logic or unique project requirements. Although large language models (LLMs) can be valuable companions during development, they may not always grasp the specific nuances of your codebase. This is where the need for a deeper understanding and additional resources comes in.

Imagine you’re working on a project that queries datasets for both cats and dogs. You already have functional code in DogQuery.py that retrieves dog data using pagination (a technique for fetching data in parts). Now, you want to update CatQuery.py to achieve the same functionality for cat data. Wouldn’t it be amazing if you could ask your AI assistant to reference the existing code in DogQuery.py and guide you through the modification process? 

This is where Code Explorer, an AI-powered chatbot comes in. 

What makes Code Explorer unique?

The following demo, which was submitted to the AI/ML Hackathon, provides an overview of Code Explorer (Figure 1).

Figure 1: Demo of the Code Explorer extension as submitted to the AI/ML Hackathon.

Code Explorer helps you find answers about your code by searching relevant information based on the programming language and folder location. Unlike chatbots, Code Explorer goes beyond generic coding knowledge. It leverages a powerful AI technique called retrieval-augmented generation (RAG) to understand your code’s specific context. This allows it to provide more relevant and accurate answers based on your actual project.

Code Explorer supports a variety of programming languages, such as *.swift, *.py, *.java, *.cs, etc. This tool can be useful for learning or debugging your code projects, such as Xcode projects, Android projects, AI applications, web dev, and more.

Benefits of the CodeExplorer include:

Effortless learning: Explore and understand your codebase more easily.

Efficient debugging: Troubleshoot issues faster by getting insights from your code itself.

Improved productivity: Spend less time deciphering code and more time building amazing things.

Supports various languages: Works with popular languages like Python, Java, Swift, C#, and more.

Use cases include:

Understanding complex logic: “Explain how the calculate_price function interacts with the get_discount function in billing.py.”

Debugging errors: “Why is my getUserData function in user.py returning an empty list?”

Learning from existing code: “How can I modify search.py to implement pagination similar to search_results.py?”

How does it work?

Code Explorer leverages the power of a RAG-based AI framework, providing context about your code to an existing LLM model. Figure 2 shows the magic behind the scenes.

Figure 2: Diagram of Code Explorer steps.

Step 1. Process documents

The user selects a codebase folder through the Streamlit app. The process_documents function in the file db.py is called. This function performs the following actions:

Parsing code: It reads and parses the code files within the selected folder. This involves using language-specific parsers (e.g., ast module for Python) to understand the code structure and syntax.

Extracting information: It extracts relevant information from the code, such as:

Variable names and their types

Function names, parameters, and return types

Class definitions and properties

Code comments and docstrings

Documents are loaded and chunked: It creates a RecursiveCharacterTextSplitter object based on the language. This object splits each document into smaller chunks of a specified size (5000 characters) with some overlap (500 characters) for better context.

Creating Neo4j vector store: It creates a Neo4j vector store, a type of database that stores and connects code elements using vectors. These vectors represent the relationships and similarities between different parts of the code.

Each code element (e.g., function, variable) is represented as a node in the Neo4j graph database.

Relationships between elements (e.g., function call, variable assignment) are represented as edges connecting the nodes.

Step 2. Create LLM chains

This step is triggered only after the codebase has been processed (Step 1).

Two LLM chains are created:

Create Documents QnA chain: This chain allows users to talk to the chatbot in a question-and-answer style. It will refer to the vector database when answering the coding question, referring to the source code files.

Create Agent chain: A separate Agent chain is created, which uses the QnA chain as a tool. You can think of it as an additional layer on top of the QnA chain that allows you to communicate with the chatbot more casually. Under the hood, the chatbot may ask the QnA chain if it needs help with the coding question, which is an AI discussing with another AI the user’s question before returning the final answer. In testing, the agent appears to summarize rather than give a technical response as opposed to the QA agent only.

Langchain is used to orchestrate the chatbot pipeline/flow.

Step 3. User asks questions and AI chatbot responds

The Streamlit app provides a chat interface for users to ask questions about their code. The user interacts with the Streamlit app’s chat interface, and user inputs are stored and used to query the LLM or the QA/Agent models. Based on the following factors, the app chooses how to answer the user:

Codebase processed:

Yes: The QA RAG chain is used if the user has selected Detailed mode in the sidebar. This mode leverages the processed codebase for in-depth answers.

Yes: A custom agent logic (using the get_agent function) is used if the user has selected Agent mode. This mode might provide more concise answers compared to the QA RAG model.

Codebase not processed:

The LLM chain is used directly if the user has not processed the codebase yet.

Getting started

To get started with Code Explorer, check the following:

Ensure that you have installed the latest version of Docker Desktop.

Ensure that you have Ollama running locally.

Then, complete the four steps explained below.

1. Clone the repository

Open a terminal window and run the following command to clone the sample application.

https://github.com/dockersamples/CodeExplorer

You should now have the following files in your CodeExplorer directory:

tree
.
├── LICENSE
├── README.md
├── agent.py
├── bot.Dockerfile
├── bot.py
├── chains.py
├── db.py
├── docker-compose.yml
├── images
│ ├── app.png
│ └── diagram.png
├── pull_model.Dockerfile
├── requirements.txt
└── utils.py

2 directories, 13 files

2. Create environment variables
Before running the GenAI stack services, open the .env and modify the following variables according to your needs. This file stores environment variables that influence your application’s behavior.

OPENAI_API_KEY=sk-XXXXX
LLM=codellama:7b-instruct
OLLAMA_BASE_URL=http://host.docker.internal:11434
NEO4J_URI=neo4j://database:7687
NEO4J_USERNAME=neo4j
NEO4J_PASSWORD=XXXX
EMBEDDING_MODEL=ollama
LANGCHAIN_ENDPOINT="https://api.smith.langchain.com"
LANGCHAIN_TRACING_V2=true # false
LANGCHAIN_PROJECT=default
LANGCHAIN_API_KEY=ls__cbaXXXXXXXX06dd

Note:

If using EMBEDDING_MODEL=sentence_transformer, uncomment code in requirements.txt and chains.py. It was commented out to reduce code size.

Make sure to set the OLLAMA_BASE_URL=http://llm:11434 in the .env file when using the Ollama Docker container. If you’re running on Mac, set OLLAMA_BASE_URL=http://host.docker.internal:11434 instead.

3. Build and run Docker GenAI services
Run the following command to build and bring up Docker Compose services:

docker compose –profile linux up –build

This gets the following output:

+] Running 5/5
✔ Network codeexplorer_net Created 0.0s
✔ Container codeexplorer-database-1 Created 0.1s
✔ Container codeexplorer-llm-1 Created 0.1s
✔ Container codeexplorer-pull-model-1 Created 0.1s
✔ Container codeexplorer-bot-1 Created 0.1s
Attaching to bot-1, database-1, llm-1, pull-model-1
llm-1 | Couldn't find '/root/.ollama/id_ed25519'. Generating new private key.
llm-1 | Your new public key is:
llm-1 |
llm-1 | ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGEM2BIxSSje6NFssxK7J1+X+46n+cWTQufEQjMUzLGC
llm-1 |
llm-1 | 2024/05/23 15:05:47 routes.go:1008: INFO server config env="map[OLLAMA_DEBUG:false OLLAMA_LLM_LIBRARY: OLLAMA_MAX_LOADED_MODELS:1 OLLAMA_MAX_QUEUE:512 OLLAMA_MAX_VRAM:0 OLLAMA_NOPRUNE:false OLLAMA_NUM_PARALLEL:1 OLLAMA_ORIGINS:[http://localhost https://localhost http://localhost:* https://localhost:* http://127.0.0.1 https://127.0.0.1 http://127.0.0.1:* https://127.0.0.1:* http://0.0.0.0 https://0.0.0.0 http://0.0.0.0:* https://0.0.0.0:*] OLLAMA_RUNNERS_DIR: OLLAMA_TMPDIR:]"
llm-1 | time=2024-05-23T15:05:47.265Z level=INFO source=images.go:704 msg="total blobs: 0"
llm-1 | time=2024-05-23T15:05:47.265Z level=INFO source=images.go:711 msg="total unused blobs removed: 0"
llm-1 | time=2024-05-23T15:05:47.265Z level=INFO source=routes.go:1054 msg="Listening on [::]:11434 (version 0.1.38)"
llm-1 | time=2024-05-23T15:05:47.266Z level=INFO source=payload.go:30 msg="extracting embedded files" dir=/tmp/ollama2106292006/runners
pull-model-1 | pulling ollama model codellama:7b-instruct using http://host.docker.internal:11434
database-1 | Installing Plugin 'apoc' from /var/lib/neo4j/labs/apoc-*-core.jar to /var/lib/neo4j/plugins/apoc.jar
database-1 | Applying default values for plugin apoc to neo4j.conf
pulling manifest
pull-model-1 | pulling 3a43f93b78ec… 100% ▕████████████████▏ 3.8 GB
pulling manifest
pulling manifest
pull-model-1 | pulling 3a43f93b78ec… 100% ▕████████████████▏ 3.8 GB
pull-model-1 | pulling 8c17c2ebb0ea… 100% ▕████████████████▏ 7.0 KB
pull-model-1 | pulling 590d74a5569b… 100% ▕████████████████▏ 4.8 KB
pull-model-1 | pulling 2e0493f67d0c… 100% ▕████████████████▏ 59 B
pull-model-1 | pulling 7f6a57943a88… 100% ▕████████████████▏ 120 B
pull-model-1 | pulling 316526ac7323… 100% ▕████████████████▏ 529 B
pull-model-1 | verifying sha256 digest
pull-model-1 | writing manifest
pull-model-1 | removing any unused layers
pull-model-1 | success
llm-1 | time=2024-05-23T15:05:52.802Z level=INFO source=payload.go:44 msg="Dynamic LLM libraries [cpu cuda_v11]"
llm-1 | time=2024-05-23T15:05:52.806Z level=INFO source=types.go:71 msg="inference compute" id=0 library=cpu compute="" driver=0.0 name="" total="7.7 GiB" available="2.5 GiB"
pull-model-1 exited with code 0
database-1 | 2024-05-23 15:05:53.411+0000 INFO Starting…
database-1 | 2024-05-23 15:05:53.933+0000 INFO This instance is ServerId{ddce4389} (ddce4389-d9fd-4d98-9116-affa229ad5c5)
database-1 | 2024-05-23 15:05:54.431+0000 INFO ======== Neo4j 5.11.0 ========
database-1 | 2024-05-23 15:05:58.048+0000 INFO Bolt enabled on 0.0.0.0:7687.
database-1 | [main] INFO org.eclipse.jetty.server.Server – jetty-10.0.15; built: 2023-04-11T17:25:14.480Z; git: 68017dbd00236bb7e187330d7585a059610f661d; jvm 17.0.8.1+1
database-1 | [main] INFO org.eclipse.jetty.server.handler.ContextHandler – Started o.e.j.s.h.MovedContextHandler@7c007713{/,null,AVAILABLE}
database-1 | [main] INFO org.eclipse.jetty.server.session.DefaultSessionIdManager – Session workerName=node0
database-1 | [main] INFO org.eclipse.jetty.server.handler.ContextHandler – Started o.e.j.s.ServletContextHandler@5bd5ace9{/db,null,AVAILABLE}
database-1 | [main] INFO org.eclipse.jetty.webapp.StandardDescriptorProcessor – NO JSP Support for /browser, did not find org.eclipse.jetty.jsp.JettyJspServlet
database-1 | [main] INFO org.eclipse.jetty.server.handler.ContextHandler – Started o.e.j.w.WebAppContext@38f183e9{/browser,jar:file:/var/lib/neo4j/lib/neo4j-browser-5.11.0.jar!/browser,AVAILABLE}
database-1 | [main] INFO org.eclipse.jetty.server.handler.ContextHandler – Started o.e.j.s.ServletContextHandler@769580de{/,null,AVAILABLE}
database-1 | [main] INFO org.eclipse.jetty.server.AbstractConnector – Started http@6bd87866{HTTP/1.1, (http/1.1)}{0.0.0.0:7474}
database-1 | [main] INFO org.eclipse.jetty.server.Server – Started Server@60171a27{STARTING}[10.0.15,sto=0] @5997ms
database-1 | 2024-05-23 15:05:58.619+0000 INFO Remote interface available at http://localhost:7474/
database-1 | 2024-05-23 15:05:58.621+0000 INFO id: F2936F8E5116E0229C97F43AD52142685F388BE889D34E000D35E074D612BE37
database-1 | 2024-05-23 15:05:58.621+0000 INFO name: system
database-1 | 2024-05-23 15:05:58.621+0000 INFO creationDate: 2024-05-23T12:47:52.888Z
database-1 | 2024-05-23 15:05:58.622+0000 INFO Started.

The logs indicate that the application has successfully started all its components, including the LLM, Neo4j database, and the main application container. You should now be able to interact with the application through the user interface.

You can view the services via the Docker Desktop dashboard (Figure 3).

Figure 3: The Docker Desktop dashboard showing the running Code Explorer powered with GenAI stack.

The Code Explorer stack consists of the following services:

Bot

The bot service is the core application. 

Built with Streamlit, it provides the user interface through a web browser. The build section uses a Dockerfile named bot.Dockerfile to build a custom image, containing your Streamlit application code. 

This service exposes port 8501, which makes the bot UI accessible through a web browser.

Pull model

This service downloads the codellama:7b-instruct model. 

The model is based on the Llama2 model, which achieves similar performance to OpenAI’s LLM but is trained with additional code context. 

However, codellama:7b-instruct is additionally trained on code-related contexts and fine-tuned to understand and respond in human language. 

This specialization makes it particularly adept at handling questions about code.

Note: You may notice that pull-model-1 service exits with code 0, which indicates successful execution. This service is designed just to download the LLM model (codellama:7b-instruct). Once the download is complete, there’s no further need for this service to remain running. Exiting with code 0 signifies that the service finished its task successfully (downloading the model).

Database

This service manages a Neo4j graph database.

It efficiently stores and retrieves vector embeddings, which represent the code files in a mathematical format suitable for analysis by the LLM model.

The Neo4j vector database can be explored at http://localhost:7474 (Figure 4).

Figure 4: Neo4j database information.

LLM

This service acts as the LLM host, utilizing the Ollama framework. 

It manages the downloaded LLM model (not the embedding), making it accessible for use by the bot application.

4. Access the application
You can now view your Streamlit app in your browser by accessing http://localhost:8501 (Figure 5).

Figure 5: View the app.

In the sidebar, enter the path to your code folder and select Process files (Figure 6). Then, you can start asking questions about your code in the main chat.

Figure 6: The app is running.

You will find a toggle switch in the sidebar. By default Detailed mode is enabled. Under this mode, the QA RAG chain chain is used (detailedMode=true) . This mode leverages the processed codebase for in-depth answers. 

When you toggle the switch to another mode (detailedMode=false), the Agent chain gets selected. This is similar to how one AI discusses with another AI to create the final answer. In testing, the agent appears to summarize rather than a technical response as opposed to the QA agent only.

Here’s a result when detailedMode=true (Figure 7):

Figure 7: Result when detailedMode=true.

Figure 8 shows a result when detailedMode=false:

Figure 8: Result when detailedMode=false.

Start exploring

Code Explorer, powered by the GenAI Stack, offers a compelling solution for developers seeking AI assistance with coding. This chatbot leverages RAG to delve into your codebase, providing insightful answers to your specific questions. Docker containers ensure smooth operation, while Langchain orchestrates the workflow. Neo4j stores code representations for efficient analysis. 

Explore Code Explorer and the GenAI Stack to unlock the potential of AI in your development journey!

Learn more

Subscribe to the Docker Newsletter.

Get the latest release of Docker Desktop.

Vote on what’s next! Check out our public roadmap.

Have questions? The Docker community is here to help.

New to Docker? Get started.

Quelle: https://blog.docker.com/feed/

Unlock AI innovation with new joint capabilities from Microsoft and SAP

Microsoft and SAP have been partners and customers of each other for over 30 years, collaborating on innovative business solutions and helping thousands of joint customers accelerate their business transformation. Microsoft Cloud is the market leader for running SAP workloads in the cloud, including RISE with SAP, and today at SAP Sapphire 2024, we are very excited to bring more amazing innovation to the market for our joint customers. 

In this blog, we explore the most recent exciting developments from the Microsoft and SAP partnership and how they help customers accelerate their business transformation. 

SAP on Microsoft Cloud

Innovate with the most trusted cloud for SAP

Discover solutions

Announcing new joint AI integration between Microsoft 365 Copilot and SAP Joule

Today at SAP Sapphire, Microsoft and SAP are expanding our partnership by bringing Joule together with Microsoft Copilot into a unified experience, allowing employees to get more done in the flow of their work through seamless access to information from business applications in SAP as well as Microsoft 365.  

Customers want AI assistants to carry out requests regardless of data location or the system that needs to be accessed. By integrating Joule and Copilot for Microsoft 365, the generative AI solutions will interact intuitively so users can find information faster and execute tasks without leaving the platform they are already in. 

A user in Copilot for Microsoft 365 will be able to leverage SAP Joule to access information stored in SAP—for example S/4HANA Cloud, SAP SuccessFactors, or SAP Concur. Similarly, someone using SAP Joule in a SAP application will be able to use Copilot for Microsoft 365 capabilities without context switching.

To see this in action, tune into the “Innovation: The key to bringing out your best” keynote at SAP Sapphire which will also be available on-demand and read the announcement blog. 

Unlock business transformation with Microsoft AI and RISE with SAP

SAP systems host mission-critical data powering core business processes and can greatly benefit from the insights, automation, and efficiencies unlocked by AI. Microsoft Cloud—the most trusted, comprehensive and integrated cloud—is best positioned to help you achieve these benefits. You can extend RISE with SAP by using a broad set of Microsoft AI services to maximize business outcomes, catered to your business needs: 

1: Unlocking joint AI innovation with SAP Business Technology Platform (BTP) and Microsoft Azure: SAP BTP is a platform offering from SAP that maximizes the value of the RISE with SAP offering. We recently partnered with SAP to announce the availability of SAP AI Core, an integral part of BTP, including Generative AI Hub and Joule on Microsoft Azure in West Europe, US East, and Sydney. Customers that use BTP and want to embed more intelligence into their finance, supply chain, and order to cash business processes can now do so easily, on Azure. SAP customers can also take advantage of the most popular large language models like GPT-4o available in SAP Generative AI Hub offered only on Azure through the Azure OpenAI Service.

2: Unlocking end-user productivity with Microsoft Copilot: SAP customers can use Copilot for Microsoft 365, available in Microsoft Word, PowerPoint, Excel, and PowerBI so that end-users can unlock insights, and perform tasks faster. You can go one step further by tailoring Copilot to work the way you need, with your data, processes and policies using the SAP plugin in Microsoft Copilot Studio. You can now customize Copilot to connect to your SAP systems and retrieve the information you need such as expense information, inventory, and so on. This is made possible with new Copilot connectors and new agent capabilities that we announced at Microsoft Build last week. 

3: Enabling AI transformation using Azure AI services: SAP customers running their workloads on Azure can build their own AI capabilities using the Azure OpenAI Service with their SAP data to quickly develop generative AI applications. We offer over 1,600 frontier and open models in Azure AI, including the latest from OpenAI, Meta, and others—providing you with the choice and flexibility to choose the model suited for your use case. More than 50,000 customers use Azure AI today, signaling the amazing momentum in this space. 

A powerful productivity enhancement use case here is the combination of OpenAI, along with business process automation tools like the Microsoft Power Platform which has SAP connectors available to help a user interact with SAP data easily and complete tasks faster. 

For example, a sales assistant can access SAP data to place product orders, directly from Microsoft Teams, leveraging the power of Azure OpenAI. Watch this video to see this scenario in action. 

RISE with SAP customers can also consume OpenAI services through Cloud Application programming model (CAP) and SAP BTP, AI Core. 

4: Automatic attack disruption for SAP, powered by AI: Microsoft Security Copilot empowers all security and IT roles to detect and address cyberthreats at machine speed, including those arising from SAP systems. For customers using Microsoft Sentinel for SAP, which is certified for RISE with SAP, attack disruption will automatically detect financial fraud techniques and disable the native SAP and connected Microsoft Entra account to prevent the cyberattacker from transferring any funds–with no additional intervention. See this video to learn more and read more about automatic attack disruption for SAP. 

More choice and flexibility with expanded availability of SAP BTP on Azure 

Together with SAP, we recently announced the expanded availability of SAP BTP to six new Azure regions (Brazil, Canada, India, the United Kingdom, Germany, and one to be announced) as well as additional BTP services in the existing seven public Microsoft Azure regions (Australia, Netherlands, Japan, Singapore, Switzerland, the United States East-VA, and the United States West-WA.) Upon completion, SAP Business Technology Platform will run in 13 Microsoft Azure regions, and all the key BTP services that most customers are asking for, will be available on Azure.

The expanded service availability, based on customer demand, unlocks AI innovation and business transformation for customers more easily, as you can now integrate SAP Cloud enterprise resource planning (ERP) and SAP BTP services with Microsoft Azure services, including AI services from both companies, within the same data center region.  

New and powerful infrastructure options for running SAP HANA on Azure

Last year we announced the Azure M-Series Mv3 family—the next generation of memory optimized virtual machines, giving customers faster insights, more uptime, a lower total cost of ownership, and improved price-performance for running SAP HANA workloads with Azure IaaS deployments and SAP RISE on Azure. These VMs, supporting up to 32 TB of memory, are powered by the 4th generation Intel® Xeon® Scalable processors and Azure Boost, one of Azure’s latest infrastructure innovations.  

Today, we are pleased to build on this investment and share that the Mv3 Very High Memory (up to 32TB of memory) offering is generally available for customers and the Mv3 High Memory offering (upto 16TB) is in preview.

Microsoft and SAP Signavio: Teaming up to accelerate transformation

Microsoft and SAP continue to collaborate to help customers in their journey to S/4HANA and RISE on Azure. SAP Signavio Process Insights is an integral part of SAP’s cloud-based process transformation suite and gives companies the ability to rapidly discover areas for improvement and automation within your SAP business processes. SAP Signavio Process Insights is now available on Microsoft Azure and provides ECC customers an accelerated path to S/4HANA, allowing customers to unlock the value of innovation through the Microsoft platform. 

Simplifying business collaboration with new integrations in Microsoft Teams 

Microsoft and SAP have been working together for several years enabling organizations and their employees improve productivity through collaborative experiences that combine mission critical data from SAP with Microsoft Teams and Microsoft 365.

Today, we are excited to build on this and announce new joint capabilities with exciting updates to Microsoft Teams apps for SAP S/4HANA, SAP SuccessFactors and, SAP Concur:

Upcoming features in S/4HANA app for Microsoft Teams

S/4HANA Copilot plugin: Users can access S/4HANA sales details, order status, sales quotes, and more using natural language with Copilot for Microsoft 365. See a sample query below: 

Adaptive Card Loop components: Share intelligent cards in Teams and Outlook (available for pre-release users only). 

Teams search-based message extension: Users can quickly search for and insert information from S/4HANA without leaving the Teams environment.  

SAP Community search: Search SAP Community and share content with co-workers in Microsoft Teams—without having to leave the app. While chatting with a colleague or a group, click on the three dots below the text field, open the SAP S/4HANA app, and enter your search term in the popup window. From the results list, pick the topic you want to share and directly send it to your colleagues. 

Share to Microsoft Teams as Card: Communicate better with your co-workers using Microsoft Teams by providing a collaborative view that shows application content in a new window and enables you to have a meaningful conversation. 

Access S/4HANA within Microsoft 365 Home and Outlook too:

New release: SuccessFactors for Microsoft Teams

HR Task Reminders through Teams Chatbot: Receive a private message from the SuccessFactors Teams chatbot, which can help you complete HR tasks directly in Teams or guide you to SuccessFactors online for more complex workloads. 

Trigger Quick Actions through Commands: Request and provide feedback to your colleagues, manage time entries, view learning assignments and approvals, access employee and manager self-services, and much more!  

Coming soon: New SuccessFactors Dashboard in Teams tab. 

Coming soon: Concur Travel and Expense

Users will be to able to share travel itineraries and expense reports with colleagues in Microsoft Teams. This app will be released later this summer. 

Microsoft and SAP collaborate to modernize identity for SAP customers 

Earlier this year, we announced that we are collaborating with SAP to develop a solution that enables customers to migrate their identity management scenarios from SAP Identity Management (IDM) to Microsoft Entra ID. We’re excited to announce that guidance for this migration will be available soon.

Driving joint customer success 

It’s super exciting to see all the product innovation that will ultimately drive success and business outcomes for customers. Microsoft was one of the early adopters of RISE with SAP internally, and is proud to have helped thousands of customers accelerate their business transformation to RISE with SAP with the power of the Microsoft Cloud. 

Construction industry supplier Hilti Group migrated its massive SAP landscape to RISE with SAP on Microsoft Azure, accelerating their continuous innovation roadmap. In parallel, it upgraded from a 12-terabyte to a 24-terabyte SAP S/4HANA ERP application and is about to shut down its on-premises datacenter to make Azure its sole platform. Hilti wanted to be one of the first adopters of the RISE with SAP offering, which brings project management, technical migration, and premium engagement services together in a single contract. The accelerated, on-demand business transformation solution was the perfect match to help evolve the company’s massive SAP landscape, which serves as the backbone of the company’s transactional business.

“RISE with SAP on Azure helped us move our experts and resources into areas where they can add the most value, which was a game-changer.” 
Dr. Christoph Baeck, Head of IT Platforms, Hilti Group

Tokyo-based steel manufacturer, JFE Steel Corporation wanted to upgrade it’s on-premises SAP systems to a hybrid cloud strategy to pursue better digital experiences. The company chose S/4 HANA Cloud private edition—which provides the SAP SaaS solution, RISE, in a private cloud environment, and Microsoft Azure was chosen as the foundation for this. They achieved the migration of their SAP system to the cloud in just seven months and are also driving further innovation with the Microsoft Power Platform. 

“We considered on-premises and various cloud services based on the three axes of quality, cost, and turnaround time. Azure was the first choice because we had confidence in its quality, and we had accumulated know-how in the company. We also actively use Microsoft Power Platform and other products, and we appreciated the high degree of affinity and integration between the products.” 
Mr. Etsuo Kasuya, JFE Systems, Inc. Tokyo Office Business Management System Development Department Accounting Group

Australian mining and metals company South32 set its goal of transitioning its more than 100 terabyte data landscape into a fit-for-purpose ERP system. South32 seamlessly completed phase one of its SAP migration to Azure, achieving consolidation and simplification of its estate and building a scalable, easy to manage system environment using SAP S/4HANA with RISE on Azure by working with SAP, Microsoft and key partner TCS. 

“Now that we’ve moved our SAP landscape to Azure, we have more breadth of coverage. Our environments are standardized, which provides our infrastructure team with much better tools to manage consumption and give us transparency around costs.” 
Stuart Munday, Group Manager, ERP, South32 

Learn more 

Microsoft and SAP are committed to continuing our partnership to serve our joint customers and enable their growth and transformation as well as unlock innovation for them in the era of AI. There are several ways you can learn more and engage with us: 

Visit us at SAP Sapphire this week: If you are at SAP Sapphire this week in Orlando or the next week in Barcelona, visit the Microsoft Booth to learn about the exciting announcements. Also, for the latest product updates from Sapphire, check out our engineering blog.   

Learn more on our website: To learn more about why the Microsoft Cloud is the leading cloud platform for SAP workloads, including RISE with SAP, visit our website. 

Read more about how customers are unlocking AI innovation and business transformation with SAP and the Microsoft Cloud. 

Migration offers and incentives: Beyond the announcements we are making today, we also offer programs, and incentives so you can make your migration decisions with confidence The Azure Migrate and Modernize offering gives you guidance, expert help, and funding to streamline your move to Azure for SAP workloads, including RISE with SAP.   

Skilling: Business leaders often share with us that skilling for their teams is top of mind so that the organization can better prepare itself for the cloud journey. We offer several online learning paths as well as instructor-led offerings so you can maximize the value of your migration to the cloud—learn more. 

The post Unlock AI innovation with new joint capabilities from Microsoft and SAP appeared first on Azure Blog.
Quelle: Azure