Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[minor] install cluster logging operator #1434

Draft
wants to merge 15 commits into
base: master
Choose a base branch
from
14 changes: 12 additions & 2 deletions .secrets.baseline
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"files": "^.secrets.baseline$",
"lines": null
},
"generated_at": "2024-12-17T09:42:21Z",
"generated_at": "2025-01-08T11:41:53Z",
"plugins_used": [
{
"name": "AWSKeyDetector"
Expand Down Expand Up @@ -172,7 +172,7 @@
"hashed_secret": "b2817467154949a61f8e9ad31d1eeaf03221cbfa",
"is_secret": false,
"is_verified": false,
"line_number": 395,
"line_number": 403,
"type": "Secret Keyword",
"verified_result": null
}
Expand Down Expand Up @@ -399,6 +399,16 @@
"verified_result": null
}
],
"image/cli/mascli/templates/gitops/appset-configs/cluster/cluster-logging-operator.yaml.j2": [
{
"hashed_secret": "fee2d55ad9a49a95fc89abe8f414dad66704ebfd",
"is_secret": false,
"is_verified": false,
"line_number": 5,
"type": "Secret Keyword",
"verified_result": null
}
],
"image/cli/mascli/templates/gitops/appset-configs/cluster/falcon-operator.yaml.j2": [
{
"hashed_secret": "fee2d55ad9a49a95fc89abe8f414dad66704ebfd",
Expand Down
29 changes: 29 additions & 0 deletions image/cli/mascli/functions/gitops_cluster
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@ IBM RBAC (Optional):
CrowdStrike Falcon Operator (Optional):
--install-falcon-operator ${COLOR_YELLOW}INSTALL_FALCON_OPERATOR${TEXT_RESET} Install the CrowdStrike Falcon Operator

Cluster Logging Operator (Optional):
--install-cluster-logging-operator ${COLOR_YELLOW}INSTALL_CLUSTER_LOGGING_OPERATOR${TEXT_RESET} Install the Cluster Logging Operator

Other Commands:
-h, --help Show this help message
EOM
Expand Down Expand Up @@ -276,6 +279,11 @@ function gitops_cluster_noninteractive() {
export INSTALL_FALCON_OPERATOR=true
;;

# Cluster Logging Operator
--install-cluster-logging-operator)
export INSTALL_CLUSTER_LOGGING_OPERATOR=true
;;

# Other Commands
-h|--help)
gitops_cluster_help
Expand Down Expand Up @@ -467,6 +475,11 @@ function gitops_cluster() {
echo_reset_dim "Install the CrowdStrike Falcon Operator ........... ${COLOR_MAGENTA}${INSTALL_FALCON_OPERATOR}"
reset_colors

echo "${TEXT_DIM}"
echo_h2 "Cluster Logging Operator" " "
echo_reset_dim "Install the Cluster Logging Operator ........... ${COLOR_MAGENTA}${INSTALL_CLUSTER_LOGGING_OPERATOR}"
reset_colors

# Set up secrets
# ---------------------------------------------------------------------------
echo
Expand All @@ -491,6 +504,10 @@ function gitops_cluster() {
export SECRET_KEY_FALCON_CLIENT_ID=${SECRET_NAME_FALCON_CLIENT}#client_id
export SECRET_KEY_FALCON_CLIENT_SECRET=${SECRET_NAME_FALCON_CLIENT}#client_secret

export SECRET_NAME_CLOUDWATCH=${ACCOUNT_ID}${SM_DELIM}${CLUSTER_ID}${SM_DELIM}cloudwatch
export SECRET_KEY_CLOUDWATCH_AWS_SECRET_ACCESS_KEY=${SECRET_NAME_CLOUDWATCH}#aws_secret_access_key
export SECRET_KEY_CLOUDWATCH_AWS_ACCESS_KEY_ID=${SECRET_NAME_CLOUDWATCH}#aws_access_key_id

if [ -n "$DEVOPS_MONGO_URI" ];then
echo "- Update DEVOPS_MONGO_URI secret"
TAGS="[{\"Key\": \"source\", \"Value\": \"gitops_cluster\"}, {\"Key\": \"account\", \"Value\": \"${ACCOUNT_ID}\"}, {\"Key\": \"cluster\", \"Value\": \"${CLUSTER_ID}\"}]"
Expand All @@ -509,6 +526,12 @@ function gitops_cluster() {
sm_update_secret $SECRET_NAME_FALCON_CLIENT "{\"client_id\": \"${FALCON_CLIENT_ID}\", \"client_secret\": \"${FALCON_CLIENT_SECRET}\"}" "${TAGS}"
fi

if [ -n "$CLOUDWATCH_AWS_SECRET_ACCESS_KEY" ] && [ -n "$CLOUDWATCH_AWS_ACCESS_KEY_ID" ]; then
echo "- Update CLOUDWATCH_AWS_SECRET_ACCESS_KEY and CLOUDWATCH_AWS_ACCESS_KEY_ID secrets"
TAGS="[{\"Key\": \"source\", \"Value\": \"gitops_cluster\"}, {\"Key\": \"account\", \"Value\": \"${ACCOUNT_ID}\"}, {\"Key\": \"cluster\", \"Value\": \"${CLUSTER_ID}\"}]"
sm_update_secret $SECRET_NAME_CLOUDWATCH "{\"aws_secret_access_key\": \"${CLOUDWATCH_AWS_SECRET_ACCESS_KEY}\", \"aws_access_key_id\": \"${CLOUDWATCH_AWS_ACCESS_KEY_ID}\"}" "${TAGS}"
fi

if [ -z $GIT_SSH ]; then
export GIT_SSH="false"
fi
Expand Down Expand Up @@ -621,6 +644,12 @@ function gitops_cluster() {
jinja -X .+ $CLI_DIR/templates/gitops/appset-configs/cluster/falcon-operator.yaml.j2 -o ${GITOPS_CLUSTER_DIR}/falcon-operator.yaml
fi

if [[ "$INSTALL_CLUSTER_LOGGING_OPERATOR" == "true" ]]; then
echo "- Cluster Logging Operator"
sm_verify_secret_exists $SECRET_NAME_AWS_CLOUDWATCH "aws_access_key_id,aws_secret_access_key"
jinja -X .+ $CLI_DIR/templates/gitops/appset-configs/cluster/cluster-logging-operator.yaml.j2 -o ${GITOPS_CLUSTER_DIR}/cluster-logging-operator.yaml
fi

# Commit and push to github target repo
# ---------------------------------------------------------------------------
if [ "$GITHUB_PUSH" == "true" ]; then
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
merge-key: "{{ ACCOUNT_ID }}/{{ CLUSTER_ID }}"

cluster_logging_operator:
install: "{{ INSTALL_CLUSTER_LOGGING_OPERATOR }}"
aws_secret_access_key: "<path:{{ SECRETS_PATH }}:{{ SECRET_KEY_CLOUDWATCH_AWS_SECRET_ACCESS_KEY }}>"
aws_access_key_id: "<path:{{ SECRETS_PATH }}:{{ SECRET_KEY_CLOUDWATCH_AWS_ACCESS_KEY_ID }}>"
use_syslog_forwarder: "{{ CLUSTER_LOGGING_OPERATOR_USE_SYSLOG_FORWARDER }}"
14 changes: 14 additions & 0 deletions tekton/src/pipelines/gitops/gitops-mas-cluster.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,14 @@ spec:
- name: falcon_operator_node_sensor
type: string
default: ''

- name: install_cluster_logging_operator
type: string
default: 'false'
- name: cluster_logging_operator_use_syslog_forwarder
type: string
default: 'true'

tasks:
- name: gitops-cluster
params:
Expand Down Expand Up @@ -257,6 +265,12 @@ spec:
value: $(params.falcon_operator_cloud_region)
- name: falcon_operator_node_sensor
value: $(params.falcon_operator_node_sensor)

- name: install_cluster_logging_operator
value: $(params.install_cluster_logging_operator)
- name: cluster_logging_operator_use_syslog_forwarder
value: $(params.cluster_logging_operator_use_syslog_forwarder)

taskRef:
kind: Task
name: gitops-cluster
Expand Down
12 changes: 12 additions & 0 deletions tekton/src/tasks/gitops/gitops-cluster.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,13 @@ spec:
type: string
default: ''

- name: install_cluster_logging_operator
type: string
default: 'false'
- name: cluster_logging_operator_use_syslog_forwarder
type: string
default: 'true'

stepTemplate:
name: gitops-cluster
env:
Expand Down Expand Up @@ -195,6 +202,11 @@ spec:
- name: FALCON_OPERATOR_NODE_SENSOR
value: $(params.falcon_operator_node_sensor)

- name: INSTALL_CLUSTER_LOGGING_OPERATOR
value: $(params.install_cluster_logging_operator)
- name: CLUSTER_LOGGING_OPERATOR_USE_SYSLOG_FORWARDER
value: $(params.cluster_logging_operator_use_syslog_forwarder)

envFrom:
- configMapRef:
name: environment-properties
Expand Down
Loading