Skip to content

Commit

Permalink
Merge pull request #140 from johnmcollier/supportedcompshas
Browse files Browse the repository at this point in the history
Add document outlining supported components in HAS
  • Loading branch information
ralphbean authored Sep 29, 2023
2 parents 75a6606 + 3e17bf6 commit 94a7520
Show file tree
Hide file tree
Showing 2 changed files with 92 additions and 0 deletions.
19 changes: 19 additions & 0 deletions book/HAS/OWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# See the OWNERS docs: https://go.k8s.io/owners

approvers:
- elsony
- johnmcollier
- kim-tsao
- maysunfaisal
- michael-valdron
- thepetk
- yangcao77

reviewers:
- elsony
- johnmcollier
- kim-tsao
- maysunfaisal
- michael-valdron
- thepetk
- yangcao77
73 changes: 73 additions & 0 deletions book/HAS/component-types.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# HAS Component Types

HAS supports a variety of user repositories for Components. User repositories can contain just a single component, or it may contain multiple components.

## Supported Runtimes

The following runtimes are supported by AppStudio:
- NodeJS
- Springboot
- Quarkus
- Python
- Go

Repositories with components that are not one of the supported runtime types, can still be imported into AppStudio, if the following conditions are met:
1) The Component has a Dockerfile present
2) The Dockerfile can be detected
3) **If** a Devfile is present, the Devfile contains references for valid Kubernetes and Dockerfile components. See [below](#devfile-requirements) for specific Devfile requirements

These Components will be listed as having a “Dockerfile” runtime.


## Detecting Components

Before a repository is added to an Application in AppStudio, if no Devfiles or Dockerfiles were specified for the Component resource, HAS will use alizer to attempt to detect the components that exist within the repository. Each component that corresponds to a supported runtime type (or Dockerfile type), will be detected.

If a runtime exists at the top level of the repository, HAS will treat the repository as a single component, and will not attempt to detect components below that level.

## Runtime-Specific Requirements

Some runtime types may have specific requirements in order to be detected by HAS:

Quarkus
- If a .dockerignore file is present, make sure that a wildcard, *, entry is not present, as AppStudio builds the application source as part of the Container build

Python
- Pip is used to manage dependencies for AppStudio Python projects. Make sure that your project has a requirements.txt at the root

NodeJS
- HAS expects NodeJS based components to have a package.json at the component's base folder

## Devfile Requirements

As mentioned before, if a Devfile is present in a Component, it must be valid in order to be detected:

1) The Devfile must contain an "image component" referencing the Dockerfile that will build the application. For example:
```yaml
components:
- name: image-build
image:
imageName: java-quarkus-image:latest
dockerfile:
uri: src/main/docker/Dockerfile.jvm.staged
buildContext: .
rootRequired: false
```
2) The Devfile must contain a "Kubernetes component" referencing the deployment artifacts for your component:
```yaml
components:
- name: kubernetes-deploy
attributes:
deployment/replicas: 1
deployment/cpuRequest: 10m
deployment/memoryRequest: 10Mi
deployment/container-port: 8081
kubernetes:
uri: deploy.yaml
endpoints:
- name: http-8081
targetPort: 8081
path: /
```
An example of a valid devfile can be found [here](https://github.com/devfile-samples/devfile-sample-go-basic/blob/main/devfile.yaml)

0 comments on commit 94a7520

Please sign in to comment.