-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a1aa45a
commit 63ccf54
Showing
38 changed files
with
1,012 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
### Required enveraments | ||
|
||
- Helm | ||
- OC (Openshift Client) | ||
|
||
### OC login | ||
|
||
```shell | ||
oc login --token=<token> --server=<cluster-host> | ||
``` | ||
|
||
### To show deployments | ||
|
||
To view templates generated by Helm with the Bitbucket profile: | ||
|
||
```shell | ||
helm template chart --set bitbucket.license=<license> --set vcsFacade.image.version=<version> | ||
``` | ||
|
||
To install the application in the <project> namespace: | ||
|
||
```shell | ||
helm upgrade --wait --install <helm_release> chart --namespace <project> --set bitbucket.license=<license> --set vcs-facade.image.tag=<version> --set clusterDomain=<cluster_domain> --set localDomain=<local_host> --set dockerRegistry=<dockerRegistry> --set platform=okd | ||
``` | ||
|
||
To uninstall the application: | ||
|
||
```shell | ||
helm uninstall <helm_release> --namespace <project> | ||
``` | ||
|
||
#### Parameters | ||
|
||
- helm_release - Helm release name(This release is a specific deployment of that chart with a unique configuration, and it includes all the Kubernetes resources specified in the chart templates, such as deployments, services, and config maps. Helm releases allow you to manage, upgrade, and roll back your applications easily) | ||
- project - Project namespace | ||
- bitbucket.license - license token for BitBucket server | ||
- dockerRegistry - Docker registry with images. | ||
- cluster_domain - Cluster domain(the root domain used for all internal addresses within the cluster. It ensures predictable DNS names for inter-service communication.) | ||
- local_host - Local host(typically refers to the default local domain suffix used for internal network addresses) | ||
|
||
### To run from gradle | ||
|
||
```shell | ||
./gradlew deployHelm -Pdocker.registry=<docker_registry> -Pplatform=okd -PhelmRelease=<release_name> -PhelmNamespace=<project> -PlocalDomain=<local_domain> -PclusterDomain=<cluster_domain> -Ptest.profile=bitbucket -Pversion=<version> -Pbitbucket.license=<license> | ||
``` | ||
|
||
```shell | ||
./gradlw uninstallHelm -PhelmRelease=<release_name> -PhelmNamespace=<project> | ||
``` | ||
|
||
### Create a project in OKD | ||
|
||
1. To create a new project, you need to click the **Create Project** button in the dropdown menu, as shown in the image below. | ||
|
||
![img1.png](img/img1.png) | ||
|
||
2. Next, you need to create a **ServiceAccount** for access to the project. To do this, click the **Create ServiceAccount** button as shown in the image below. | ||
|
||
![img2.png](img/img2.png) | ||
|
||
3. In the ServiceAccount parameters, you need to specify a unique arbitrary name and the project name, as shown below. | ||
|
||
```yaml | ||
apiVersion: v1 | ||
kind: ServiceAccount | ||
metadata: | ||
name: <service_account_name> | ||
namespace: <project_name> | ||
``` | ||
4. The created ServiceAccount will automatically create two sections in the Secrets section. One of them should have the type service-account-token, as shown in the picture. By entering this section, you will find a permanent token in the token field, which can be used to access OKD. | ||
![img3.png](img/img3.png) | ||
5. To assign roles, in the Project Access section, you need to add new access. In the Name field, specify the name of the ServiceAccount, and in the Role field, specify the role that will be assigned to this ServiceAccount. | ||
![img4.png](img/img4.png) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
val testProfile: String? = project.ext["testProfile"] as String? | ||
val platform: String? = project.ext["platform"] as String? | ||
val helmNamespace: String? = project.ext["helmNamespace"] as String? | ||
val helmRelease: String? = project.ext["helmRelease"] as String? | ||
val clusterDomain: String? = project.ext["clusterDomain"] as String? | ||
val localDomain: String? = project.ext["localDomain"] as String? | ||
var bitbucketHost: String? = project.ext["bitbucketHost"] as String? | ||
val dockerRegistry: String? = project.ext["dockerRegistry"] as String? | ||
|
||
tasks.register("uninstallHelm") { | ||
doLast { | ||
if (helmRelease == null) { | ||
throw GradleException("Helm release name is not set") | ||
} | ||
if (helmNamespace == null) { | ||
throw GradleException("Helm namespace is not set") | ||
} | ||
val result = exec { | ||
commandLine("helm", "uninstall", helmRelease, "--namespace", helmNamespace) | ||
} | ||
if (result.exitValue != 0) { | ||
throw GradleException("Helm uninstall failed with exit code ${result.exitValue}") | ||
} | ||
} | ||
} | ||
|
||
println("Profile: " + testProfile) | ||
println("Platform: " + if (platform == "okd") "OKD" else "DOCKER-COMPOSE") | ||
|
||
tasks.register<Exec>("deployHelm") { | ||
|
||
if (helmRelease == null) { | ||
throw GradleException("Helm release name is not set") | ||
} | ||
if (helmNamespace == null) { | ||
throw GradleException("Helm namespace is not set") | ||
} | ||
if (clusterDomain == null) { | ||
throw GradleException("Cluster domain is not set") | ||
} | ||
if (localDomain == null) { | ||
throw GradleException("Local domain is not set") | ||
} | ||
|
||
println("Release: $helmRelease") | ||
|
||
val bitbucketLicense: String by project | ||
|
||
commandLine("helm", "upgrade", "--wait" | ||
, "--install", helmRelease, "chart" | ||
, "--namespace", helmNamespace | ||
, "--set", "bitbucket.license=$bitbucketLicense" | ||
, "--set", "vcs-facade.image.tag=${project.version}" | ||
, "--set", "bitbucket.host=${bitbucketHost}" | ||
, "--set", "clusterDomain=${clusterDomain}" | ||
, "--set", "localDomain=${localDomain}" | ||
, "--set", "dockerRegistry=$dockerRegistry" | ||
, "--set", "platform=openshift" | ||
) | ||
doLast { | ||
val execResult = executionResult.get() | ||
if (execResult.exitValue != 0) { | ||
val errorOutput = standardOutput.toString() | ||
throw GradleException("Helm deploy failed with exit code ${execResult.exitValue} and the following error:\\n$errorOutput") | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Patterns to ignore when building packages. | ||
# This supports shell glob matching, relative path matching, and | ||
# negation (prefixed with !). Only one pattern per line. | ||
.DS_Store | ||
# Common VCS dirs | ||
.git/ | ||
.gitignore | ||
.bzr/ | ||
.bzrignore | ||
.hg/ | ||
.hgignore | ||
.svn/ | ||
# Common backup files | ||
*.swp | ||
*.bak | ||
*.tmp | ||
*.orig | ||
*~ | ||
# Various IDEs | ||
.project | ||
.idea/ | ||
*.tmproj | ||
.vscode/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
apiVersion: v2 | ||
name: vcs-facade | ||
description: A Helm chart for Kubernetes | ||
|
||
# A chart can be either an 'application' or a 'library' chart. | ||
# | ||
# Application charts are a collection of templates that can be packaged into versioned archives | ||
# to be deployed. | ||
# | ||
# Library charts provide useful utilities or functions for the chart developer. They're included as | ||
# a dependency of application charts to inject those utilities and functions into the rendering | ||
# pipeline. Library charts do not define any templates and therefore cannot be deployed. | ||
type: application | ||
|
||
# This is the chart version. This version number should be incremented each time you make changes | ||
# to the chart and its templates, including the app version. | ||
# Versions are expected to follow Semantic Versioning (https://semver.org/) | ||
version: 0.1.0 | ||
|
||
# This is the version number of the application being deployed. This version number should be | ||
# incremented each time you make changes to the application. Versions are not expected to | ||
# follow Semantic Versioning. They should reflect the version the application is using. | ||
# It is recommended to use it with quotes. | ||
appVersion: "0.0.1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
vcs-facade: | ||
vcs: | ||
bitbucket: | ||
host: http://{{ .Values.bitbucket.host | default "bitbucket:7990" }} | ||
username: admin | ||
password: admin | ||
health-check: | ||
repo: ssh://git@bitbucket:7990/test-data/vcs-facade-healthcheck.git | ||
root-commit: 9320183f5d5f5868fdb82b36e3abd6f9d1424114 | ||
last-release: 321d4908aef10bafa1488f9b053270acc29f3d78 | ||
expected-commits: 9320183f5d5f5868fdb82b36e3abd6f9d1424114,00cc61dd4c3eca64d12e6beceff1a40a436962f5 | ||
gitea: | ||
enabled: false | ||
gitlab: | ||
enabled: false | ||
opensearch: | ||
enabled: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
vcs-facade: | ||
job: | ||
fast-work-timout-secs: 0 | ||
retry-interval-secs: 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
spring: | ||
cloud: | ||
config: | ||
enabled: false |
Oops, something went wrong.