Skip to content

Commit

Permalink
Merge pull request #301 from gianlucam76/v0.15.1
Browse files Browse the repository at this point in the history
V0.15.1
  • Loading branch information
gianlucam76 authored Aug 17, 2023
2 parents a6f295f + b135c26 commit d0bc55e
Show file tree
Hide file tree
Showing 12 changed files with 830 additions and 138 deletions.
63 changes: 45 additions & 18 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ ARCH ?= amd64
OS ?= $(shell uname -s | tr A-Z a-z)
K8S_LATEST_VER ?= $(shell curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)
export CONTROLLER_IMG ?= $(REGISTRY)/$(IMAGE_NAME)
TAG ?= v0.15.0
TAG ?= v0.15.1

# Get cluster-api version and build ldflags
clusterapi := $(shell go list -m sigs.k8s.io/cluster-api)
Expand Down Expand Up @@ -177,6 +177,29 @@ TIMEOUT ?= 10m
KIND_CLUSTER_YAML ?= test/$(WORKLOAD_CLUSTER_NAME).yaml
NUM_NODES ?= 5

.PHONY: quickstart
quickstart: ## start kind cluster; install all cluster api components; create a capi cluster; install projectsveltos
$(MAKE) create-control-cluster

@echo wait for capd-system pod
$(KUBECTL) wait --for=condition=Available deployment/capd-controller-manager -n capd-system --timeout=$(TIMEOUT)
$(KUBECTL) wait --for=condition=Available deployment/capi-kubeadm-control-plane-controller-manager -n capi-kubeadm-control-plane-system --timeout=$(TIMEOUT)

$(MAKE) create-workload-cluster

# this is needed fopr projectsveltos metrics
$(KUBECTL) apply -f test/quickstart/servicemonitor_crd.yaml

@echo "Start projectsveltos"
$(KUBECTL) apply -f https://raw.githubusercontent.com/projectsveltos/sveltos/$(TAG)/manifest/manifest.yaml
$(KUBECTL) apply -f https://raw.githubusercontent.com/projectsveltos/sveltos/$(TAG)/manifest/default-classifier.yaml
$(KUBECTL) apply -f https://raw.githubusercontent.com/projectsveltos/sveltos/main/manifest/sveltosctl_manifest.yaml

sleep 5

@echo "Waiting for projectsveltos addon-controller to be available..."
$(KUBECTL) wait --for=condition=Available deployment/addon-controller -n projectsveltos --timeout=$(TIMEOUT)

.PHONY: test
test: | check-manifests generate fmt vet $(SETUP_ENVTEST) ## Run uts.
KUBEBUILDER_ASSETS="$(KUBEBUILDER_ASSETS)" go test $(shell go list ./... |grep -v test/fv |grep -v test/helpers) $(TEST_ARGS) -coverprofile cover.out
Expand All @@ -199,27 +222,11 @@ create-cluster: $(KIND) $(CLUSTERCTL) $(KUBECTL) $(ENVSUBST) ## Create a new kin
@echo "Start projectsveltos"
$(MAKE) deploy-projectsveltos

@echo "Create a workload cluster"
$(KUBECTL) apply -f $(KIND_CLUSTER_YAML)

@echo "wait for cluster to be provisioned"
$(KUBECTL) wait cluster $(WORKLOAD_CLUSTER_NAME) -n default --for=jsonpath='{.status.phase}'=Provisioned --timeout=$(TIMEOUT)
$(MAKE) create-workload-cluster

@echo "prepare configMap with kustomize files"
$(KUBECTL) create configmap kustomize --from-file=test/kustomize.tar.gz

@echo "sleep allowing control plane to be ready"
sleep 100

@echo "get kubeconfig to access workload cluster"
$(KIND) get kubeconfig --name $(WORKLOAD_CLUSTER_NAME) > test/fv/workload_kubeconfig

@echo "install calico on workload cluster"
$(KUBECTL) --kubeconfig=./test/fv/workload_kubeconfig apply -f https://raw.githubusercontent.com/projectcalico/calico/v3.26.0/manifests/calico.yaml

@echo wait for calico pod
$(KUBECTL) --kubeconfig=./test/fv/workload_kubeconfig wait --for=condition=Available deployment/calico-kube-controllers -n kube-system --timeout=$(TIMEOUT)

@echo apply reloader CRD to managed cluster
$(KUBECTL) --kubeconfig=./test/fv/workload_kubeconfig apply -f https://raw.githubusercontent.com/projectsveltos/libsveltos/$(TAG)/config/crd/bases/lib.projectsveltos.io_reloaders.yaml

Expand All @@ -236,6 +243,7 @@ delete-cluster: $(KIND) ## Deletes the kind cluster $(CONTROL_CLUSTER_NAME)
#
# add this target. It needs to be run only when changing cluster-api version. create-cluster target uses the output of this command which is stored within repo
# It requires control cluster to exist. So first "make create-control-cluster" then run this target.
# Once generated, add label to cluster env: fv
# Once generated, remove
# enforce: "{{ .podSecurityStandard.enforce }}"
# enforce-version: "latest"
Expand All @@ -250,6 +258,25 @@ create-control-cluster: $(KIND) $(CLUSTERCTL)
@echo "Create control cluster with docker as infrastructure provider"
CLUSTER_TOPOLOGY=true $(CLUSTERCTL) init --infrastructure docker

create-workload-cluster: $(KIND) $(KUBECTL)
@echo "Create a workload cluster"
$(KUBECTL) apply -f $(KIND_CLUSTER_YAML)

@echo "wait for cluster to be provisioned"
$(KUBECTL) wait cluster $(WORKLOAD_CLUSTER_NAME) -n default --for=jsonpath='{.status.phase}'=Provisioned --timeout=$(TIMEOUT)

@echo "sleep allowing control plane to be ready"
sleep 100

@echo "get kubeconfig to access workload cluster"
$(KIND) get kubeconfig --name $(WORKLOAD_CLUSTER_NAME) > test/fv/workload_kubeconfig

@echo "install calico on workload cluster"
$(KUBECTL) --kubeconfig=./test/fv/workload_kubeconfig apply -f https://raw.githubusercontent.com/projectcalico/calico/v3.26.0/manifests/calico.yaml

@echo wait for calico pod
$(KUBECTL) --kubeconfig=./test/fv/workload_kubeconfig wait --for=condition=Available deployment/calico-kube-controllers -n kube-system --timeout=$(TIMEOUT)

deploy-projectsveltos: $(KUSTOMIZE)
# Load projectsveltos image into cluster
@echo 'Load projectsveltos image into cluster'
Expand Down
3 changes: 2 additions & 1 deletion api/v1alpha1/clusterprofile_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,8 @@ type PolicyRef struct {
// Namespace of the referenced resource.
// Namespace can be left empty. In such a case, namespace will
// be implicit set to cluster's namespace.
Namespace string `json:"namespace"`
// +optional
Namespace string `json:"namespace,omitempty"`

// Name of the referenced resource.
// +kubebuilder:validation:MinLength=1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,6 @@ spec:
required:
- kind
- name
- namespace
type: object
type: array
reloader:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,6 @@ spec:
required:
- kind
- name
- namespace
type: object
type: array
reloader:
Expand Down
2 changes: 1 addition & 1 deletion config/default/manager_image_patch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ spec:
spec:
containers:
# Change the value of image field below to your controller image URL
- image: projectsveltos/addon-controller-amd64:v0.15.0
- image: projectsveltos/addon-controller-amd64:v0.15.1
name: controller
44 changes: 21 additions & 23 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -17,30 +17,26 @@ require (
github.com/onsi/ginkgo/v2 v2.11.0
github.com/onsi/gomega v1.27.8
github.com/pkg/errors v0.9.1
github.com/projectsveltos/libsveltos v0.15.0
github.com/projectsveltos/libsveltos v0.15.1
github.com/prometheus/client_golang v1.16.0
github.com/spf13/pflag v1.0.5
github.com/yuin/gopher-lua v1.1.0
golang.org/x/text v0.11.0
gopkg.in/yaml.v2 v2.4.0
helm.sh/helm/v3 v3.12.1
k8s.io/api v0.27.2
k8s.io/apiextensions-apiserver v0.27.2
helm.sh/helm/v3 v3.12.3
k8s.io/api v0.27.3
k8s.io/apiextensions-apiserver v0.27.3
k8s.io/apimachinery v0.27.3
k8s.io/client-go v0.27.2
k8s.io/component-base v0.27.2
k8s.io/klog/v2 v2.90.1
k8s.io/client-go v0.27.3
k8s.io/component-base v0.27.3
k8s.io/klog/v2 v2.100.1
k8s.io/utils v0.0.0-20230505201702-9f6742963106
sigs.k8s.io/cluster-api v1.5.0
sigs.k8s.io/controller-runtime v0.15.0
sigs.k8s.io/kustomize/api v0.13.2
sigs.k8s.io/kustomize/kyaml v0.14.1
)

// Replace digest lib to master to gather access to BLAKE3.
// xref: https://github.com/opencontainers/go-digest/pull/66
replace github.com/opencontainers/go-digest => github.com/opencontainers/go-digest v1.0.1-0.20220411205349-bde1400a84be

require (
github.com/AdaLogics/go-fuzz-headers v0.0.0-20230106234847-43070de90fa1 // indirect
github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 // indirect
Expand All @@ -50,7 +46,7 @@ require (
github.com/Masterminds/semver/v3 v3.2.1 // indirect
github.com/Masterminds/sprig/v3 v3.2.3 // indirect
github.com/Masterminds/squirrel v1.5.4 // indirect
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 // indirect
github.com/asaskevich/govalidator v0.0.0-20200428143746-21a406dcc535 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/blang/semver v3.5.1+incompatible // indirect
github.com/blang/semver/v4 v4.0.0 // indirect
Expand All @@ -59,9 +55,9 @@ require (
github.com/containerd/containerd v1.7.0 // indirect
github.com/cyphar/filepath-securejoin v0.2.3 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/docker/cli v20.10.21+incompatible // indirect
github.com/docker/cli v23.0.1+incompatible // indirect
github.com/docker/distribution v2.8.2+incompatible // indirect
github.com/docker/docker v20.10.24+incompatible // indirect
github.com/docker/docker v23.0.1+incompatible // indirect
github.com/docker/docker-credential-helpers v0.7.0 // indirect
github.com/docker/go-connections v0.4.0 // indirect
github.com/docker/go-metrics v0.0.1 // indirect
Expand All @@ -78,7 +74,7 @@ require (
github.com/go-gorp/gorp/v3 v3.0.5 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-openapi/jsonpointer v0.19.6 // indirect
github.com/go-openapi/jsonreference v0.20.2 // indirect
github.com/go-openapi/jsonreference v0.20.1 // indirect
github.com/go-openapi/swag v0.22.3 // indirect
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 // indirect
github.com/gobuffalo/flect v1.0.2 // indirect
Expand All @@ -95,7 +91,7 @@ require (
github.com/google/uuid v1.3.0 // indirect
github.com/gorilla/mux v1.8.0 // indirect
github.com/gosuri/uitable v0.0.4 // indirect
github.com/gregjones/httpcache v0.0.0-20190611155906-901d90724c79 // indirect
github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect
Expand All @@ -118,7 +114,7 @@ require (
github.com/mattn/go-runewidth v0.0.14 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
github.com/mitchellh/copystructure v1.2.0 // indirect
github.com/mitchellh/go-wordwrap v1.0.1 // indirect
github.com/mitchellh/go-wordwrap v1.0.0 // indirect
github.com/mitchellh/reflectwalk v1.0.2 // indirect
github.com/moby/locker v1.0.1 // indirect
github.com/moby/spdystream v0.2.0 // indirect
Expand Down Expand Up @@ -147,7 +143,7 @@ require (
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
github.com/xeipuuv/gojsonschema v1.2.0 // indirect
github.com/xlab/treeprint v1.2.0 // indirect
github.com/xlab/treeprint v1.1.0 // indirect
github.com/zeebo/blake3 v0.1.1 // indirect
go.opentelemetry.io/otel v1.14.0 // indirect
go.opentelemetry.io/otel/trace v1.14.0 // indirect
Expand All @@ -167,14 +163,16 @@ require (
google.golang.org/protobuf v1.31.0 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/apiserver v0.27.2 // indirect
k8s.io/cli-runtime v0.27.2 // indirect
k8s.io/apiserver v0.27.3 // indirect
k8s.io/cli-runtime v0.27.3 // indirect
k8s.io/kube-openapi v0.0.0-20230501164219-8b0f38b5fd1f // indirect
k8s.io/kubectl v0.27.2 // indirect
oras.land/oras-go v1.2.2 // indirect
k8s.io/kubectl v0.27.3 // indirect
oras.land/oras-go v1.2.3 // indirect
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect
sigs.k8s.io/yaml v1.3.0 // indirect
)

replace sigs.k8s.io/json => sigs.k8s.io/json v0.0.0-20211208200746-9f7c6b3444d2
// Replace digest lib to master to gather access to BLAKE3.
// xref: https://github.com/opencontainers/go-digest/pull/66
replace github.com/opencontainers/go-digest => github.com/opencontainers/go-digest v1.0.1-0.20220411205349-bde1400a84be
Loading

0 comments on commit d0bc55e

Please sign in to comment.