Skip to content

Commit

Permalink
updated alpine to latest and vulnerabilities are resolved and address…
Browse files Browse the repository at this point in the history
…ed review comments

Signed-off-by: niravparikh05 <nir.parikh05@gmail.com>
  • Loading branch information
niravparikh05 committed Jun 26, 2023
1 parent 2f5d89f commit e214239
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 27 deletions.
4 changes: 1 addition & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ RUN go mod download
COPY . .
RUN make build

# pinning to 3.14.10 which does not have any vulnerabilities
# track https://hub.docker.com/_/alpine/tags for vulnerability fixes in latest version and move back to using latest
FROM alpine:3.14.10 as runtime
FROM alpine:latest as runtime
LABEL description="Run container"

WORKDIR /usr/bin
Expand Down
4 changes: 1 addition & 3 deletions Dockerfile.initialize
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ RUN wget -O migrate.tar.gz -q https://github.com/golang-migrate/migrate/releases
COPY . /build
RUN go build -ldflags "-s" -o paralus-init scripts/initialize/main.go

# pinning to 3.14.10 which does not have any vulnerabilities
# track https://hub.docker.com/_/alpine/tags for vulnerability fixes in latest version and move back to using latest
FROM alpine:3.14.10 as runtime
FROM alpine:latest as runtime
LABEL description="Run container"

WORKDIR /usr/bin
Expand Down
4 changes: 1 addition & 3 deletions Dockerfile.synchronizer
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ COPY . /build
WORKDIR /build
RUN go build -ldflags "-s" -o start-sync scripts/kratos/providers_sync.go

# pinning to 3.14.10 which does not have any vulnerabilities
# track https://hub.docker.com/_/alpine/tags for vulnerability fixes in latest version and move back to using latest
FROM alpine:3.14.10 as runtime
FROM alpine:latest as runtime
LABEL description="Run container"

WORKDIR /usr/bin
Expand Down
2 changes: 1 addition & 1 deletion internal/cluster/fixtures/data/download.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ metadata:
app.kubernetes.io/managed-by: paralus
data:
clusterID: {{if .Cluster.Metadata.Labels}}{{ index .Cluster.Metadata.Labels "paralus.dev/clusterID" }}{{end}}
relays: '{{if .Cluster.Metadata.Annotations}}{{- index .Cluster.Metadata.Annotations "relays" -}}{{end}}'
relays: '{{if .Cluster.Metadata.Annotations}}{{- index .Cluster.Metadata.Annotations "paralus.dev/relays" -}}{{end}}'
---
apiVersion: apps/v1
kind: Deployment
Expand Down
2 changes: 1 addition & 1 deletion pkg/reconcile/cluster_reconciler.go
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ func (r *clusterReconciler) handleClusterBootstrapAgent(ctx context.Context, clu
ctx, cancel := context.WithTimeout(context.Background(), time.Second*10)
defer cancel()

fmt.Print("annotations in reconciler :: ", cluster.Metadata.Annotations)
_log.Info("annotations in reconciler :: ", cluster.Metadata.Annotations)

err := r.cs.UpdateStatus(ctx, &infrav3.Cluster{
Metadata: cluster.Metadata,
Expand Down
17 changes: 1 addition & 16 deletions pkg/service/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -555,24 +555,9 @@ func (s *clusterService) Update(ctx context.Context, cluster *infrav3.Cluster) (
cdb.ShareMode = cluster.Spec.ShareMode.String()
cdb.Labels = json.RawMessage(lbsBytes)

// validate cluster annotation to retain the relay information within annotations
existingAnnotations := make(map[string]string)
if cdb.Annotations != nil {
if err = json.Unmarshal(cdb.Annotations, &existingAnnotations); err != nil {
return nil, err
}
}
if len(cluster.Metadata.Annotations) > 0 {
if existingAnnotations["relays"] != cluster.Metadata.Annotations["relays"] {
_log.Warn("relays annotation populated during cluster bootstrapping is readonly, ignoring updates from user")
}
cluster.Metadata.Annotations["relays"] = existingAnnotations["relays"]
annBytes, _ := json.Marshal(cluster.Metadata.Annotations)
cdb.Annotations = json.RawMessage(annBytes)
} else {
// update back the relay information
cluster.Metadata.Annotations = make(map[string]string)
cluster.Metadata.Annotations["relays"] = existingAnnotations["relays"]
}

//location of cluster is updated
Expand Down Expand Up @@ -1017,7 +1002,7 @@ func (s *clusterService) CreateBootstrapAgentForCluster(ctx context.Context, clu
if cluster.Metadata.Annotations == nil {
cluster.Metadata.Annotations = make(map[string]string)
}
cluster.Metadata.Annotations["relays"] = string(relaysBytes)
cluster.Metadata.Annotations["paralus.dev/relays"] = string(relaysBytes)

return nil
}
Expand Down

0 comments on commit e214239

Please sign in to comment.