-
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.
CCX charts - Merge pull request #1 from severalnines/1-release/1.47
Run 1 Merge release/1.47 into Main branch
- Loading branch information
Showing
80 changed files
with
5,531 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# 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/ | ||
.github/ | ||
# 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,28 @@ | ||
apiVersion: v2 | ||
name: ccx | ||
description: A Helm chart for CCX | ||
|
||
# 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 | ||
icon: https://st.s9s.io/ccx/logo/ccx-purple.svg | ||
|
||
# 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: 1.47.1 | ||
|
||
|
||
# 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. | ||
# THIS IS THE CCX RELEASE VERSION | ||
appVersion: "1.47.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,88 @@ | ||
# CCX helm-chart | ||
|
||
# Quickstart | ||
|
||
This guide assumes using dependencies helper repo - https://github.com/severalnines/helm-ccxdeps | ||
|
||
Add repos | ||
|
||
``` | ||
helm repo add ccxdeps https://severalnines.github.io/helm-ccxdeps/ | ||
helm repo add s9s https://severalnines.github.io/helm-charts/ | ||
helm repo update | ||
``` | ||
|
||
Inspect and modify `minimal-values.yaml` | ||
|
||
Install | ||
|
||
``` | ||
# Create k8s secret from AWS credentials stored in ~/.aws/credentials | ||
kubectl create secret generic aws --from-literal=AWS_ACCESS_KEY_ID=$(awk 'tolower($0) ~ /aws_access_key_id/ {print $NF; exit}' ~/.aws/credentials) --from-literal=AWS_SECRET_ACCESS_KEY=$(awk 'tolower($0) ~ /aws_secret_access_key/ {print $NF; exit}' ~/.aws/credentials) | ||
# Install CCX dependencies | ||
helm install ccxdeps ccxdeps/ccxdeps --debug | ||
# Install CCX | ||
helm repo add s9s https://severalnines.github.io/helm-charts/ | ||
helm repo update | ||
helm install ccx s9s/ccx --values minimal-values.yaml --debug --wait | ||
``` | ||
|
||
Enjoy! | ||
|
||
|
||
## Deploying on your local cluster | ||
|
||
### Prerequisites | ||
|
||
* image-pull secrets | ||
* cert-manager (optional) or ssl certificate (wildcard) | ||
* ingress controller | ||
* FQDN pointing to your ingress controller (need a public IP to be able to do that) or externaldns (optional) | ||
|
||
# Install | ||
|
||
## Add CCX helm chart repo | ||
|
||
```helm repo add s9s https://severalnines.github.io/helm-charts/``` | ||
|
||
## Prerequisites for CCX Installation | ||
|
||
### values.yaml | ||
|
||
Look at the `values.yaml` and create your own file with proper overrides. | ||
|
||
### Secrets | ||
|
||
Inspect `secrets-template.yaml`, provide your secrets and deploy with `kubectl apply -f secrets-template.yaml` | ||
|
||
#### Cloud credentials | ||
K8s secrets can have any name, but the template suggests `s9s-openstack`, `s9s-s3`. | ||
|
||
Secret keys must have names `S9S_XXX`, replacing `MYCLOUD_XXX` in template. | ||
|
||
The `S9S` part is exactly the uppercase form of the cloud name in ccx and deployer config files. | ||
|
||
Then list the secrets in the values file: | ||
|
||
``` | ||
ccx: | ||
cloudSecrets: | ||
- s9s-openstack | ||
- s9s-s3 | ||
``` | ||
|
||
### Install CCX helm chart | ||
|
||
```helm install ccx s9s/ccx --values YOUR_VALUES_FILE-values.yaml --debug``` | ||
|
||
If your values are divided between multiple files, you can use the `--values` option multiple times. | ||
|
||
### Applying your local changes to your env | ||
|
||
cd into your helm-ccx dir and | ||
|
||
> :warning: Always double-check your current kubectl context and namespace beforehand :warning: | ||
```shell | ||
helm upgrade ccx . -f my-values.yaml -f my-deployer-values.yaml | ||
``` |
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,51 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
VG_NAME=${1:-VG_data} | ||
LV_NAME=${2:-data} | ||
|
||
if [ -z "$VG_NAME" ] || [ -z "$LV_NAME" ]; then | ||
echo "Usage: $0 [Volume Group] [Logical Volume]" | ||
exit 1 | ||
fi | ||
|
||
AVAILABLE_DISKS=($(lsblk -dpnlo name,type | grep -E 'disk' | awk '{print $1}')) | ||
|
||
MOUNTED_PARTITIONS=($(lsblk -lpn | awk '/part/ {print $1}' | tr '\n' ' ')) | ||
|
||
# Loop through the available disks and try to add them to the volume group | ||
for DISK in "${AVAILABLE_DISKS[@]}"; do | ||
# Check if the disk is a mounted partition | ||
# This is not ideal as potentially there could be a partition we would want to use on the same disk | ||
# However, very unlikely as we use whole disks for CCX | ||
if [[ ! " ${MOUNTED_PARTITIONS[@]} " =~ "${DISK}" ]]; then | ||
# Check if the disk is part of any volume group | ||
if ! pvdisplay "$DISK" > /dev/null 2>&1; then | ||
# Create a physical volume | ||
pvcreate "$DISK" | ||
# Check if volume group exists || if not, create it | ||
if ! vgdisplay "$VG_NAME" > /dev/null 2>&1; then | ||
vgcreate "$VG_NAME" "$DISK" | ||
# Create logical volume data | ||
lvcreate -l 100%VG "$VG_NAME" -n data | ||
# Create the filesystem | ||
blkid /dev/mapper/${VG_NAME}-data || mkfs.ext4 /dev/mapper/${VG_NAME}-data | ||
else | ||
# Extend the volume group | ||
vgextend "$VG_NAME" "$DISK" | ||
fi | ||
fi | ||
fi | ||
done | ||
|
||
# Extend the logical volume and resize the fs | ||
lvextend -r -l +100%FREE "/dev/$VG_NAME/$LV_NAME" | ||
|
||
#Taddam | ||
echo "All available disks are added and the volume is extended successfully." | ||
|
||
# Print final size of /data | ||
SIZE_G=$(lvs /dev/$VG_NAME/$LV_NAME -o LV_SIZE --noheadings --units g --nosuffix | xargs printf "%.0f") | ||
echo "FINAL_SIZE=[$SIZE_G]" | ||
|
||
exit 0 |
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,52 @@ | ||
[SERVICE] | ||
Flush 5 | ||
Log_Level info | ||
Daemon off | ||
Parsers_File parsers.conf | ||
HTTP_Server On | ||
HTTP_Listen 0.0.0.0 | ||
HTTP_Port 2020 | ||
storage.path /var/fluent-bit/state/flb-storage/ | ||
storage.sync normal | ||
storage.checksum off | ||
storage.backlog.mem_limit 5M | ||
|
||
[INPUT] | ||
Name tail | ||
Tag ccx.mysql | ||
Path /var/log/mysql/mysqld.log | ||
DB /var/fluent-bit/state/flb_mysql.db | ||
Mem_Buf_Limit 5MB | ||
Skip_Long_Lines On | ||
Refresh_Interval 10 | ||
Read_from_Head false | ||
|
||
[INPUT] | ||
Name tail | ||
Tag ccx.pg | ||
Path /var/log/postgresql/postgresql-11-main.log, /var/log/postgresql/postgresql-14-main.log, /var/log/postgresql/postgresql-15-main.log | ||
DB /var/fluent-bit/state/flb_pg.db | ||
Mem_Buf_Limit 5MB | ||
Skip_Long_Lines On | ||
Refresh_Interval 10 | ||
Read_from_Head false | ||
|
||
[INPUT] | ||
Name tail | ||
Tag ccx.redis | ||
Path /var/log/redis/redis-server.log, /var/log/redis/redis-sentinel.log | ||
DB /var/fluent-bit/state/flb_redis.db | ||
Mem_Buf_Limit 5MB | ||
Skip_Long_Lines On | ||
Refresh_Interval 10 | ||
Read_from_Head false | ||
|
||
[FILTER] | ||
Name record_modifier | ||
Match * | ||
Record hostname ${HOSTNAME} | ||
Record datastoreid ${CLUSTER_UUID} | ||
|
||
[OUTPUT] | ||
name stdout | ||
match * |
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,48 @@ | ||
sessionDomain: ccx.mycloud.com | ||
ccxFQDN: ccx.mycloud.com | ||
ccx: | ||
# list of k8s secrets containing cloud credentials | ||
# if this is not set, ccx will start but you won't be able to deploy anything | ||
cloudSecrets: | ||
- mycloud-openstack #this have to exist in k8s secrets! - see secrets-template.yaml | ||
config: | ||
clouds: | ||
- code: mycloud | ||
name: MyCloud | ||
instance_types: | ||
- code: m1.small | ||
cpu: 2 | ||
disk_size: 60 | ||
name: Small | ||
ram: 4 | ||
type: m1.small | ||
network_types: | ||
- code: public | ||
in_vpc: false | ||
info: All instances will be deployed with public IPs. Access to the public IPs is controlled by a firewall. | ||
name: Public | ||
regions: | ||
- availability_zones: | ||
- code: nova | ||
name: MyAZ | ||
city: Stockholm | ||
code: my-region1 | ||
continent_code: EU | ||
country_code: SE | ||
display_code: my-region1 | ||
name: Stockholm | ||
services: | ||
deployer: | ||
config: | ||
openstack_vendors: | ||
mycloud: | ||
floating_network_id: MY_FLOATING_NETWORK_ID | ||
network_api_version: NetworkNeutron | ||
network_id: MY_NETWORK_ID | ||
project_id: MY_PROJECT_ID | ||
regions: | ||
my-region1: | ||
image_id: MY_IMAGE_ID | ||
# The secgrp_name refers to the security group name which will be used by ccx to access the datastore VMs. | ||
# It should be created manually beforehand and allow all TCP traffic from all k8s nodes where ccx is running. | ||
secgrp_name: ccx-common |
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,7 @@ | ||
sessionDomain: ccx.mycloud.com | ||
ccxFQDN: ccx.mycloud.com | ||
ccx: | ||
# list of k8s secrets containing cloud credentials | ||
# if this is not set, ccx will start but you won't be able to deploy anything | ||
cloudSecrets: | ||
- aws |
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,78 @@ | ||
# CCX Logging Utility | ||
|
||
This script is designed to facilitate the collection of logs and operational data from a CCX services and components within a Kubernetes environment. It specifically targets a suite of services CCX services along with cmon services, gathering their logs, s9s cluster and job information, and packaging them into a compressed archive for analysis. | ||
|
||
## Prerequisites | ||
|
||
- **Kubernetes Environment**: Ensure the script is executed within the correct Kubernetes cluster and namespace context. | ||
- **kubectl**: The Kubernetes command-line tool, `kubectl`, must be installed and configured to communicate with your cluster. | ||
- **Permissions**: Adequate permissions are required to fetch logs and execute commands within pods. | ||
|
||
## Usage | ||
|
||
1. Ensure you have the necessary permissions and are in the correct Kubernetes namespace. | ||
2. Run the script: | ||
|
||
```bash | ||
./gather-logs.sh | ||
``` | ||
|
||
Optionally, provide parameters: | ||
|
||
```bash | ||
Usage: ./gather-logs.sh [-n namespace] [-o output] [-h] | ||
-n namespace: Namespace to gather logs from. Default is current namespace. | ||
-o output: Output .tar.gz file name. Default is ccx-logs.tar.gz. | ||
-h: Display this help. | ||
All parameters are optional. | ||
``` | ||
|
||
3. Upon completion, the script will output the location of the `ccx-logs.tar.gz` file containing the collected logs. | ||
|
||
## Functionality | ||
|
||
1. **Initial Check**: Verifies the presence of the `cmon-master-0` pod to ensure the script is executed in the correct environment. | ||
2. **Log Collection**: Iterates through the list of services, gathering logs from all containers within pods labeled with the service name. | ||
3. **s9s Info**: Gathers cluster and job information using the `s9s` tool from the `cmon-master-0` pod. | ||
4. **Failed Job Logs**: Collects logs for the last 10 failed jobs, if any. | ||
5. **Partial CCX database dump**: Dumps some database tables for review. Sensitive or user data is not dumped! | ||
6. **Archiving**: Packages all collected data into a compressed file named `ccx-logs.tar.gz`. | ||
7. **Cleanup**: Removes the temporary directory used for log collection. | ||
|
||
## Troubleshooting | ||
|
||
If you encounter an error stating `cmon-master-0 pod not found`, verify that: | ||
- You are in the correct Kubernetes cluster and namespace. | ||
- Your `kubectl` is properly configured and has the necessary permissions. | ||
|
||
## Note | ||
|
||
This script is intended for use by system administrators and support personnel familiar with Kubernetes. Use with caution and ensure you have the appropriate authorizations before accessing and collecting data from production environments. | ||
|
||
|
||
# CCX Easy Install and values file generation script | ||
|
||
This script is designed to facilitate easy installation of CCX deps and generate values within a Kubernetes environment. | ||
|
||
## Prerequisites | ||
|
||
- **Kubernetes Environment**: Ensure the script is executed within the correct Kubernetes cluster and namespace context. | ||
|
||
`kubectl config set-context --current --namespace=your-namespace` | ||
- **Tool**: `kubectl`, `helm`, must be installed and configured to communicate with your cluster. | ||
* [kubectl installation](https://kubernetes.io/docs/tasks/tools/#kubectl) | ||
* [helm installation](https://helm.sh/docs/intro/install/) | ||
- **Permissions**: Admin permissions are required within namespace execute commands and install operators. | ||
|
||
## Usage | ||
|
||
1. Ensure you have the necessary permissions and are in the correct Kubernetes namespace. | ||
2. Run the script: | ||
|
||
```bash | ||
./ccx-yaml-gen.sh | ||
``` | ||
|
||
## Note | ||
|
||
This script is intended for use by system administrators and support personnel familiar with Kubernetes. Use with caution and ensure you have the appropriate authorizations with production environments. |
Oops, something went wrong.