Opstella Core (Back-end) Additional Resources Installation
This content is not available in your language yet.
There’re resources used by Opstella that will be stored in Kubernetes ConfigMap which managable by you (intentionally) and often requires customisation from you.
Opstella-managed GitLab Runner Deployment Template Customization
Section titled “Opstella-managed GitLab Runner Deployment Template Customization”Opstella will deploy and register GitLab Runner for you on 🟢 Management Kubernetes Cluster once Opstella is fully configured.
This deployment template is stored as Kuberntes ConfigMap and allow for customisation and flexibility on any envionment that YOU may want to add or adjust.
-
Create a copy of GitLab Deployment Template from
assetsdirectory.Terminal window cp $HOME/opstella-installation/assets/kubernetes-manifests/opstella-core-gitlab-runner.go.tpl.yaml \$HOME/opstella-installation/opstella-configs/opstella-core-gitlab-runner.go.tpl.yaml -
You MAY EDIT the copied GitLab Deployment Template. (You may use Text Editor of your choice.)
Terminal window vim $HOME/opstella-installation/opstella-configs/opstella-core-gitlab-runner.go.tpl.yamlOR Follow along if you decided using Text Editor is too hard for you.
GitLab Runner use S3 API-compatible Object Storage as its Runner Caches
Section titled “GitLab Runner use S3 API-compatible Object Storage as its Runner Caches”Prerequisites
- 🔑 Credentials to Access S3 Bucket: Access Key, Secret Key
- These credentials should be from the ones you defined in the SeaweedFS (HA) Installation guide (specifically
SEAWEEDFS_HA_S3_GITLAB_CI_PASSWORDas the secret andgitlab-cias the access key).
- These credentials should be from the ones you defined in the SeaweedFS (HA) Installation guide (specifically
-
Set S3(-compatible) Storage Connection
- S3 Domain:
seaweedfs-api.${BASE_DOMAIN} - S3 Bucket Name:
gitlab-ci-caches - S3 Bucket Region:
us-east-1 - S3 Access Key:
gitlab-ci - S3 Secret Key:
CHANGEME; Use the value ofSEAWEEDFS_HA_S3_GITLAB_CI_PASSWORD
export OPSTELLA_MANAGED_GITLAB_RUNNERS_S3_DOMAIN="seaweedfs-api.${BASE_DOMAIN}"export OPSTELLA_MANAGED_GITLAB_RUNNERS_S3_BUCKET_NAME="gitlab-ci-caches"export OPSTELLA_MANAGED_GITLAB_RUNNERS_S3_BUCKET_REGION="us-east-1"export OPSTELLA_MANAGED_GITLAB_RUNNERS_S3_ACCESS_KEY="gitlab-ci"export OPSTELLA_MANAGED_GITLAB_RUNNERS_S3_ACCESS_SECRET="${SEAWEEDFS_HA_S3_GITLAB_CI_PASSWORD}" - S3 Domain:
-
Create Kubernetes Secret named
gitlab-runners-s3-accessthat store Credentials for GitLab Runner to Access S3 Bucket onopstella-shared-runnerNamespaceConnect to
🟢 ManagementKubernetes Cluster ; i.e w/ Kubeconfig FileEnsure you have defined and loaded your Global Shell Variables as described in Shell Variables.
Terminal window source $HOME/opstella-installation/shell-values/kubernetes/management_cluster.vars.shTerminal window export KUBECONFIG="$HOME/opstella-installation/kubeconfigs/management_cluster.yaml"Ensure
BASE_DOMAIN,HARBOR_DOMAIN,MIRROR_REGISTRY_PATHare defined as per the Shell Variables guide.Terminal window kubectl create secret generic gitlab-runners-s3-access \--namespace opstella-shared-runner \--from-literal=accesskey=${OPSTELLA_MANAGED_GITLAB_RUNNERS_S3_ACCESS_KEY} \--from-literal=secretkey=${OPSTELLA_MANAGED_GITLAB_RUNNERS_S3_ACCESS_SECRET} -
Edit GitLab Deployment Template, Go to
ConfigMapsection... (deducted)apiVersion: v1kind: ConfigMapmetadata:name: {{ .Name }}labels:app: {{ .Name }}... (deducted)data:config.template.toml: |[[runners]]clone_url = "{{ .GitlabServer }}"[runners.cache]Type = "s3"Shared = true[runners.cache.s3]ServerAddress = "seaweedfs-api.${BASE_DOMAIN}"BucketName = "gitlab-ci-caches"BucketLocation = "us-east-1"AuthenticationType = "access-key"... (deducted)Edit the file by the following
[runners.cache.s3]section, to configure Runners to use S3 API-compatible Object Storage.- Edit
ServerAddressfor SeaweedFS API Domainseaweedfs-api.${BASE_DOMAIN} - Edit
BucketNamefor Bucket Namegitlab-ci-caches; Leave Default - Edit
BucketLocationfor Bucket Regionus-east-1; Leave Default
- Edit
Or Simply run this.
Terminal window sed -i "s@\${OPSTELLA_MANAGED_GITLAB_RUNNERS_S3_DOMAIN}@$OPSTELLA_MANAGED_GITLAB_RUNNERS_S3_DOMAIN@g" \$HOME/opstella-installation/opstella-configs/opstella-core-gitlab-runner.go.tpl.yamlTerminal window sed -i "s@\${OPSTELLA_MANAGED_GITLAB_RUNNERS_S3_BUCKET_NAME}@$OPSTELLA_MANAGED_GITLAB_RUNNERS_S3_BUCKET_NAME@g" \$HOME/opstella-installation/opstella-configs/opstella-core-gitlab-runner.go.tpl.yamlTerminal window sed -i "s@\${OPSTELLA_MANAGED_GITLAB_RUNNERS_S3_BUCKET_REGION}@$OPSTELLA_MANAGED_GITLAB_RUNNERS_S3_BUCKET_REGION@g" \$HOME/opstella-installation/opstella-configs/opstella-core-gitlab-runner.go.tpl.yaml -
Go to
Deploymentsection, Add extra volume from Kubernetes Secretgitlab-runners-s3-accessto existingprojected-secretsvolume.... (deducted)apiVersion: apps/v1kind: Deploymentmetadata:... (deducted)spec:... (deducted)template:... (deducted)volumes:... (deducted)- name: projected-secretsprojected:sources:### ADD THIS IF NOT EXIST ###- secret:name: gitlab-runners-s3-accessoptional: true### ADD THIS IF NOT EXIST ###- secret:... (deducted)
GitLab Runner with imagePullSecrets to Pull Artifacts from a Registry
Section titled “GitLab Runner with imagePullSecrets to Pull Artifacts from a Registry”Prerequisites
- 🔑 Credentials to Access Registry: Harbor Robot Account
- Harbor Domain: Use
HARBOR_DOMAINfrom the Shell Variables guide. - Username:
robot$opstella-gitlab-runners - Password:
CHANGEME; Change to the one you retrieved once you created Robot Account
- Harbor Domain: Use
-
Store Pull Credentials as Kubernetes Secret
Terminal window ## For security reasons turn off bash history momentarilyset +o historyexport REGISTRY_USERNAME='robot$opstella-gitlab-runners'export REGISTRY_PASSWORD="CHANGEME"Create Kubernetes Secret
You will be creating Kubernetes Secret named
gitlab-runners-harbor-${BASE_DOMAIN}Terminal window export OPSTELLA_MANAGED_GITLAB_RUNNERS_IMAGEPULLSECRET_NAME="gitlab-runners-harbor-${BASE_DOMAIN}"Terminal window # Create .dockerconfig JSON filekubectl create secret docker-registry ${OPSTELLA_MANAGED_GITLAB_RUNNERS_IMAGEPULLSECRET_NAME} -n opstella-shared-runner \--docker-server=${HARBOR_DOMAIN} \--docker-username=${REGISTRY_USERNAME} \--docker-password=${REGISTRY_PASSWORD}set -o history -
Edit GitLab Deployment Template, Go to
ConfigMapsection... (deducted)apiVersion: v1kind: ConfigMapmetadata:name: {{ .Name }}labels:app: {{ .Name }}... (deducted)data:config.template.toml: |[[runners]]clone_url = "{{ .GitlabServer }}"[runners.cache]Type = "s3"Shared = true[runners.cache.s3]... (deducted)[runners.kubernetes]namespace = "{{ .Namespace }}"image = "ubuntu:24.04"### ADD THIS ###image_pull_secrets = ['gitlab-runners-harbor-${BASE_DOMAIN}']### ADD THIS ###... (deducted)Edit the file by the following
[runners.kubernetes]section- Add
image_pull_secrets = ['gitlab-runners-harbor-${BASE_DOMAIN}']for the imagePullSecrets that you have created.
- Add
Or Simply run this.
export OPSTELLA_MANAGED_GITLAB_RUNNERS_IMAGEPULLSECRET_NAME="gitlab-runners-harbor-${BASE_DOMAIN}"export OPSTELLA_MANAGED_GITLAB_RUNNERS_IMAGEPULLSECRET_TOML="image_pull_secrets = ['${OPSTELLA_MANAGED_GITLAB_RUNNERS_IMAGEPULLSECRET_NAME}']"Terminal window sed -i "s#\${OPSTELLA_MANAGED_GITLAB_RUNNERS_IMAGEPULLSECRET_TOML}#$OPSTELLA_MANAGED_GITLAB_RUNNERS_IMAGEPULLSECRET_TOML#g" \$HOME/opstella-installation/opstella-configs/opstella-core-gitlab-runner.go.tpl.yaml
Extra Opstella-managed GitLab CI/CD Variables
Section titled “Extra Opstella-managed GitLab CI/CD Variables”Opstella will managed certain pre-defined CI/CD Variables and Extra CI/CD Variables are needed to be create once you start using Opstella.
- Mirrored Container Image Registry Path
- On Harbor, you have been setup Proxy Cache Project for mirroring Container Images.
- This CI/CD variable will allow to patch in CI/CD Runtime.
export MIRROR_REGISTRY_PATH="${HARBOR_DOMAIN}/mirror-"cat $HOME/opstella-installation/assets/kubernetes-manifests/opstella-core-gitlab-variables.tpl.yaml \ | sed "s@\${MIRROR_REGISTRY_PATH}@$MIRROR_REGISTRY_PATH@g" \ > $HOME/opstella-installation/opstella-configs/opstella-core-gitlab-variables.yamlCreate Kubernetes ConfigMap
Section titled “Create Kubernetes ConfigMap”-
Connect to
🟢 ManagementKubernetes Cluster ; i.e w/ Kubeconfig FileEnsure you have defined and loaded your Global Shell Variables as described in Shell Variables.
Terminal window source $HOME/opstella-installation/shell-values/kubernetes/management_cluster.vars.shTerminal window export KUBECONFIG="$HOME/opstella-installation/kubeconfigs/management_cluster.yaml"Ensure
BASE_DOMAINis defined as per the Shell Variables guide. -
Create Kubernetes ConfigMap named
opstella-core-gitlab-configsinopstella-systemNamespaceTerminal window kubectl create configmap opstella-core-gitlab-configs --namespace opstella-system \--from-file=gitlab-runner-template.yaml=$HOME/opstella-installation/opstella-configs/opstella-core-gitlab-runner.go.tpl.yaml \--from-file=variables.yaml=$HOME/opstella-installation/opstella-configs/opstella-core-gitlab-variables.yaml
Finished?
Use the below navigation to proceed