Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
controller
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TFS
controller
Commits
2f34897a
Commit
2f34897a
authored
2 months ago
by
Andrea Sgambelluri
Browse files
Options
Downloads
Patches
Plain Diff
new files to manage the db
parent
c14dc8d7
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
scripts/aa
+1786
-329
1786 additions, 329 deletions
scripts/aa
scripts/cockroachdb_client.sh
+2
-1
2 additions, 1 deletion
scripts/cockroachdb_client.sh
scripts/cockroachdb_client_old.sh
+51
-0
51 additions, 0 deletions
scripts/cockroachdb_client_old.sh
with
1839 additions
and
330 deletions
scripts/aa
+
1786
−
329
View file @
2f34897a
Source diff could not be displayed: it is too large. Options to address this:
view the blob
.
This diff is collapsed.
Click to expand it.
scripts/cockroachdb_client.sh
+
2
−
1
View file @
2f34897a
...
@@ -40,7 +40,7 @@ export CRDB_DEPLOY_MODE=${CRDB_DEPLOY_MODE:-"single"}
...
@@ -40,7 +40,7 @@ export CRDB_DEPLOY_MODE=${CRDB_DEPLOY_MODE:-"single"}
if
[
"
$CRDB_DEPLOY_MODE
"
==
"single"
]
;
then
if
[
"
$CRDB_DEPLOY_MODE
"
==
"single"
]
;
then
CRDB_SQL_PORT
=
$(
kubectl
--namespace
${
CRDB_NAMESPACE
}
get service cockroachdb-public
-o
'jsonpath={.spec.ports[?(@.name=="sql")].port}'
)
CRDB_SQL_PORT
=
$(
kubectl
--namespace
${
CRDB_NAMESPACE
}
get service cockroachdb-public
-o
'jsonpath={.spec.ports[?(@.name=="sql")].port}'
)
CRDB_CLIENT_URL
=
"postgresql://
${
CRDB_USERNAME
}
:
${
CRDB_PASSWORD
}
@cockroachdb-0:
${
CRDB_SQL_PORT
}
/
defaultdb
?sslmode=require"
CRDB_CLIENT_URL
=
"postgresql://
${
CRDB_USERNAME
}
:
${
CRDB_PASSWORD
}
@cockroachdb-0:
${
CRDB_SQL_PORT
}
/
tfs_context
?sslmode=require"
kubectl
exec
-it
--namespace
${
CRDB_NAMESPACE
}
cockroachdb-0
--
\
kubectl
exec
-it
--namespace
${
CRDB_NAMESPACE
}
cockroachdb-0
--
\
./cockroach sql
--certs-dir
=
/cockroach/cockroach-certs
--url
=
${
CRDB_CLIENT_URL
}
./cockroach sql
--certs-dir
=
/cockroach/cockroach-certs
--url
=
${
CRDB_CLIENT_URL
}
elif
[
"
$CRDB_DEPLOY_MODE
"
==
"cluster"
]
;
then
elif
[
"
$CRDB_DEPLOY_MODE
"
==
"cluster"
]
;
then
...
@@ -49,3 +49,4 @@ elif [ "$CRDB_DEPLOY_MODE" == "cluster" ]; then
...
@@ -49,3 +49,4 @@ elif [ "$CRDB_DEPLOY_MODE" == "cluster" ]; then
else
else
echo
"Unsupported value: CRDB_DEPLOY_MODE=
$CRDB_DEPLOY_MODE
"
echo
"Unsupported value: CRDB_DEPLOY_MODE=
$CRDB_DEPLOY_MODE
"
fi
fi
This diff is collapsed.
Click to expand it.
scripts/cockroachdb_client_old.sh
0 → 100755
+
51
−
0
View file @
2f34897a
#!/bin/bash
# Copyright 2022-2024 ETSI OSG/SDG TeraFlowSDN (TFS) (https://tfs.etsi.org/)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
########################################################################################################################
# Read deployment settings
########################################################################################################################
# If not already set, set the namespace where CockroackDB will be deployed.
export
CRDB_NAMESPACE
=
${
CRDB_NAMESPACE
:-
"crdb"
}
# If not already set, set the database username to be used by Context.
export
CRDB_USERNAME
=
${
CRDB_USERNAME
:-
"tfs"
}
# If not already set, set the database user's password to be used by Context.
export
CRDB_PASSWORD
=
${
CRDB_PASSWORD
:-
"tfs123"
}
# If not already set, set the database name to be used by Context.
export
CRDB_DATABASE
=
${
CRDB_DATABASE
:-
"tfs"
}
# If not already set, set CockroachDB installation mode. Accepted values are: 'single' and 'cluster'.
export
CRDB_DEPLOY_MODE
=
${
CRDB_DEPLOY_MODE
:-
"single"
}
########################################################################################################################
# Automated steps start here
########################################################################################################################
if
[
"
$CRDB_DEPLOY_MODE
"
==
"single"
]
;
then
CRDB_SQL_PORT
=
$(
kubectl
--namespace
${
CRDB_NAMESPACE
}
get service cockroachdb-public
-o
'jsonpath={.spec.ports[?(@.name=="sql")].port}'
)
CRDB_CLIENT_URL
=
"postgresql://
${
CRDB_USERNAME
}
:
${
CRDB_PASSWORD
}
@cockroachdb-0:
${
CRDB_SQL_PORT
}
/defaultdb?sslmode=require"
kubectl
exec
-it
--namespace
${
CRDB_NAMESPACE
}
cockroachdb-0
--
\
./cockroach sql
--certs-dir
=
/cockroach/cockroach-certs
--url
=
${
CRDB_CLIENT_URL
}
elif
[
"
$CRDB_DEPLOY_MODE
"
==
"cluster"
]
;
then
kubectl
exec
-it
--namespace
${
CRDB_NAMESPACE
}
cockroachdb-client-secure
--
\
./cockroach sql
--certs-dir
=
/cockroach/cockroach-certs
--host
=
cockroachdb-public
else
echo
"Unsupported value: CRDB_DEPLOY_MODE=
$CRDB_DEPLOY_MODE
"
fi
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment