Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
theodolite
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Sören Henning
theodolite
Commits
12ab42a4
Commit
12ab42a4
authored
2 years ago
by
Sören Henning
Browse files
Options
Downloads
Patches
Plain Diff
Some code cleanup
parent
f3e6bf44
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Pipeline
#10419
passed
2 years ago
Stage: build
Stage: test
Stage: check
Stage: deploy
Stage: smoketest
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
theodolite/src/main/kotlin/rocks/theodolite/kubernetes/patcher/VolumesConfigMapPatcher.kt
+15
-24
15 additions, 24 deletions
.../theodolite/kubernetes/patcher/VolumesConfigMapPatcher.kt
with
15 additions
and
24 deletions
theodolite/src/main/kotlin/rocks/theodolite/kubernetes/patcher/VolumesConfigMapPatcher.kt
+
15
−
24
View file @
12ab42a4
...
@@ -7,37 +7,28 @@ import io.fabric8.kubernetes.api.model.apps.StatefulSet
...
@@ -7,37 +7,28 @@ import io.fabric8.kubernetes.api.model.apps.StatefulSet
class
VolumesConfigMapPatcher
(
private
var
volumeName
:
String
)
:
AbstractStringPatcher
()
{
class
VolumesConfigMapPatcher
(
private
var
volumeName
:
String
)
:
AbstractStringPatcher
()
{
override
fun
patchSingleResource
(
resource
:
HasMetadata
,
value
:
String
):
HasMetadata
{
override
fun
patchSingleResource
(
resource
:
HasMetadata
,
value
:
String
):
HasMetadata
{
if
(
resource
is
Deployment
)
{
val
volumeMounts
=
when
(
resource
)
{
if
(
resource
.
spec
.
template
.
spec
.
volumes
==
null
)
{
is
Deployment
->
{
resource
.
spec
.
template
.
spec
.
volumes
=
mutableListOf
()
if
(
resource
.
spec
.
template
.
spec
.
volumes
==
null
)
{
resource
.
spec
.
template
.
spec
.
volumes
=
mutableListOf
()
}
resource
.
spec
.
template
.
spec
.
volumes
}
}
val
volumeMounts
=
resource
.
spec
.
template
.
spec
.
volumes
is
StatefulSet
->
{
if
(
resource
.
spec
.
template
.
spec
.
volumes
==
null
)
{
for
(
mount
in
volumeMounts
)
{
resource
.
spec
.
template
.
spec
.
volumes
=
mutableListOf
()
try
{
if
(
mount
.
configMap
.
name
==
volumeName
)
{
mount
.
configMap
.
name
=
value
}
}
catch
(
_
:
NullPointerException
)
{
}
}
resource
.
spec
.
template
.
spec
.
volumes
}
}
else
->
emptyList
()
// No volumes to patch
}
}
if
(
resource
is
StatefulSet
)
{
if
(
resource
.
spec
.
template
.
spec
.
volumes
==
null
)
{
resource
.
spec
.
template
.
spec
.
volumes
=
mutableListOf
()
}
val
volumeMounts
=
resource
.
spec
.
template
.
spec
.
volumes
for
(
mount
in
volumeMounts
)
{
for
(
mount
in
volumeMounts
)
{
try
{
// Find ConfigMap volume with requested name
if
(
mount
.
configMap
.
name
==
volumeName
)
{
if
(
mount
.
configMap
?.
name
?.
equals
(
volumeName
)
==
true
)
{
mount
.
configMap
.
name
=
value
mount
.
configMap
.
name
=
value
}
}
catch
(
_
:
NullPointerException
)
{
}
}
}
}
}
return
resource
return
resource
}
}
}
}
\ No newline at end of file
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