Skip to content

Commit fc7a7bc

Browse files
authored
Merge pull request #4 from gianlucam76/pins
Update pins
2 parents 011ec93 + 44362ae commit fc7a7bc

File tree

14 files changed

+256
-606
lines changed

14 files changed

+256
-606
lines changed

Makefile

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ help: ## Display this help.
5050
# Directories.
5151
ROOT_DIR:=$(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
5252
TOOLS_DIR := hack/tools
53-
TOOLS_BIN_DIR := $(TOOLS_DIR)/bin
5453
BIN_DIR := bin
54+
TOOLS_BIN_DIR := $(abspath $(TOOLS_DIR)/$(BIN_DIR))
5555

5656
GOBUILD=go build
5757

@@ -71,33 +71,41 @@ KUBECTL := $(TOOLS_BIN_DIR)/kubectl
7171
GOLANGCI_LINT_VERSION := "v1.52.2"
7272

7373
$(CONTROLLER_GEN): $(TOOLS_DIR)/go.mod # Build controller-gen from tools folder.
74-
cd $(TOOLS_DIR); $(GOBUILD) -tags=tools -o $(subst hack/tools/,,$@) sigs.k8s.io/controller-tools/cmd/controller-gen
74+
cd $(TOOLS_DIR); $(GOBUILD) -tags=tools -o $(subst $(TOOLS_DIR)/hack/tools/,,$@) sigs.k8s.io/controller-tools/cmd/controller-gen
7575

7676
$(ENVSUBST): $(TOOLS_DIR)/go.mod # Build envsubst from tools folder.
77-
cd $(TOOLS_DIR); $(GOBUILD) -tags=tools -o $(subst hack/tools/,,$@) github.com/a8m/envsubst/cmd/envsubst
78-
79-
$(KUSTOMIZE): $(TOOLS_DIR)/go.mod # Build kustomize from tools folder.
80-
cd $(TOOLS_DIR); $(GOBUILD) -tags=tools -o $(BIN_DIR)/kustomize sigs.k8s.io/kustomize/kustomize/v4
77+
cd $(TOOLS_DIR); $(GOBUILD) -tags=tools -o $(subst $(TOOLS_DIR)/hack/tools/,,$@) github.com/a8m/envsubst/cmd/envsubst
8178

8279
$(GOLANGCI_LINT): # Build golangci-lint from tools folder.
8380
cd $(TOOLS_DIR); ./get-golangci-lint.sh $(GOLANGCI_LINT_VERSION)
8481

8582
$(SETUP_ENVTEST): $(TOOLS_DIR)/go.mod # Build setup-envtest from tools folder.
86-
cd $(TOOLS_DIR); $(GOBUILD) -tags=tools -o $(subst hack/tools/,,$@) sigs.k8s.io/controller-runtime/tools/setup-envtest
83+
cd $(TOOLS_DIR); $(GOBUILD) -tags=tools -o $(subst $(TOOLS_DIR)/hack/tools/,,$@) sigs.k8s.io/controller-runtime/tools/setup-envtest
8784

8885
$(GOIMPORTS):
89-
cd $(TOOLS_DIR); $(GOBUILD) -tags=tools -o $(subst hack/tools/,,$@) golang.org/x/tools/cmd/goimports
86+
cd $(TOOLS_DIR); $(GOBUILD) -tags=tools -o $(subst $(TOOLS_DIR)/hack/tools/,,$@) golang.org/x/tools/cmd/goimports
9087

9188
$(GINKGO): $(TOOLS_DIR)/go.mod
92-
cd $(TOOLS_DIR) && $(GOBUILD) -tags tools -o $(subst hack/tools/,,$@) github.com/onsi/ginkgo/v2/ginkgo
89+
cd $(TOOLS_DIR) && $(GOBUILD) -tags tools -o $(subst $(TOOLS_DIR)/hack/tools/,,$@) github.com/onsi/ginkgo/v2/ginkgo
9390

9491
$(KIND): $(TOOLS_DIR)/go.mod
95-
cd $(TOOLS_DIR) && $(GOBUILD) -tags tools -o $(subst hack/tools/,,$@) sigs.k8s.io/kind
92+
cd $(TOOLS_DIR) && $(GOBUILD) -tags tools -o $(subst $(TOOLS_DIR)/hack/tools/,,$@) sigs.k8s.io/kind
93+
94+
$(CLUSTERCTL): $(TOOLS_DIR)/go.mod ## Build clusterctl binary
95+
cd $(TOOLS_DIR); $(GOBUILD) -trimpath -ldflags $(CLUSTERAPI_LDFLAGS) -o $(subst $(TOOLS_DIR)/hack/tools/,,$@) sigs.k8s.io/cluster-api/cmd/clusterctl
96+
mkdir -p $(HOME)/.cluster-api # create cluster api init directory, if not present
9697

9798
$(KUBECTL):
9899
curl -L https://storage.googleapis.com/kubernetes-release/release/$(K8S_LATEST_VER)/bin/$(OS)/$(ARCH)/kubectl -o $@
99100
chmod +x $@
100101

102+
KUSTOMIZE_VER := v4.5.2
103+
KUSTOMIZE_BIN := kustomize
104+
KUSTOMIZE := $(abspath $(TOOLS_BIN_DIR)/$(KUSTOMIZE_BIN)-$(KUSTOMIZE_VER))
105+
KUSTOMIZE_PKG := sigs.k8s.io/kustomize/kustomize/v4
106+
$(KUSTOMIZE): # Build kustomize from tools folder.
107+
CGO_ENABLED=0 GOBIN=$(TOOLS_BIN_DIR) $(GO_INSTALL) $(KUSTOMIZE_PKG) $(KUSTOMIZE_BIN) $(KUSTOMIZE_VER)
108+
101109
.PHONY: tools
102110
tools: $(CONTROLLER_GEN) $(ENVSUBST) $(KUSTOMIZE) $(GOLANGCI_LINT) $(SETUP_ENVTEST) $(GOIMPORTS) $(GINKGO) $(KIND) $(KUBECTL) ## build all tools
103111

@@ -158,7 +166,7 @@ TIMEOUT ?= 10m
158166

159167
.PHONY: fv
160168
fv: $(GINKGO) ## Run Sveltos Controller tests using existing cluster
161-
cd test/fv; ../../$(GINKGO) -nodes $(NUM_NODES) --label-filter='FV' --v --trace --randomize-all
169+
cd test/fv; $(GINKGO) -nodes $(NUM_NODES) --label-filter='FV' --v --trace --randomize-all
162170

163171
.PHONY: create-cluster
164172
create-cluster: $(KIND) $(KUBECTL) $(ENVSUBST) ## Create a new kind cluster designed for development
@@ -185,7 +193,7 @@ deploy-jsonnet-controller: $(KUSTOMIZE)
185193

186194
# Install jsonnet-controller
187195
@echo 'Install jsonnet-controller'
188-
cd config/manager && ../../$(KUSTOMIZE) edit set image controller=${IMG}
196+
cd config/manager && $(KUSTOMIZE) edit set image controller=${IMG}
189197
$(KUSTOMIZE) build config/default | $(ENVSUBST) | $(KUBECTL) apply -f-
190198

191199
@echo "Waiting for jsonnet-controller to be available..."

config/crd/bases/extension.projectsveltos.io_jsonnetsources.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
33
kind: CustomResourceDefinition
44
metadata:
55
annotations:
6-
controller-gen.kubebuilder.io/version: v0.11.4
6+
controller-gen.kubebuilder.io/version: v0.12.0
77
name: jsonnetsources.extension.projectsveltos.io
88
spec:
99
group: extension.projectsveltos.io

controllers/controllers_suite_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ import (
77
. "github.com/onsi/gomega"
88

99
"k8s.io/apimachinery/pkg/runtime"
10+
"k8s.io/klog/v2"
11+
ctrl "sigs.k8s.io/controller-runtime"
1012
)
1113

1214
var (
@@ -21,6 +23,8 @@ func TestControllers(t *testing.T) {
2123
var _ = BeforeSuite(func() {
2224
By("bootstrapping test environment")
2325

26+
ctrl.SetLogger(klog.Background())
27+
2428
var err error
2529
scheme, err = setupScheme()
2630
Expect(err).To(BeNil())

controllers/jsonnetsource_controller.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ func (r *JsonnetSourceReconciler) SetupWithManager(mgr ctrl.Manager,
219219

220220
// When ConfigMap changes, according to ConfigMapPredicates,
221221
// one or more ClusterSummaries need to be reconciled.
222-
err = c.Watch(&source.Kind{Type: &corev1.ConfigMap{}},
222+
err = c.Watch(source.Kind(mgr.GetCache(), &corev1.ConfigMap{}),
223223
handler.EnqueueRequestsFromMapFunc(r.requeueJsonnetSourceForReference),
224224
ConfigMapPredicates(mgr.GetLogger().WithValues("predicate", "configmappredicate")),
225225
)
@@ -229,7 +229,7 @@ func (r *JsonnetSourceReconciler) SetupWithManager(mgr ctrl.Manager,
229229

230230
// When Secret changes, according to SecretPredicates,
231231
// one or more ClusterSummaries need to be reconciled.
232-
err = c.Watch(&source.Kind{Type: &corev1.Secret{}},
232+
err = c.Watch(source.Kind(mgr.GetCache(), &corev1.Secret{}),
233233
handler.EnqueueRequestsFromMapFunc(r.requeueJsonnetSourceForReference),
234234
SecretPredicates(mgr.GetLogger().WithValues("predicate", "secretpredicate")),
235235
)
@@ -241,23 +241,23 @@ func (r *JsonnetSourceReconciler) WatchForFlux(mgr ctrl.Manager, c controller.Co
241241
// When a Flux source (GitRepository/OCIRepository/Bucket) changes, one or more ClusterSummaries
242242
// need to be reconciled.
243243

244-
err := c.Watch(&source.Kind{Type: &sourcev1.GitRepository{}},
244+
err := c.Watch(source.Kind(mgr.GetCache(), &sourcev1.GitRepository{}),
245245
handler.EnqueueRequestsFromMapFunc(r.requeueJsonnetSourceForFluxSources),
246246
FluxSourcePredicates(r.Scheme, mgr.GetLogger().WithValues("predicate", "fluxsourcepredicate")),
247247
)
248248
if err != nil {
249249
return err
250250
}
251251

252-
err = c.Watch(&source.Kind{Type: &sourcev1b2.OCIRepository{}},
252+
err = c.Watch(source.Kind(mgr.GetCache(), &sourcev1b2.OCIRepository{}),
253253
handler.EnqueueRequestsFromMapFunc(r.requeueJsonnetSourceForFluxSources),
254254
FluxSourcePredicates(r.Scheme, mgr.GetLogger().WithValues("predicate", "fluxsourcepredicate")),
255255
)
256256
if err != nil {
257257
return err
258258
}
259259

260-
return c.Watch(&source.Kind{Type: &sourcev1b2.Bucket{}},
260+
return c.Watch(source.Kind(mgr.GetCache(), &sourcev1b2.Bucket{}),
261261
handler.EnqueueRequestsFromMapFunc(r.requeueJsonnetSourceForFluxSources),
262262
FluxSourcePredicates(r.Scheme, mgr.GetLogger().WithValues("predicate", "fluxsourcepredicate")),
263263
)

controllers/jsonnetsource_transformations.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ limitations under the License.
1717
package controllers
1818

1919
import (
20+
"context"
2021
"fmt"
2122

2223
corev1 "k8s.io/api/core/v1"
@@ -33,7 +34,7 @@ import (
3334
)
3435

3536
func (r *JsonnetSourceReconciler) requeueJsonnetSourceForFluxSources(
36-
o client.Object,
37+
ctx context.Context, o client.Object,
3738
) []reconcile.Request {
3839

3940
logger := klogr.New().WithValues(
@@ -100,7 +101,7 @@ func (r *JsonnetSourceReconciler) requeueJsonnetSourceForFluxSources(
100101
}
101102

102103
func (r *JsonnetSourceReconciler) requeueJsonnetSourceForReference(
103-
o client.Object,
104+
ctx context.Context, o client.Object,
104105
) []reconcile.Request {
105106

106107
logger := klogr.New().WithValues(

controllers/jsonnetsource_transformations_test.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ limitations under the License.
1717
package controllers_test
1818

1919
import (
20+
"context"
2021
"sync"
2122

2223
sourcev1 "github.com/fluxcd/source-controller/api/v1"
@@ -96,7 +97,7 @@ var _ = Describe("JsonnetSourceTransformation map functions", func() {
9697
Kind: extensionv1alpha1.JsonnetSourceKind, Namespace: JsonnetSource0.Namespace, Name: JsonnetSource0.Name})
9798
reconciler.ReferenceMap[key] = &set
9899

99-
requests := controllers.RequeueJsonnetSourceForReference(reconciler, configMap)
100+
requests := controllers.RequeueJsonnetSourceForReference(reconciler, context.TODO(), configMap)
100101
Expect(requests).To(HaveLen(1))
101102
Expect(requests[0].Name).To(Equal(JsonnetSource0.Name))
102103
Expect(requests[0].Namespace).To(Equal(JsonnetSource0.Namespace))
@@ -105,7 +106,7 @@ var _ = Describe("JsonnetSourceTransformation map functions", func() {
105106
Kind: extensionv1alpha1.JsonnetSourceKind, Namespace: JsonnetSource1.Namespace, Name: JsonnetSource1.Name})
106107
reconciler.ReferenceMap[key] = &set
107108

108-
requests = controllers.RequeueJsonnetSourceForReference(reconciler, configMap)
109+
requests = controllers.RequeueJsonnetSourceForReference(reconciler, context.TODO(), configMap)
109110
Expect(requests).To(HaveLen(2))
110111
Expect(requests).To(ContainElement(
111112
reconcile.Request{NamespacedName: types.NamespacedName{Namespace: JsonnetSource0.Namespace, Name: JsonnetSource0.Name}}))
@@ -173,7 +174,7 @@ var _ = Describe("JsonnetSourceTransformation map functions", func() {
173174
Kind: extensionv1alpha1.JsonnetSourceKind, Namespace: JsonnetSource0.Namespace, Name: JsonnetSource0.Name})
174175
reconciler.ReferenceMap[key] = &set
175176

176-
requests := controllers.RequeueJsonnetSourceForFluxSources(reconciler, gitRepo)
177+
requests := controllers.RequeueJsonnetSourceForFluxSources(reconciler, context.TODO(), gitRepo)
177178
Expect(requests).To(HaveLen(1))
178179
Expect(requests[0].Name).To(Equal(JsonnetSource0.Name))
179180
Expect(requests[0].Namespace).To(Equal(JsonnetSource0.Namespace))
@@ -182,7 +183,7 @@ var _ = Describe("JsonnetSourceTransformation map functions", func() {
182183
Kind: extensionv1alpha1.JsonnetSourceKind, Namespace: JsonnetSource1.Namespace, Name: JsonnetSource1.Name})
183184
reconciler.ReferenceMap[key] = &set
184185

185-
requests = controllers.RequeueJsonnetSourceForFluxSources(reconciler, gitRepo)
186+
requests = controllers.RequeueJsonnetSourceForFluxSources(reconciler, context.TODO(), gitRepo)
186187
Expect(requests).To(HaveLen(2))
187188
Expect(requests).To(ContainElement(
188189
reconcile.Request{NamespacedName: types.NamespacedName{Namespace: JsonnetSource0.Namespace, Name: JsonnetSource0.Name}}))

go.mod

Lines changed: 37 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,25 @@ go 1.20
44

55
require (
66
github.com/TwinProduction/go-color v1.0.0
7-
github.com/fluxcd/pkg/http/fetch v0.5.1
7+
github.com/fluxcd/pkg/http/fetch v0.5.2
88
github.com/fluxcd/pkg/tar v0.2.0
99
github.com/fluxcd/source-controller/api v1.0.0-rc.1
1010
github.com/ghodss/yaml v1.0.0
1111
github.com/go-logr/logr v1.2.4
1212
github.com/google/go-jsonnet v0.20.0
13-
github.com/onsi/ginkgo/v2 v2.9.5
14-
github.com/onsi/gomega v1.27.7
13+
github.com/onsi/ginkgo/v2 v2.11.0
14+
github.com/onsi/gomega v1.27.8
1515
github.com/pkg/errors v0.9.1
16-
github.com/projectsveltos/libsveltos v0.10.1
16+
github.com/projectsveltos/libsveltos v0.11.1-0.20230628113144-daba703872d6
1717
github.com/spf13/pflag v1.0.5
18-
k8s.io/api v0.26.1
19-
k8s.io/apiextensions-apiserver v0.26.1
20-
k8s.io/apimachinery v0.26.3
21-
k8s.io/client-go v0.26.1
22-
k8s.io/component-base v0.26.1
23-
k8s.io/klog/v2 v2.80.1
24-
sigs.k8s.io/cluster-api v1.4.2
25-
sigs.k8s.io/controller-runtime v0.14.6
18+
k8s.io/api v0.27.2
19+
k8s.io/apiextensions-apiserver v0.27.2
20+
k8s.io/apimachinery v0.27.2
21+
k8s.io/client-go v0.27.2
22+
k8s.io/component-base v0.27.2
23+
k8s.io/klog/v2 v2.90.1
24+
sigs.k8s.io/cluster-api v1.5.0-beta.0
25+
sigs.k8s.io/controller-runtime v0.15.0
2626
)
2727

2828
// Replace digest lib to master to gather access to BLAKE3.
@@ -32,7 +32,8 @@ replace github.com/opencontainers/go-digest => github.com/opencontainers/go-dige
3232
require (
3333
github.com/beorn7/perks v1.0.1 // indirect
3434
github.com/blang/semver v3.5.1+incompatible // indirect
35-
github.com/cespare/xxhash/v2 v2.1.2 // indirect
35+
github.com/blang/semver/v4 v4.0.0 // indirect
36+
github.com/cespare/xxhash/v2 v2.2.0 // indirect
3637
github.com/cyphar/filepath-securejoin v0.2.3 // indirect
3738
github.com/davecgh/go-spew v1.1.1 // indirect
3839
github.com/emicklei/go-restful/v3 v3.9.0 // indirect
@@ -41,8 +42,8 @@ require (
4142
github.com/fluxcd/pkg/apis/acl v0.1.0 // indirect
4243
github.com/fluxcd/pkg/apis/meta v1.0.0 // indirect
4344
github.com/fsnotify/fsnotify v1.6.0 // indirect
44-
github.com/go-openapi/jsonpointer v0.19.5 // indirect
45-
github.com/go-openapi/jsonreference v0.20.0 // indirect
45+
github.com/go-openapi/jsonpointer v0.19.6 // indirect
46+
github.com/go-openapi/jsonreference v0.20.1 // indirect
4647
github.com/go-openapi/swag v0.22.3 // indirect
4748
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 // indirect
4849
github.com/gobuffalo/flect v1.0.2 // indirect
@@ -52,44 +53,44 @@ require (
5253
github.com/google/gnostic v0.6.9 // indirect
5354
github.com/google/go-cmp v0.5.9 // indirect
5455
github.com/google/gofuzz v1.2.0 // indirect
55-
github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38 // indirect
56+
github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1 // indirect
5657
github.com/google/uuid v1.3.0 // indirect
5758
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
58-
github.com/hashicorp/go-retryablehttp v0.7.2 // indirect
59+
github.com/hashicorp/go-retryablehttp v0.7.4 // indirect
5960
github.com/imdario/mergo v0.3.13 // indirect
60-
github.com/inconshreveable/mousetrap v1.0.1 // indirect
61+
github.com/inconshreveable/mousetrap v1.1.0 // indirect
6162
github.com/josharian/intern v1.0.0 // indirect
6263
github.com/json-iterator/go v1.1.12 // indirect
6364
github.com/mailru/easyjson v0.7.7 // indirect
64-
github.com/matttproud/golang_protobuf_extensions v1.0.2 // indirect
65+
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
6566
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
6667
github.com/modern-go/reflect2 v1.0.2 // indirect
6768
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
6869
github.com/opencontainers/go-digest v1.0.0 // indirect
6970
github.com/opencontainers/go-digest/blake3 v0.0.0-20230329235805-65fac7b55eb7 // indirect
70-
github.com/prometheus/client_golang v1.14.0 // indirect
71-
github.com/prometheus/client_model v0.3.0 // indirect
72-
github.com/prometheus/common v0.37.0 // indirect
73-
github.com/prometheus/procfs v0.8.0 // indirect
74-
github.com/spf13/cobra v1.6.1 // indirect
71+
github.com/prometheus/client_golang v1.16.0 // indirect
72+
github.com/prometheus/client_model v0.4.0 // indirect
73+
github.com/prometheus/common v0.42.0 // indirect
74+
github.com/prometheus/procfs v0.10.1 // indirect
75+
github.com/spf13/cobra v1.7.0 // indirect
7576
github.com/zeebo/blake3 v0.1.1 // indirect
76-
golang.org/x/net v0.10.0 // indirect
77-
golang.org/x/oauth2 v0.6.0 // indirect
78-
golang.org/x/sys v0.8.0 // indirect
79-
golang.org/x/term v0.8.0 // indirect
80-
golang.org/x/text v0.9.0 // indirect
77+
golang.org/x/net v0.11.0 // indirect
78+
golang.org/x/oauth2 v0.9.0 // indirect
79+
golang.org/x/sys v0.9.0 // indirect
80+
golang.org/x/term v0.9.0 // indirect
81+
golang.org/x/text v0.10.0 // indirect
8182
golang.org/x/time v0.3.0 // indirect
82-
golang.org/x/tools v0.9.1 // indirect
83-
gomodules.xyz/jsonpatch/v2 v2.2.0 // indirect
83+
golang.org/x/tools v0.9.3 // indirect
84+
gomodules.xyz/jsonpatch/v2 v2.3.0 // indirect
8485
google.golang.org/appengine v1.6.7 // indirect
85-
google.golang.org/protobuf v1.28.1 // indirect
86+
google.golang.org/protobuf v1.30.0 // indirect
8687
gopkg.in/inf.v0 v0.9.1 // indirect
8788
gopkg.in/yaml.v2 v2.4.0 // indirect
8889
gopkg.in/yaml.v3 v3.0.1 // indirect
89-
k8s.io/kube-openapi v0.0.0-20221012153701-172d655c2280 // indirect
90-
k8s.io/kubectl v0.26.0 // indirect
91-
k8s.io/utils v0.0.0-20221128185143-99ec85e7a448 // indirect
92-
sigs.k8s.io/json v0.0.0-20220713155537-f223a00ba0e2 // indirect
90+
k8s.io/kube-openapi v0.0.0-20230501164219-8b0f38b5fd1f // indirect
91+
k8s.io/kubectl v0.27.2 // indirect
92+
k8s.io/utils v0.0.0-20230209194617-a36077c30491 // indirect
93+
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
9394
sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect
9495
sigs.k8s.io/yaml v1.3.0 // indirect
9596
)

0 commit comments

Comments
 (0)