Skip to content

Commit

Permalink
Merge pull request #154 from vshn/update-dependencies
Browse files Browse the repository at this point in the history
Remove OpenShift 3 support; Update dependencies
  • Loading branch information
bastjan authored Jun 13, 2024
2 parents 320d3ee + 2111407 commit 5765292
Show file tree
Hide file tree
Showing 28 changed files with 391 additions and 1,671 deletions.
10 changes: 2 additions & 8 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,10 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Determine Go version from go.mod
run: echo "GO_VERSION=$(grep "go 1." go.mod | cut -d " " -f 2)" >> $GITHUB_ENV
- uses: actions/setup-go@v4
run: echo "GO_VERSION=$(grep "go 1." go.mod | cut -d " " -f 2 | cut -d "." -f 1,2)" >> $GITHUB_ENV
- uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- uses: actions/cache@v3
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Run e2e tests
run: make crd e2e-test -e bats_args="--report-formatter junit"
- name: Publish Test Report
Expand Down
10 changes: 2 additions & 8 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,9 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Determine Go version from go.mod
run: echo "GO_VERSION=$(grep "go 1." go.mod | cut -d " " -f 2)" >> $GITHUB_ENV
- uses: actions/setup-go@v4
run: echo "GO_VERSION=$(grep "go 1." go.mod | cut -d " " -f 2 | cut -d "." -f 1,2)" >> $GITHUB_ENV
- uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- uses: actions/cache@v3
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Run linters
run: make lint
10 changes: 2 additions & 8 deletions .github/workflows/master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,10 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Determine Go version from go.mod
run: echo "GO_VERSION=$(grep "go 1." go.mod | cut -d " " -f 2)" >> $GITHUB_ENV
- uses: actions/setup-go@v4
run: echo "GO_VERSION=$(grep "go 1." go.mod | cut -d " " -f 2 | cut -d "." -f 1,2)" >> $GITHUB_ENV
- uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- uses: actions/cache@v3
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Build docker images
run: make docker-build -e IMG_TAG=${GITHUB_REF#refs/heads/}
- name: Login to Docker hub
Expand Down
10 changes: 2 additions & 8 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,10 @@ jobs:
with:
fetch-depth: 0
- name: Determine Go version from go.mod
run: echo "GO_VERSION=$(grep "go 1." go.mod | cut -d " " -f 2)" >> $GITHUB_ENV
- uses: actions/setup-go@v4
run: echo "GO_VERSION=$(grep "go 1." go.mod | cut -d " " -f 2 | cut -d "." -f 1,2)" >> $GITHUB_ENV
- uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- uses: actions/cache@v3
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Login to Docker hub
run: docker login -u "${{ secrets.DOCKER_HUB_USER }}" -p "${{ secrets.DOCKER_HUB_PASSWORD }}"
- name: Login to quay.io
Expand Down
10 changes: 2 additions & 8 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,10 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Determine Go version from go.mod
run: echo "GO_VERSION=$(grep "go 1." go.mod | cut -d " " -f 2)" >> $GITHUB_ENV
- uses: actions/setup-go@v4
run: echo "GO_VERSION=$(grep "go 1." go.mod | cut -d " " -f 2 | cut -d "." -f 1,2)" >> $GITHUB_ENV
- uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- uses: actions/cache@v3
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Run tests
run: make integration-test
- name: Upload code coverage report to Code Climate
Expand Down
4 changes: 1 addition & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ test: ## Run tests
# `--insecure-port` and `--insecure-bind-address` flags is now deprecated,
# but envtest was not updated accordingly.
#integration-test: export ENVTEST_K8S_VERSION = 1.20.2
integration-test: export ENVTEST_K8S_VERSION = 1.19.2
integration-test: export ENVTEST_K8S_VERSION = 1.27.x
integration-test: export KUBEBUILDER_ATTACH_CONTROL_PLANE_OUTPUT = $(INTEGRATION_TEST_DEBUG_OUTPUT)
integration-test: ## Run integration tests with envtest
$(setup-envtest) use '$(ENVTEST_K8S_VERSION)!'
Expand Down Expand Up @@ -62,12 +62,10 @@ deploy: generate ## Deploy controller in the configured Kubernetes cluster in ~/
.PHONY: generate
generate: ## Generate manifests e.g. CRD, RBAC etc.
@CRD_ROOT_DIR="$(CRD_ROOT_DIR)" CRD_DOCS_REF_PATH="$(CRD_DOCS_REF_PATH)" go generate -tags=generate generate.go
@rm config/*.yaml

.PHONY: crd
crd: generate ## Generate CRD to file
$(KUSTOMIZE) build $(CRD_ROOT_DIR)/v1 > $(CRD_FILE)
$(KUSTOMIZE) build $(CRD_ROOT_DIR)/v1beta1 > $(CRD_FILE_LEGACY)

.PHONY: fmt
fmt: ## Run go fmt against code
Expand Down
3 changes: 1 addition & 2 deletions Makefile.vars.mk
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ BIN_FILENAME ?= $(PROJECT_ROOT_DIR)/espejo
TESTBIN_DIR ?= $(PROJECT_ROOT_DIR)/testbin/bin

CRD_FILE ?= espejo-crd.yaml
CRD_FILE_LEGACY ?= espejo-crd-legacy.yaml
CRD_ROOT_DIR ?= config/crd/apiextensions.k8s.io
CRD_SPEC_VERSION ?= v1

Expand All @@ -25,7 +24,7 @@ E2E_IMG = $(E2E_REPO):$(E2E_TAG)

INTEGRATION_TEST_DEBUG_OUTPUT ?= false

KUSTOMIZE ?= go run sigs.k8s.io/kustomize/kustomize/v3
KUSTOMIZE ?= go run sigs.k8s.io/kustomize/kustomize/v5

# Image URL to use all building/pushing image targets
DOCKER_IMG ?= docker.io/vshn/espejo:$(IMG_TAG)
Expand Down
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ The Operator is implemented with the [Operator SDK](https://github.com/operator-

### Run E2E tests

Espejo supports both OpenShift 3.11 clusters and newer Kubernetes clusters 1.16+.
However, to support OpenShift 3.11 a legacy CRD definition with `apiextensions.k8s.io/v1beta1` is needed, while K8s 1.22+ only supports `apiextensions.k8s.io/v1`.
You need `node` and `npm` to run the tests, as it runs with [DETIK][detik].

To run e2e tests, execute:
Expand Down
12 changes: 8 additions & 4 deletions api/v1alpha1/syncconfig_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,22 @@ import (
)

type (
// Manifest is an unstructured kubernetes object with kube-builder validation and pruning settings applied.
Manifest struct {
// +kubebuilder:pruning:PreserveUnknownFields
// +kubebuilder:validation:EmbeddedResource
unstructured.Unstructured `json:",inline"`
}

// SyncConfigSpec defines the desired state of SyncConfig
SyncConfigSpec struct {
// ForceRecreate defines if objects should be deleted and recreated if updates fails
ForceRecreate bool `json:"forceRecreate,omitempty"`
// NamespaceSelector defines which namespaces should be targeted
NamespaceSelector *NamespaceSelector `json:"namespaceSelector,omitempty"`

// +kubebuilder:pruning:PreserveUnknownFields
// +kubebuilder:validation:EmbeddedResource

// SyncItems lists items to be synced to targeted namespaces
SyncItems []unstructured.Unstructured `json:"syncItems,omitempty"`
SyncItems []Manifest `json:"syncItems,omitempty"`
// DeleteItems lists items to be deleted from targeted namespaces
DeleteItems []DeleteMeta `json:"deleteItems,omitempty"`
}
Expand Down
20 changes: 17 additions & 3 deletions api/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 5765292

Please sign in to comment.