dotnet

by joaquinito2051

Helm chartv0.0.2

A Helm chart to build and deploy .NET applications

About this chart

.NET Helm Chart

A Helm chart for building and deploying a .NET application on OpenShift.

Prerequisites

Below are prerequisites that may apply to your use case.

Pull Secret

You will need to create a pull secret if you pull an S2I builder from an external registry. Use the following command as a reference to create your pull secret:

oc create secret docker-registry my-pull-secret --docker-server=$SERVER_URL --docker-username=$USERNAME --docker-password=$PASSWORD --docker-email=$EMAIL

You can use this secret by passing --set build.pullSecret=my-pull-secret to helm install, or you can configure this in a values file:

build:
  pullSecret: my-pull-secret

and apply by passing --values $VALUES_FILE.

Push Secret

You will need to create a push secret if you want to push your image to an external registry. Use the following command as a reference to create your push secret:

oc create secret docker-registry my-push-secret --docker-server=$SERVER_URL --docker-username=$USERNAME --docker-password=$PASSWORD --docker-email=$EMAIL

You can use this secret by passing --set build.output.pushSecret=my-push-secret and --set build.output.kind=DockerImage to helm install, or you can configure these in a values file:

build:
  output:
    kind: DockerImage
    pushSecret: my-push-secret

Values

Below is a table of each value used to configure this chart.

You must change the build.uri, build.ref and build.startupProject to refer to your own application. build.imageStreamTag.name must be set to match the .NET version used by your application.

ValueDescriptionDefaultAdditional Information
image.nameName of the image you want to build/deployDefaults to the Helm release name.The chart will create/reference an ImageStream based on this value.
image.tagTag that you want to build/deploylatestThe chart will create/reference an ImageStreamTag based on the name provided
build.enabledDetermines if build-related resources should be created.trueSet this to false if you want to deploy a previously built image. Leave this set to true if you want to build and deploy a new image.
build.uriGit URI that references your git repohttps://github.com/redhat-developer/s2i-dotnetcore-exThis value defaults to a sample application. Be sure to override this if you want to build and deploy your own application.
build.refGit ref containing the application you want to builddotnet-8.0This value defaults to the sample application branch. Be sure to override this if you want to build and deploy your own application.
build.startupProjectPath to the project to run. This can refer to a project file (e.g. csproj), or a directory containing a single project.appThis value defaults to the sample application project. Be sure to override this if you want to build and deploy your own application.
build.contextDirThe sub-directory where the application source code exists--
build.imageStreamTag.nameThe ImageStreamTag name of the desired builder imagedotnet:8.0This value defaults to the .NET version of the sample application. Be sure to use the tag that matches the version of .NET your application targets.
build.imageStreamTag.useReleaseNamespaceDetermines if the builder ImageStreamTag referenced by build.imageStreamTag.name is in the same namespace you are installing this Helm chart tofalse-
build.imageStreamTag.namespaceWhen useReleaseNamespace is false, determines the namespace containing the builder ImageStreamTag.openshift-
build.output.kindDetermines if the image will be pushed to an ImageStreamTag or a DockerImage (external registry)ImageStreamTagMore information: More information: https://docs.openshift.com/container-platform/4.6/builds/managing-build-output.html
build.output.pushSecretPush secret name-Used only if build.output.kind == 'DockerImage'
build.pullSecretImage pull secret-More information: https://docs.openshift.com/container-platform/4.6/openshift_images/managing_images/using-image-pull-secrets.html
build.envFreeform env stanza-More information: https://kubernetes.io/docs/tasks/inject-data-application/define-environment-variable-container/
build.resourcesFreeform resources stanza-More information: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
deploy.replicasNumber of pod replicas to deploy1-
deploy.resourcesFreeform resources stanza-More information: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
deploy.serviceTypeType of service to createClusterIPMore information: https://kubernetes.io/docs/concepts/services-networking/service/#publishing-services-service-types
deploy.portsFreeform service ports stanza.See values.yamlMore information: https://kubernetes.io/docs/concepts/services-networking/service/#defining-a-service
deploy.route.enabledDetermines if a Route should be createdtrueAllows clients outside of OpenShift to access your application
deploy.route.targetPortThe port that the Route should target traffic tohttp-
deploy.route.tls.enabledDetermines if the Route should be TLS-encryptedtrueMore information: https://docs.openshift.com/container-platform/4.6/networking/routes/secured-routes.html
deploy.route.tls.terminationDetermines the type of TLS termination to useedgeOptions: edge, reencrypt, passthrough
deploy.route.tls.insecureEdgeTerminationPolicyDetermines if insecure traffic should be redirectedRedirectOptions: "Allow", "Disable", "Redirect"
deploy.route.tls.keyProvides key file contents-This is a secret. Do not check this value into git.
deploy.route.tls.caCertificateProvides the cert authority certificate contents--
deploy.route.tls.certificateProvides certificate contents--
deploy.route.tls.destinationCACertificateProvides the destination CA Certificate for reencrypt routes--
deploy.livenessProbeFreeform livenessProbe stanza.See values.yamlMore information: https://docs.openshift.com/container-platform/4.6/applications/application-health.html#application-health-about_application-health
deploy.readinessProbeFreeform readinessProbe stanza.See values.yamlMore information: https://docs.openshift.com/container-platform/4.6/applications/application-health.html#application-health-about_application-health
deploy.envFreeform env stanza-More information: https://kubernetes.io/docs/tasks/inject-data-application/define-environment-variable-container/
deploy.envFromFreeform envFrom stanza-More information: https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/#configure-all-key-value-pairs-in-a-configmap-as-container-environment-variables
deploy.applicationProperties.enabledDetermines if application properties should be externalized in a ConfigMapfalse-
deploy.applicationProperties.mountPathLocation to mount the application.properties file/deployments/config/-
deploy.applicationProperties.propertiesThe application.properties file contents--
deploy.volumeMountsFreeform volume mounts-More information: https://kubernetes.io/docs/concepts/storage/volumes/
deploy.volumesFreeform volumes-More information: https://kubernetes.io/docs/concepts/storage/volumes/
deploy.initContainersFreeform init containers-More information: https://kubernetes.io/docs/concepts/workloads/pods/init-containers/
deploy.extraContainersFreeform containers-More information: https://kubernetes.io/docs/concepts/workloads/pods/#pod-templates
global.nameOverrideOverrides the release name-Resources are named after the release name. Set this value if you want to override the release name.

Deploy dotnet with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has dotnet 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 chartdotnet is pinned at v0.0.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