ibm-swift-sample

by Helm

Helm chartv1.1.2Apache-2.0

A Swift sample application.

About this chart

Swift sample Helm Chart

This sample is for demonstrative purposes only and is NOT for production use.

Introduction

This Helm Chart deploys a sample Swift application running a simple Kitura server.

Chart Details

The sample is created using Kitura, a high performance and simple to use web framework for building Swift applications. See kitura.io for information on Kitura including more samples, tutorials and blog posts.

It includes a health check endpoint accessible on /health and the ability to monitor the application's metrics on the /metrics endpoint.

Prerequisites

Resources Required

The Swift sample app will run successfully with the default configuration values for memory and cpu. These may need to be increased if you use this sample to build your own application.

Installing the chart

The sample can be installed in the following ways:

  • Via the ibm-charts repository by running the following commands:
helm repo add ibm-charts https://raw.githubusercontent.com/IBM/charts/master/repo/stable/
helm install --name sample ibm-charts/ibm-swift-sample
  • From the directory containing Chart.yaml by running:
helm install --name "name" .

where "name" is what you wish to call your release.

Verifying the chart

You can view the deployed Swift sample in your web browser. To retrieve the IP and port, paste the following into a terminal window:

export SAMPLE_SWIFT_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
export SAMPLE_SWIFT_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ template "fullname" . }})
echo "Open your web browser at http://${SAMPLE_SWIFT_IP}:${SAMPLE_SWIFT_PORT} to view the sample."

Uninstalling the Chart

If you installed using helm install --name "name" ., you can remove the sample with helm delete --purge "name". You can find the deployment with helm list --all and searching for an entry with the chart name "ibm-swift-sample".

Testing the Chart with Helm

You can programatically run the test in the following ways.

  • cd chart/ibm-swift-sample then do ./test-chart.sh OR
  • helm test "name", replacing "name" with whatever you named your deployment.

Configuration

The following table lists the configurable parameters of the ibm-swift-sample chart and their default values.

ParameterDescriptionDefault
replicaCountHow many pods to deploy1
revisionHistoryLimitOptional field that specifies the number of old ReplicaSets to retain to allow rollback1
image.repositoryimage repositoryibmcom/icp-swift-sample
image.tagImage taglatest
image.pullPolicyImage pull policyAlways
livenessProbe.initialDelaySecondsHow long to wait before beginning the checks our pod(s) are up30
livenessProbe.periodSecondsThe interval at which we'll check if a pod is running OK before being restarted10
service.namek8s service nameSwift
service.typek8s service type exposing portNodePort
service.servicePortTCP Port for this service8080
resources.limits.memoryMemory resource limits128m
resources.limits.cpuCPU resource limits100m

Limitations

This sample is for demonstrative purposes only and is not recommended for production use. As such, you will only be able to deploy one instance of the sample per namespace.

Deploy ibm-swift-sample with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has ibm-swift-sample on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.

  1. Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
  2. Place the chartibm-swift-sample is pinned at v1.1.2 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
  3. ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below
opentenant validate opentenant.yaml
terraform init && terraform apply