Skip to content

Commit 64e1be9

Browse files
authored
Merge branch 'main' into multiarch
2 parents 70d9fe5 + ed6bc5e commit 64e1be9

26 files changed

+300
-80
lines changed

.github/workflows/release.yaml

Lines changed: 200 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,200 @@
1+
# this file includes an extra end-to-end test which is required to pass
2+
# for PRs made to any release branch (i.e. a branch whose name follows semantic versioning)
3+
4+
name: Validate IPFS Operator For Release
5+
on:
6+
push:
7+
branches: ["release*"]
8+
tags: ["*"]
9+
pull_request:
10+
branches: ["release*"]
11+
12+
env:
13+
GO_VERSION: "1.18"
14+
GO111MODULE: "on"
15+
OPERATOR_IMAGE: "quay.io/redhat-et-ipfs/ipfs-operator"
16+
BUNDLE_IMAGE: "quay.io/redhat-et-ipfs/ipfs-operator-bundle"
17+
TAG: "v0.0.1"
18+
19+
jobs:
20+
build-operator:
21+
name: Build-operator
22+
runs-on: ubuntu-20.04
23+
24+
steps:
25+
- name: Checkout source
26+
uses: actions/checkout@v2
27+
28+
- name: Install Go
29+
uses: actions/setup-go@v1
30+
with:
31+
go-version: ${{ env.GO_VERSION }}
32+
33+
- name: Test
34+
run: make test
35+
36+
- name: Build operator container
37+
run: make docker-build IMG="${OPERATOR_IMAGE}"
38+
39+
- name: Export container image
40+
run: docker save -o /tmp/operator.tar ${OPERATOR_IMAGE}
41+
42+
- name: Save container as artifact
43+
uses: actions/upload-artifact@v1
44+
with:
45+
name: ipfs-cluster-operator
46+
path: /tmp/operator.tar
47+
48+
build-bundle:
49+
name: Build-Bundle
50+
runs-on: ubuntu-20.04
51+
52+
steps:
53+
- name: Checkout source
54+
uses: actions/checkout@v2
55+
56+
- name: Install Go
57+
uses: actions/setup-go@v1
58+
with:
59+
go-version: ${{ env.GO_VERSION }}
60+
61+
- name: Install operator-sdk
62+
run: |
63+
curl -L -o operator-sdk https://github.com/operator-framework/operator-sdk/releases/download/v1.11.0/operator-sdk_linux_amd64
64+
sudo install ./operator-sdk /usr/local/bin && rm operator-sdk
65+
66+
- name: Make bundle
67+
run: make bundle
68+
69+
- name: Build bundle
70+
run: make bundle-build
71+
72+
- name: Export container image
73+
run: docker save -o /tmp/bundle.tar ${BUNDLE_IMAGE}
74+
75+
- name: Save container as artifact
76+
uses: actions/upload-artifact@v1
77+
with:
78+
name: operator-bundle
79+
path: /tmp/bundle.tar
80+
81+
e2e-release:
82+
name: End-to-end tests
83+
needs: [ build-bundle, build-operator ]
84+
runs-on: ubuntu-20.04
85+
steps:
86+
- uses: actions/checkout@v2
87+
88+
- name: Install the Kubectl binary
89+
run: |
90+
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
91+
sudo install ./kubectl /usr/local/bin/
92+
kubectl version --short --client
93+
94+
95+
- name: Install the Kind binary
96+
run: |
97+
curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.12.0/kind-linux-amd64
98+
chmod +x ./kind
99+
sudo mv ./kind /usr/local/bin/kind
100+
kind version
101+
102+
- name: Create a Kind Cluster
103+
run: ./hack/setup-kind-cluster.sh
104+
105+
- name: Pull the Container Image from Artifacts
106+
uses: actions/download-artifact@v1
107+
with:
108+
name: ipfs-cluster-operator
109+
path: /tmp
110+
111+
- name: Load the Container Image
112+
run: |
113+
docker load -i /tmp/operator.tar
114+
docker inspect ${OPERATOR_IMAGE}
115+
docker tag ${OPERATOR_IMAGE} ${OPERATOR_IMAGE}:ci-build
116+
kind load docker-image ${OPERATOR_IMAGE}:ci-build
117+
118+
- name: Load the Operator into Kind
119+
run: |
120+
helm upgrade --install \
121+
--debug \
122+
--set image.tag="ci-build" \
123+
--wait --timeout=300s \
124+
ipfs-cluster ./helm/ipfs-operator
125+
126+
- name: run e2e tests
127+
shell: bash
128+
run: |
129+
mkdir bin
130+
make test-e2e-release
131+
132+
push-operator:
133+
name: Push operator container to registry
134+
needs: e2e-release
135+
if: >
136+
(github.event_name == 'push' || github.event_name == 'schedule') &&
137+
(github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v'))
138+
runs-on: ubuntu-20.04
139+
steps:
140+
- name: Pull the Container Image from Artifacts
141+
uses: actions/download-artifact@v1
142+
with:
143+
name: ipfs-cluster-operator
144+
path: /tmp
145+
146+
- name: Load the Container Image
147+
run: |
148+
docker load -i /tmp/operator.tar
149+
docker inspect ${OPERATOR_IMAGE}
150+
151+
- name: Login to registry
152+
# If the registry server is specified in the image name, we use that.
153+
# If the server isn't in the image name, default to docker.io
154+
run: |
155+
[[ "${OPERATOR_IMAGE}" =~ ^([^/]+)/[^/]+/[^/]+ ]] && REGISTRY="${BASH_REMATCH[1]}" || REGISTRY="docker.io"
156+
echo "Attempting docker login to: ${REGISTRY}"
157+
echo "${{ secrets.REGISTRY_PASSWORD }}" | docker login -u "${{ secrets.REGISTRY_USERNAME }}" --password-stdin ${REGISTRY}
158+
- name: Push to registry (version tag)
159+
if: >
160+
(github.event_name == 'push' || github.event_name == 'schedule') &&
161+
github.ref == 'refs/heads/main'
162+
run: |
163+
docker tag ${OPERATOR_IMAGE} ${OPERATOR_IMAGE}:${TAG}
164+
docker push "${OPERATOR_IMAGE}:${TAG}"
165+
166+
push-bundle:
167+
name: Push bundle container to registry
168+
needs: e2e-release
169+
if: >
170+
(github.event_name == 'push' || github.event_name == 'schedule') &&
171+
(github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v'))
172+
runs-on: ubuntu-20.04
173+
174+
steps:
175+
- name: Load container artifact
176+
uses: actions/download-artifact@v1
177+
with:
178+
name: operator-bundle
179+
path: /tmp
180+
181+
- name: Import container image
182+
run: |
183+
docker load -i /tmp/bundle.tar
184+
docker inspect "${BUNDLE_IMAGE}:${{ env.TAG }}"
185+
186+
- name: Login to registry
187+
# If the registry server is specified in the image name, we use that.
188+
# If the server isn't in the image name, default to docker.io
189+
run: |
190+
[[ "${BUNDLE_IMAGE}" =~ ^([^/]+)/[^/]+/[^/]+ ]] && REGISTRY="${BASH_REMATCH[1]}" || REGISTRY="docker.io"
191+
echo "Attempting docker login to: ${REGISTRY}"
192+
echo "${{ secrets.REGISTRY_PASSWORD }}" | docker login -u "${{ secrets.REGISTRY_USERNAME }}" --password-stdin ${REGISTRY}
193+
194+
- name: Push to registry (version tag)
195+
if: >
196+
(github.event_name == 'push' || github.event_name == 'schedule') &&
197+
github.ref == 'refs/heads/main'
198+
run: |
199+
echo "Pushing to ${{ env.TAG }}"
200+
docker push "${BUNDLE_IMAGE}:${{ env.TAG }}"

.github/workflows/validate-ipfs.yaml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
name: Validate Ipfs
22
on:
33
push:
4-
branches: ["main", "release*"]
5-
tags: ["*"]
4+
branches: ["main"]
65
pull_request:
7-
branches: ["main", "release*"]
6+
branches: ["main"]
87

98
env:
109
GO_VERSION: "1.18"

Makefile

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
# set binary versions
22
GOLANGCI_VERSION := v1.46.1
33
HELM_VERSION := v3.8.2
4-
KUTTL_VERSION := 0.10.0
5-
GINKGO_VERSION=v2.1.4
4+
KUTTL_VERSION := 0.15.0
5+
GINKGO_VERSION := v2.7.0
66

77

88
OS := $(shell go env GOOS)
99
ARCH := $(shell go env GOARCH)
10+
SYS_ARCH := $(shell uname -m)
1011

1112
# VERSION defines the project version for the bundle.
1213
# Update this value when you upgrade the version of your project.
@@ -137,10 +138,14 @@ test: lint manifests generate fmt vet lint envtest ginkgo ## Run tests.
137138
KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) -p path)" $(GINKGO) run $(GINKGO_ARGS) $(GINKGO_TARGETS)
138139

139140
.PHONY: test-e2e
140-
test-e2e: kuttl ## Run e2e tests. Requires cluster w/ Scribe already installed
141-
cd test-kuttl && $(KUTTL) test
141+
test-e2e: kuttl ## Run e2e tests. Requires cluster w/ IPFS Operator already installed.
142+
cd test-kuttl && $(KUTTL) test --config kuttl-test.yaml
142143
rm -f test-kuttl/kubeconfig
143144

145+
.PHONY: test-e2e-release
146+
test-e2e-release: kuttl
147+
cd test-kuttl && $(KUTTL) test --config kuttl-test-release.yaml
148+
144149
##@ Build
145150

146151
.PHONY: build
@@ -317,8 +322,9 @@ endef
317322

318323
.PHONY: kuttl
319324
KUTTL := $(LOCALBIN)/kuttl
320-
KUTTL_URL := https://github.com/kudobuilder/kuttl/releases/download/v$(KUTTL_VERSION)/kubectl-kuttl_$(KUTTL_VERSION)_linux_x86_64
321-
kuttl: ## Download kuttl
325+
KUTTL_URL := https://github.com/kudobuilder/kuttl/releases/download/v$(KUTTL_VERSION)/kubectl-kuttl_$(KUTTL_VERSION)_$(OS)_$(SYS_ARCH)
326+
kuttl: $(KUTTL) ## Download kuttl
327+
$(KUTTL): $(LOCALBIN)
322328
$(call download-tool,$(KUTTL),$(KUTTL_URL))
323329

324330
.PHONY: ginkgo

README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,8 @@ kind: Ipfs
2323
metadata:
2424
name: ipfs-sample-1
2525
spec:
26-
url: apps.jephilli-4-11-04-28-0655.devcluster.openshift.com
2726
ipfsStorage: 2Gi
2827
clusterStorage: 2Gi
29-
public: true
3028
```
3129
Once the values match your environment run the following.
3230
```bash

api/v1alpha1/ipfscluster_types.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,6 @@ type networkConfig struct {
6767

6868
// IpfsClusterSpec defines the desired state of the IpfsCluster.
6969
type IpfsClusterSpec struct {
70-
// url defines the URL to be using as an ingress controller.
71-
// +kubebuilder:validation:Optional
72-
URL string `json:"url"`
73-
// public determines whether or not we should be exposing this IPFS Cluster to the public.
74-
Public bool `json:"public"`
7570
// ipfsStorage defines the total storage to be allocated by this resource.
7671
IpfsStorage resource.Quantity `json:"ipfsStorage"`
7772
// clusterStorage defines the amount of storage to be used by IPFS Cluster.

bundle.Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ LABEL operators.operatorframework.io.bundle.manifests.v1=manifests/
66
LABEL operators.operatorframework.io.bundle.metadata.v1=metadata/
77
LABEL operators.operatorframework.io.bundle.package.v1=ipfs-operator
88
LABEL operators.operatorframework.io.bundle.channels.v1=alpha
9-
LABEL operators.operatorframework.io.metrics.builder=operator-sdk-v1.22.0
9+
LABEL operators.operatorframework.io.metrics.builder=operator-sdk-v1.26.0
1010
LABEL operators.operatorframework.io.metrics.mediatype.v1=metrics+v1
1111
LABEL operators.operatorframework.io.metrics.project_layout=go.kubebuilder.io/v3
1212

bundle/manifests/cluster.ipfs.io_ipfsclusters.yaml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -102,10 +102,6 @@ spec:
102102
required:
103103
- circuitRelays
104104
type: object
105-
public:
106-
description: public determines whether or not we should be exposing
107-
this IPFS Cluster to the public.
108-
type: boolean
109105
replicas:
110106
description: replicas sets the number of replicas of IPFS Cluster
111107
nodes we should be running.
@@ -128,15 +124,11 @@ spec:
128124
- roots
129125
type: string
130126
type: object
131-
url:
132-
description: url defines the URL to be using as an ingress controller.
133-
type: string
134127
required:
135128
- clusterStorage
136129
- follows
137130
- ipfsStorage
138131
- networking
139-
- public
140132
- replicas
141133
type: object
142134
status:

bundle/manifests/ipfs-operator.clusterserviceversion.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ metadata:
2222
}
2323
]
2424
capabilities: Basic Install
25-
operators.operatorframework.io/builder: operator-sdk-v1.22.0
25+
createdAt: "2023-01-19T17:29:48Z"
26+
operators.operatorframework.io/builder: operator-sdk-v1.26.0
2627
operators.operatorframework.io/project_layout: go.kubebuilder.io/v3
2728
name: ipfs-operator.v0.0.1
2829
namespace: placeholder

bundle/metadata/annotations.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ annotations:
55
operators.operatorframework.io.bundle.metadata.v1: metadata/
66
operators.operatorframework.io.bundle.package.v1: ipfs-operator
77
operators.operatorframework.io.bundle.channels.v1: alpha
8-
operators.operatorframework.io.metrics.builder: operator-sdk-v1.22.0
8+
operators.operatorframework.io.metrics.builder: operator-sdk-v1.26.0
99
operators.operatorframework.io.metrics.mediatype.v1: metrics+v1
1010
operators.operatorframework.io.metrics.project_layout: go.kubebuilder.io/v3
1111

config/crd/bases/cluster.ipfs.io_ipfsclusters.yaml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -103,10 +103,6 @@ spec:
103103
required:
104104
- circuitRelays
105105
type: object
106-
public:
107-
description: public determines whether or not we should be exposing
108-
this IPFS Cluster to the public.
109-
type: boolean
110106
replicas:
111107
description: replicas sets the number of replicas of IPFS Cluster
112108
nodes we should be running.
@@ -129,15 +125,11 @@ spec:
129125
- roots
130126
type: string
131127
type: object
132-
url:
133-
description: url defines the URL to be using as an ingress controller.
134-
type: string
135128
required:
136129
- clusterStorage
137130
- follows
138131
- ipfsStorage
139132
- networking
140-
- public
141133
- replicas
142134
type: object
143135
status:

0 commit comments

Comments
 (0)