dotnet
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.
| Value | Description | Default | Additional Information |
|---|---|---|---|
image.name | Name of the image you want to build/deploy | Defaults to the Helm release name. | The chart will create/reference an ImageStream based on this value. |
image.tag | Tag that you want to build/deploy | latest | The chart will create/reference an ImageStreamTag based on the name provided |
build.enabled | Determines if build-related resources should be created. | true | Set 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.uri | Git URI that references your git repo | https://github.com/redhat-developer/s2i-dotnetcore-ex | This value defaults to a sample application. Be sure to override this if you want to build and deploy your own application. |
build.ref | Git ref containing the application you want to build | dotnet-8.0 | This value defaults to the sample application branch. Be sure to override this if you want to build and deploy your own application. |
build.startupProject | Path to the project to run. This can refer to a project file (e.g. csproj), or a directory containing a single project. | app | This value defaults to the sample application project. Be sure to override this if you want to build and deploy your own application. |
build.contextDir | The sub-directory where the application source code exists | - | - |
build.imageStreamTag.name | The ImageStreamTag name of the desired builder image | dotnet:8.0 | This 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.useReleaseNamespace | Determines if the builder ImageStreamTag referenced by build.imageStreamTag.name is in the same namespace you are installing this Helm chart to | false | - |
build.imageStreamTag.namespace | When useReleaseNamespace is false, determines the namespace containing the builder ImageStreamTag. | openshift | - |
build.output.kind | Determines if the image will be pushed to an ImageStreamTag or a DockerImage (external registry) | ImageStreamTag | More information: More information: https://docs.openshift.com/container-platform/4.6/builds/managing-build-output.html |
build.output.pushSecret | Push secret name | - | Used only if build.output.kind == 'DockerImage' |
build.pullSecret | Image pull secret | - | More information: https://docs.openshift.com/container-platform/4.6/openshift_images/managing_images/using-image-pull-secrets.html |
build.env | Freeform env stanza | - | More information: https://kubernetes.io/docs/tasks/inject-data-application/define-environment-variable-container/ |
build.resources | Freeform resources stanza | - | More information: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ |
deploy.replicas | Number of pod replicas to deploy | 1 | - |
deploy.resources | Freeform resources stanza | - | More information: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ |
deploy.serviceType | Type of service to create | ClusterIP | More information: https://kubernetes.io/docs/concepts/services-networking/service/#publishing-services-service-types |
deploy.ports | Freeform service ports stanza. | See values.yaml | More information: https://kubernetes.io/docs/concepts/services-networking/service/#defining-a-service |
deploy.route.enabled | Determines if a Route should be created | true | Allows clients outside of OpenShift to access your application |
deploy.route.targetPort | The port that the Route should target traffic to | http | - |
deploy.route.tls.enabled | Determines if the Route should be TLS-encrypted | true | More information: https://docs.openshift.com/container-platform/4.6/networking/routes/secured-routes.html |
deploy.route.tls.termination | Determines the type of TLS termination to use | edge | Options: edge, reencrypt, passthrough |
deploy.route.tls.insecureEdgeTerminationPolicy | Determines if insecure traffic should be redirected | Redirect | Options: "Allow", "Disable", "Redirect" |
deploy.route.tls.key | Provides key file contents | - | This is a secret. Do not check this value into git. |
deploy.route.tls.caCertificate | Provides the cert authority certificate contents | - | - |
deploy.route.tls.certificate | Provides certificate contents | - | - |
deploy.route.tls.destinationCACertificate | Provides the destination CA Certificate for reencrypt routes | - | - |
deploy.livenessProbe | Freeform livenessProbe stanza. | See values.yaml | More information: https://docs.openshift.com/container-platform/4.6/applications/application-health.html#application-health-about_application-health |
deploy.readinessProbe | Freeform readinessProbe stanza. | See values.yaml | More information: https://docs.openshift.com/container-platform/4.6/applications/application-health.html#application-health-about_application-health |
deploy.env | Freeform env stanza | - | More information: https://kubernetes.io/docs/tasks/inject-data-application/define-environment-variable-container/ |
deploy.envFrom | Freeform 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.enabled | Determines if application properties should be externalized in a ConfigMap | false | - |
deploy.applicationProperties.mountPath | Location to mount the application.properties file | /deployments/config/ | - |
deploy.applicationProperties.properties | The application.properties file contents | - | - |
deploy.volumeMounts | Freeform volume mounts | - | More information: https://kubernetes.io/docs/concepts/storage/volumes/ |
deploy.volumes | Freeform volumes | - | More information: https://kubernetes.io/docs/concepts/storage/volumes/ |
deploy.initContainers | Freeform init containers | - | More information: https://kubernetes.io/docs/concepts/workloads/pods/init-containers/ |
deploy.extraContainers | Freeform containers | - | More information: https://kubernetes.io/docs/concepts/workloads/pods/#pod-templates |
global.nameOverride | Overrides 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.
- Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
- Place the chartdotnet is pinned at v0.0.2 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
- 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