Skip to content

Commit 6d2eee1

Browse files
author
Nont
committed
Fix comments and docker build
Signed-off-by: Nont <nont@duck.com>
1 parent 2f8bc0c commit 6d2eee1

File tree

3 files changed

+5
-6
lines changed

3 files changed

+5
-6
lines changed

cmd/crdinstaller/main.go

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,7 @@ import (
2121
"go.goms.io/fleet/cmd/crdinstaller/utils"
2222
)
2323

24-
var (
25-
mode = flag.String("mode", "", "Mode to run in: 'hub' or 'member' (required)")
26-
)
24+
var mode = flag.String("mode", "", "Mode to run in: 'hub' or 'member' (required)")
2725

2826
func main() {
2927
klog.InitFlags(nil)
@@ -58,7 +56,6 @@ func main() {
5856
client, err := client.New(config, client.Options{
5957
Scheme: scheme,
6058
})
61-
6259
if err != nil {
6360
klog.Fatalf("Failed to create Kubernetes client: %v", err)
6461
}
@@ -72,7 +69,7 @@ func main() {
7269
klog.Infof("Successfully installed %s CRDs", *mode)
7370

7471
if err := utils.InstallManagedResourceVAP(ctx, client, *mode); err != nil {
75-
klog.Fatalf("Failed to install managed resource ValidatingAdmissionPolicy: %v", err)
72+
klog.Warningf("Failed to install managed resource ValidatingAdmissionPolicy: %v", err)
7673
}
7774

7875
klog.Infof("Successfully installed %s managed resource ValidatingAdmissionPolicy", *mode)

cmd/crdinstaller/utils/util.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ func InstallCRD(ctx context.Context, client client.Client, crd *apiextensionsv1.
8080
func install(ctx context.Context, client client.Client, obj client.Object, mut func() error) error {
8181
result, err := controllerutil.CreateOrUpdate(ctx, client, obj, mut)
8282
if err != nil {
83-
klog.ErrorS(err, "Failed to create or update", "kind", obj.GetObjectKind().GroupVersionKind().Kind, obj.GetName(), "operation", result)
83+
klog.ErrorS(err, "Failed to create or update", "kind", obj.GetObjectKind().GroupVersionKind().Kind, "name", obj.GetName(), "operation", result)
8484
return err
8585
}
8686
return nil
@@ -181,6 +181,7 @@ func InstallManagedResourceVAP(ctx context.Context, c client.Client, mode string
181181
return err
182182
}
183183
if !ok { // the cluster doesn't support VAP
184+
klog.Infof("Cluster does not support ValidatingAdmissionPolicy, skipping installation")
184185
return nil // not installing
185186
}
186187

docker/crd-installer.Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ RUN go mod download
1111

1212
# Copy the go source
1313
COPY cmd/crdinstaller/ cmd/crdinstaller/
14+
COPY pkg pkg
1415

1516
ARG TARGETARCH
1617

0 commit comments

Comments
 (0)