Skip to content

Commit b794f03

Browse files
authored
Merge pull request #58 from Datasance/main
Datasance improvements
2 parents 3dca96e + 3e1d7d4 commit b794f03

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+3748
-656
lines changed

.DS_Store

6 KB
Binary file not shown.

.github/workflows/ci.yaml

Lines changed: 13 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ name: CI
22
on:
33
push:
44
branches:
5+
- main
56
- develop
67
- release*
78
tags: [v*]
@@ -11,18 +12,16 @@ on:
1112
- LICENSE
1213
pull_request:
1314
# Sequence of patterns matched against refs/heads
14-
branches:
15+
branches:
16+
- main
1517
- develop
1618
- release*
1719
paths-ignore:
1820
- README.md
1921
- CHANGELOG.md
2022
- LICENSE
2123
env:
22-
PROJECT: 'focal-freedom-236620'
2324
IMAGE_NAME: 'operator'
24-
GKE_CLUSTER: 'iofogctl-ci'
25-
GKE_ZONE: 'us-central1-a'
2625

2726
jobs:
2827
Operator:
@@ -36,22 +35,7 @@ jobs:
3635
- uses: actions/checkout@v3
3736
with:
3837
fetch-depth: 0
39-
- uses: actions/setup-go@v4
40-
with:
41-
go-version: '1.19'
42-
- run: go version
43-
- name: golangci-lint
44-
uses: golangci/golangci-lint-action@v3
45-
with:
46-
version: v1.50.1
47-
args: --timeout=5m0s
48-
- uses: azure/setup-kubectl@v3
49-
id: install
50-
- name: Set up Kustomize
51-
run: |-
52-
curl -sfLo kustomize https://github.com/kubernetes-sigs/kustomize/releases/download/v3.1.0/kustomize_3.1.0_linux_amd64
53-
chmod u+x ./kustomize
54-
- run: sudo make bats
38+
5539
- name: 'Get Previous tag'
5640
id: previoustag
5741
uses: "WyriHaximus/github-action-get-previous-tag@v1"
@@ -76,73 +60,31 @@ jobs:
7660
service_account_key: ${{ secrets.GKE_SA_KEY }}
7761
project_id: ${{ env.PROJECT }}
7862

79-
# Get the GKE credentials so we can deploy to the cluster
80-
- uses: google-github-actions/get-gke-credentials@fb08709ba27618c31c09e014e1d8364b02e5042e
81-
with:
82-
cluster_name: ${{ env.GKE_CLUSTER }}
83-
location: ${{ env.GKE_ZONE }}
84-
credentials: ${{ secrets.GKE_SA_KEY }}
8563
- name: Login to Github Container Registry
64+
8665
uses: docker/login-action@v2
8766
with:
8867
registry: "ghcr.io"
8968
username: ${{ github.actor }}
90-
password: ${{ github.token }}
69+
password: ${{ secrets.PAT }}
9170

9271
- name: Build and Push to ghcr
72+
9373
uses: docker/build-push-action@v3
9474
id: build_push_ghcr
9575
with:
96-
file: './Dockerfile'
76+
file: Dockerfile
9777
push: true
78+
outputs: type=image,name=target,annotation-index.org.opencontainers.image.description=operator
9879
tags: |
99-
ghcr.io/eclipse-iofog/${{ env.IMAGE_NAME }}:${{ steps.tags.outputs.VERSION }}
100-
ghcr.io/eclipse-iofog/${{ env.IMAGE_NAME }}:latest
101-
context: './'
102-
103-
- name: Build and Push to GCR
104-
if: ${{ steps.tags.outcome }} == 'success'
105-
id: build_push_gcr
106-
uses: RafikFarhad/push-to-gcr-github-action@v5-beta
107-
with:
108-
gcloud_service_key: ${{ secrets.GCLOUD_SERVICE_KEY }}
109-
registry: gcr.io
110-
project_id: ${{ env.PROJECT }}
111-
image_name: ${{ env.IMAGE_NAME }}
112-
image_tag: latest, ${{ steps.tags.outputs.VERSION }}
113-
dockerfile: './Dockerfile'
114-
context: './'
80+
ghcr.io/datasance/${{ env.IMAGE_NAME }}:${{ steps.tags.outputs.VERSION }}
81+
ghcr.io/datasance/${{ env.IMAGE_NAME }}:latest
82+
ghcr.io/datasance/${{ env.IMAGE_NAME }}:main
11583
116-
- name: Kustomize
117-
shell: bash
118-
run: |
119-
set -e
120-
IMAGE="gcr.io/focal-freedom-236620/operator:${{ steps.tags.outputs.VERSION }}"
121-
cd config/operator
122-
kustomize edit set image "$IMAGE"
123-
kustomize build . > /tmp/deployment.yaml
124-
cp /tmp/deployment.yaml ./deployment.yaml
125-
cat ./deployment.yaml | grep "image: $IMAGE"
126-
127-
- name: Feature tests
128-
shell: bash
129-
id: feature_test
130-
run: |
131-
set -e
132-
cp test/conf/env.sh.tpl test/conf/env.sh
133-
sed -i "s/<<NAMESPACE>>/${{ github.run_number }}/g" test/conf/env.sh
134-
sed -i "s/<<OP_VERSION>>/${{ steps.tags.outputs.VERSION }}/g" test/conf/env.sh
135-
make feature
136-
- name: Cleanup tests
137-
if: failure() && steps.feature_test.outcome == 'failure'
138-
shell: bash
139-
run: |
140-
set -e
141-
kubectl delete ns ${{ github.run_number }}
14284
- run: mkdir -p ${{ github.workspace }}/artifact
14385
- run: echo ${{ steps.tags.outputs.VERSION }} > ${{ github.workspace }}/artifact/version.txt
14486
- name: Upload Artifact
145-
uses: actions/upload-artifact@v3
87+
uses: actions/upload-artifact@v4
14688
with:
14789
name: operator
14890
path: ${{ github.workspace }}/artifact/version.txt

Dockerfile

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM golang:1.19-alpine as builder
1+
FROM golang:1.22-alpine3.20 AS builder
22

33
WORKDIR /operator
44

@@ -17,8 +17,20 @@ COPY ./hack/ ./hack/
1717
RUN make build
1818
RUN cp ./bin/iofog-operator /bin
1919

20-
FROM alpine:3.16
20+
FROM registry.access.redhat.com/ubi9/ubi-minimal:9.4
2121
WORKDIR /
22+
23+
RUN microdnf install shadow-utils && \
24+
microdnf clean all
25+
RUN useradd --uid 10000 runner
26+
27+
28+
COPY LICENSE LICENSE
2229
COPY --from=builder /bin/iofog-operator /bin/
30+
LABEL org.opencontainers.image.description=operator
31+
LABEL org.opencontainers.image.source=https://github.com/datasance/iofog-operator
32+
LABEL org.opencontainers.image.licenses=EPL2.0
33+
34+
USER 10000
2335

2436
ENTRYPOINT ["/bin/iofog-operator", "--enable-leader-election"]

Dockerfile-alphine

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
FROM golang:1.22-alpine3.20 AS builder
2+
3+
WORKDIR /operator
4+
5+
RUN apk add --update --no-cache bash curl git make
6+
7+
COPY ./go.* ./
8+
COPY ./Makefile ./
9+
RUN make controller-gen
10+
11+
COPY ./main.go ./
12+
COPY ./apis/ ./apis/
13+
COPY ./internal/ ./internal/
14+
COPY ./controllers/ ./controllers/
15+
COPY ./hack/ ./hack/
16+
17+
RUN make build
18+
RUN cp ./bin/iofog-operator /bin
19+
20+
FROM alpine:3.19
21+
WORKDIR /
22+
COPY --from=builder /bin/iofog-operator /bin/
23+
LABEL org.opencontainers.image.description=operator
24+
LABEL org.opencontainers.image.source=https://github.com/datasance/iofog-operator
25+
LABEL org.opencontainers.image.licenses=EPL2.0
26+
ENTRYPOINT ["/bin/iofog-operator", "--enable-leader-election"]

Makefile

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
OS = $(shell uname -s | tr '[:upper:]' '[:lower:]')
22

33
VERSION = $(shell cat PROJECT | grep "version:" | sed "s/^version: //g")
4-
PREFIX = github.com/eclipse-iofog/iofog-operator/v3/internal/util
5-
LDFLAGS += -X $(PREFIX).portManagerTag=v3.0.0-beta1
6-
LDFLAGS += -X $(PREFIX).kubeletTag=v3.0.0-beta1
7-
LDFLAGS += -X $(PREFIX).proxyTag=v3.0.0-beta1
8-
LDFLAGS += -X $(PREFIX).routerTag=v3.0.0-beta1
9-
LDFLAGS += -X $(PREFIX).controllerTag=v3.0.0-beta1
10-
LDFLAGS += -X $(PREFIX).repo=gcr.io/focal-freedom-236620
4+
PREFIX = github.com/datasance/iofog-operator/v3/internal/util
5+
LDFLAGS += -X $(PREFIX).portManagerTag=v3.1.2
6+
LDFLAGS += -X $(PREFIX).kubeletTag=v3.0.1
7+
LDFLAGS += -X $(PREFIX).proxyTag=v3.0.2
8+
LDFLAGS += -X $(PREFIX).routerTag=v3.2.0
9+
LDFLAGS += -X $(PREFIX).controllerTag=v3.4.1
10+
LDFLAGS += -X $(PREFIX).repo=ghcr.io/datasance
1111

1212
export CGO_ENABLED ?= 0
1313
ifeq (${DEBUG},)
@@ -18,7 +18,7 @@ endif
1818
# Image URL to use all building/pushing image targets
1919
IMG ?= operator:latest
2020
# Produce CRDs that work back to Kubernetes 1.11 (no version conversion)
21-
CRD_OPTIONS ?= "crd:crdVersions=v1,allowDangerousType=true"
21+
CRD_OPTIONS ?= "crd:crdVersions=v1,allowDangerousTypes=true"
2222

2323
# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set)
2424
ifeq (,$(shell go env GOBIN))
@@ -27,6 +27,11 @@ else
2727
GOBIN=$(shell go env GOBIN)
2828
endif
2929

30+
# Check if GOBIN is an absolute path
31+
ifneq ($(shell [ -d $(GOBIN) ] && echo yes),yes)
32+
$(error GOBIN must be set to an absolute path and exist)
33+
endif
34+
3035
all: build
3136

3237
.PHONY: build
@@ -107,7 +112,7 @@ controller-gen: ## Install controller-gen
107112
ifeq (, $(shell which controller-gen))
108113
@{ \
109114
set -e ;\
110-
go install sigs.k8s.io/controller-tools/cmd/controller-gen@v0.8.0 ;\
115+
go install sigs.k8s.io/controller-tools/cmd/controller-gen@v0.15.0 ;\
111116
}
112117
CONTROLLER_GEN=$(GOBIN)/controller-gen
113118
else
@@ -118,7 +123,7 @@ kustomize: ## Install kustomize
118123
ifeq (, $(shell which kustomize))
119124
@{ \
120125
set -e ;\
121-
go install sigs.k8s.io/kustomize/kustomize/v4@v4.5.7 ;\
126+
go install sigs.k8s.io/kustomize/kustomize/v5@v5.5.0 ;\
122127
}
123128
KUSTOMIZE=$(GOBIN)/kustomize
124129
else

PROJECT

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
1-
domain: iofog.org
2-
layout: go.kubebuilder.io/v2
1+
domain: datasance.com
2+
layout: go.kubebuilder.io/v4
33
multigroup: true
44
projectName: iofog-operator
5-
repo: github.com/eclipse-iofog/iofog-operator
5+
repo: github.com/datasance/iofog-operator
66
resources:
77
- kind: Application
88
version: v3
99
- kind: ControlPlane
1010
version: v3
1111
version: "3"
1212
plugins:
13-
go.sdk.operatorframework.io/v2-alpha: {}
13+
manifests.sdk.operatorframework.io/v2: {}
14+
scorecard.sdk.operatorframework.io/v2: {}

apis/apis.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
package apis
22

33
import (
4-
appsv3 "github.com/eclipse-iofog/iofog-operator/v3/apis/apps/v3"
5-
cpv3 "github.com/eclipse-iofog/iofog-operator/v3/apis/controlplanes/v3"
4+
appsv3 "github.com/datasance/iofog-operator/v3/apis/apps/v3"
5+
cpv3 "github.com/datasance/iofog-operator/v3/apis/controlplanes/v3"
66
extsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
77
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
88
"k8s.io/apimachinery/pkg/runtime"
@@ -11,7 +11,7 @@ import (
1111
)
1212

1313
func NewControlPlaneCustomResource() *extsv1.CustomResourceDefinition {
14-
apiVersions := []string{"v3", "v2"}
14+
apiVersions := []string{"v3"}
1515
versions := make([]extsv1.CustomResourceDefinitionVersion, len(apiVersions))
1616
preserveUnknownFields := true
1717

@@ -37,10 +37,10 @@ func NewControlPlaneCustomResource() *extsv1.CustomResourceDefinition {
3737

3838
return &extsv1.CustomResourceDefinition{
3939
ObjectMeta: metav1.ObjectMeta{
40-
Name: "controlplanes.iofog.org",
40+
Name: "controlplanes.datasance.com",
4141
},
4242
Spec: extsv1.CustomResourceDefinitionSpec{
43-
Group: "iofog.org",
43+
Group: "datasance.com",
4444
Names: extsv1.CustomResourceDefinitionNames{
4545
Kind: "ControlPlane",
4646
ListKind: "ControlPlaneList",
@@ -54,7 +54,7 @@ func NewControlPlaneCustomResource() *extsv1.CustomResourceDefinition {
5454
}
5555

5656
func NewAppCustomResource() *extsv1.CustomResourceDefinition {
57-
apiVersions := []string{"v3", "v2", "v1"}
57+
apiVersions := []string{"v3"}
5858
preserveUnknownFields := true
5959
versions := make([]extsv1.CustomResourceDefinitionVersion, len(apiVersions))
6060

@@ -80,10 +80,10 @@ func NewAppCustomResource() *extsv1.CustomResourceDefinition {
8080

8181
return &extsv1.CustomResourceDefinition{
8282
ObjectMeta: metav1.ObjectMeta{
83-
Name: "apps.iofog.org",
83+
Name: "apps.datasance.com",
8484
},
8585
Spec: extsv1.CustomResourceDefinitionSpec{
86-
Group: "iofog.org",
86+
Group: "datasance.com",
8787
Names: extsv1.CustomResourceDefinitionNames{
8888
Kind: "Application",
8989
ListKind: "ApplicationList",

apis/apps/v3/application_types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ limitations under the License.
1717
package v3
1818

1919
import (
20-
"github.com/eclipse-iofog/iofog-go-sdk/v3/pkg/apps"
20+
"github.com/datasance/iofog-go-sdk/v3/pkg/apps"
2121
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2222
)
2323

apis/apps/v3/groupversion_info.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ limitations under the License.
1616

1717
// Package v3 contains API Schema definitions for the apps v3 API group
1818
// +kubebuilder:object:generate=true
19-
// +groupName=iofog.org
19+
// +groupName=datasance.com
2020
package v3
2121

2222
import (
@@ -26,7 +26,7 @@ import (
2626

2727
var (
2828
// GroupVersion is group version used to register these objects.
29-
GroupVersion = schema.GroupVersion{Group: "iofog.org", Version: "v3"} //nolint:gochecknoglobals
29+
GroupVersion = schema.GroupVersion{Group: "datasance.com", Version: "v3"} //nolint:gochecknoglobals
3030

3131
// SchemeBuilder is used to add go types to the GroupVersionKind scheme.
3232
SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion} //nolint:gochecknoglobals

apis/apps/v3/zz_generated.deepcopy.go

Lines changed: 1 addition & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)