Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
flux2
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
GitHub Mirror
fluxcd
flux2
Commits
724c93c2
Unverified
Commit
724c93c2
authored
3 years ago
by
Stefan Prodan
Browse files
Options
Downloads
Patches
Plain Diff
Remove image finalizers on uninstall
Signed-off-by:
Stefan Prodan
<
stefan.prodan@gmail.com
>
parent
769e2042
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
cmd/flux/uninstall.go
+41
-0
41 additions, 0 deletions
cmd/flux/uninstall.go
with
41 additions
and
0 deletions
cmd/flux/uninstall.go
+
41
−
0
View file @
724c93c2
...
@@ -33,6 +33,8 @@ import (
...
@@ -33,6 +33,8 @@ import (
"github.com/fluxcd/flux2/internal/utils"
"github.com/fluxcd/flux2/internal/utils"
"github.com/fluxcd/flux2/pkg/manifestgen"
"github.com/fluxcd/flux2/pkg/manifestgen"
helmv2
"github.com/fluxcd/helm-controller/api/v2beta1"
helmv2
"github.com/fluxcd/helm-controller/api/v2beta1"
autov1
"github.com/fluxcd/image-automation-controller/api/v1beta1"
imagev1
"github.com/fluxcd/image-reflector-controller/api/v1beta1"
kustomizev1
"github.com/fluxcd/kustomize-controller/api/v1beta2"
kustomizev1
"github.com/fluxcd/kustomize-controller/api/v1beta2"
sourcev1
"github.com/fluxcd/source-controller/api/v1beta2"
sourcev1
"github.com/fluxcd/source-controller/api/v1beta2"
)
)
...
@@ -261,6 +263,45 @@ func uninstallFinalizers(ctx context.Context, kubeClient client.Client, dryRun b
...
@@ -261,6 +263,45 @@ func uninstallFinalizers(ctx context.Context, kubeClient client.Client, dryRun b
}
}
}
}
}
}
{
var
list
imagev1
.
ImagePolicyList
if
err
:=
kubeClient
.
List
(
ctx
,
&
list
,
client
.
InNamespace
(
""
));
err
==
nil
{
for
_
,
r
:=
range
list
.
Items
{
r
.
Finalizers
=
[]
string
{}
if
err
:=
kubeClient
.
Update
(
ctx
,
&
r
,
opts
);
err
!=
nil
{
logger
.
Failuref
(
"%s/%s/%s removing finalizers failed: %s"
,
r
.
Kind
,
r
.
Namespace
,
r
.
Name
,
err
.
Error
())
}
else
{
logger
.
Successf
(
"%s/%s/%s finalizers deleted %s"
,
r
.
Kind
,
r
.
Namespace
,
r
.
Name
,
dryRunStr
)
}
}
}
}
{
var
list
imagev1
.
ImageRepositoryList
if
err
:=
kubeClient
.
List
(
ctx
,
&
list
,
client
.
InNamespace
(
""
));
err
==
nil
{
for
_
,
r
:=
range
list
.
Items
{
r
.
Finalizers
=
[]
string
{}
if
err
:=
kubeClient
.
Update
(
ctx
,
&
r
,
opts
);
err
!=
nil
{
logger
.
Failuref
(
"%s/%s/%s removing finalizers failed: %s"
,
r
.
Kind
,
r
.
Namespace
,
r
.
Name
,
err
.
Error
())
}
else
{
logger
.
Successf
(
"%s/%s/%s finalizers deleted %s"
,
r
.
Kind
,
r
.
Namespace
,
r
.
Name
,
dryRunStr
)
}
}
}
}
{
var
list
autov1
.
ImageUpdateAutomationList
if
err
:=
kubeClient
.
List
(
ctx
,
&
list
,
client
.
InNamespace
(
""
));
err
==
nil
{
for
_
,
r
:=
range
list
.
Items
{
r
.
Finalizers
=
[]
string
{}
if
err
:=
kubeClient
.
Update
(
ctx
,
&
r
,
opts
);
err
!=
nil
{
logger
.
Failuref
(
"%s/%s/%s removing finalizers failed: %s"
,
r
.
Kind
,
r
.
Namespace
,
r
.
Name
,
err
.
Error
())
}
else
{
logger
.
Successf
(
"%s/%s/%s finalizers deleted %s"
,
r
.
Kind
,
r
.
Namespace
,
r
.
Name
,
dryRunStr
)
}
}
}
}
}
}
func
uninstallCustomResourceDefinitions
(
ctx
context
.
Context
,
kubeClient
client
.
Client
,
dryRun
bool
)
{
func
uninstallCustomResourceDefinitions
(
ctx
context
.
Context
,
kubeClient
client
.
Client
,
dryRun
bool
)
{
...
...
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