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 for gitops #1434

Merged
merged 24 commits into from
Jan 23, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion .secrets.baseline
Original file line number Diff line number Diff line change
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
30 changes: 30 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}CLUSTER_LOGGING_OPERATOR_INSTALL${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 CLUSTER_LOGGING_OPERATOR_INSTALL=true
;;

# Other Commands
-h|--help)
gitops_cluster_help
Expand Down Expand Up @@ -467,6 +475,12 @@ 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}${CLUSTER_LOGGING_OPERATOR_INSTALL}"
echo_reset_dim "Use Syslog Forwarder ........... ${COLOR_MAGENTA}${CLUSTER_LOGGING_OPERATOR_USE_SYSLOG_FORWARDER}"
reset_colors

# Set up secrets
# ---------------------------------------------------------------------------
echo
Expand All @@ -491,6 +505,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 +527,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 +645,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 [[ -n "$CLUSTER_LOGGING_OPERATOR_INSTALL" ]]; then
echo "- Cluster Logging Operator"
sm_verify_secret_exists $SECRET_NAME_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: "{{ CLUSTER_LOGGING_OPERATOR_INSTALL }}"
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: cluster_logging_operator_install
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: cluster_logging_operator_install
value: $(params.cluster_logging_operator_install)
- 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: cluster_logging_operator_install
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: CLUSTER_LOGGING_OPERATOR_INSTALL
value: $(params.cluster_logging_operator_install)
- name: CLUSTER_LOGGING_OPERATOR_USE_SYSLOG_FORWARDER
value: $(params.cluster_logging_operator_use_syslog_forwarder)

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