Skip to content

Commit b71aeb3

Browse files
authored
Improve/GitHub workflows (#24)
* separate docker and bundle steps workflows * update helm chart * specify version of operator-sdk as env in workflow
1 parent 2aac745 commit b71aeb3

12 files changed

+222
-12
lines changed

.github/workflows/build.yaml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ on:
66
- 'v*'
77

88
jobs:
9-
docker:
10-
name: docker
9+
build-push-docker:
10+
name: build-docker
1111
runs-on: ubuntu-latest
1212
steps:
1313
- uses: actions/checkout@v3
@@ -33,9 +33,15 @@ jobs:
3333
tags: ${{ steps.meta.outputs.tags }}
3434
labels: ${{ steps.meta.outputs.labels }}
3535

36+
build-push-bundle:
37+
name: build-push-bundle
38+
runs-on: ubuntu-latest
39+
env:
40+
OPERATOR_SDK_VERSION: v1.31.0
41+
steps:
3642
- name: Install operator-sdk
3743
run: |
38-
curl -L https://github.com/operator-framework/operator-sdk/releases/download/v1.31.0/operator-sdk_linux_amd64 -o /usr/local/bin/operator-sdk
44+
curl -L https://github.com/operator-framework/operator-sdk/releases/download/${OPERATOR_SDK_VERSION}/operator-sdk_linux_amd64 -o /usr/local/bin/operator-sdk
3945
chmod +x /usr/local/bin/operator-sdk
4046
4147
- name: Build and push the bundle

config/manager/kustomization.yaml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,3 @@ resources:
33
- secret.yaml
44
apiVersion: kustomize.config.k8s.io/v1beta1
55
kind: Kustomization
6-
images:
7-
- name: controller
8-
newName: controller
9-
newTag: latest
10-
- name: ghcr.io/snapp-incubator/s3-operator
11-
newName: s3-operator
12-
newTag: latest

deploy/charts/s3-operator/Chart.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ type: application
1313
# This is the chart version. This version number should be incremented each time you make changes
1414
# to the chart and its templates, including the app version.
1515
# Versions are expected to follow Semantic Versioning (https://semver.org/)
16-
version: 0.2.4
16+
version: 0.3.0
1717
# This is the version number of the application being deployed. This version number should be
1818
# incremented each time you make changes to the application. Versions are not expected to
1919
# follow Semantic Versioning. They should reflect the version the application is using.
2020
# It is recommended to use it with quotes.
21-
appVersion: "0.1.5"
21+
appVersion: "v0.3.4"
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
apiVersion: rbac.authorization.k8s.io/v1
2+
kind: ClusterRoleBinding
3+
metadata:
4+
name: {{ include "s3-operator.fullname" . }}-clusterresourcequota-updater-binding
5+
labels:
6+
{{- include "s3-operator.labels" . | nindent 4 }}
7+
roleRef:
8+
apiGroup: rbac.authorization.k8s.io
9+
kind: ClusterRole
10+
name: '{{ include "s3-operator.fullname" . }}-clusterresourcequota-updater'
11+
subjects:
12+
- kind: ServiceAccount
13+
name: '{{ include "s3-operator.fullname" . }}-controller-manager'
14+
namespace: '{{ .Release.Namespace }}'
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
apiVersion: rbac.authorization.k8s.io/v1
2+
kind: ClusterRole
3+
metadata:
4+
name: {{ include "s3-operator.fullname" . }}-clusterresourcequota-updater
5+
labels:
6+
{{- include "s3-operator.labels" . | nindent 4 }}
7+
rules:
8+
- apiGroups:
9+
- quota.openshift.io
10+
resources:
11+
- clusterresourcequotas/status
12+
verbs:
13+
- update
14+
- patch

deploy/charts/s3-operator/templates/manager-rbac.yaml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,32 @@ rules:
4949
- patch
5050
- update
5151
- watch
52+
- apiGroups:
53+
- s3.snappcloud.io
54+
resources:
55+
- s3buckets
56+
verbs:
57+
- create
58+
- delete
59+
- get
60+
- list
61+
- patch
62+
- update
63+
- watch
64+
- apiGroups:
65+
- s3.snappcloud.io
66+
resources:
67+
- s3buckets/finalizers
68+
verbs:
69+
- update
70+
- apiGroups:
71+
- s3.snappcloud.io
72+
resources:
73+
- s3buckets/status
74+
verbs:
75+
- get
76+
- patch
77+
- update
5278
- apiGroups:
5379
- s3.snappcloud.io
5480
resources:
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
apiVersion: rbac.authorization.k8s.io/v1
2+
kind: ClusterRoleBinding
3+
metadata:
4+
name: {{ include "s3-operator.fullname" . }}-resourcequota-status-updater-binding
5+
labels:
6+
{{- include "s3-operator.labels" . | nindent 4 }}
7+
roleRef:
8+
apiGroup: rbac.authorization.k8s.io
9+
kind: ClusterRole
10+
name: '{{ include "s3-operator.fullname" . }}-resourcequota-status-updater'
11+
subjects:
12+
- kind: ServiceAccount
13+
name: '{{ include "s3-operator.fullname" . }}-controller-manager'
14+
namespace: '{{ .Release.Namespace }}'
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
apiVersion: rbac.authorization.k8s.io/v1
2+
kind: ClusterRole
3+
metadata:
4+
name: {{ include "s3-operator.fullname" . }}-resourcequota-status-updater
5+
labels:
6+
{{- include "s3-operator.labels" . | nindent 4 }}
7+
rules:
8+
- apiGroups:
9+
- ""
10+
resources:
11+
- resourcequotas/status
12+
verbs:
13+
- update
14+
- patch
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
apiVersion: apiextensions.k8s.io/v1
2+
kind: CustomResourceDefinition
3+
metadata:
4+
name: s3buckets.s3.snappcloud.io
5+
annotations:
6+
controller-gen.kubebuilder.io/version: v0.11.1
7+
labels:
8+
{{- include "s3-operator.labels" . | nindent 4 }}
9+
spec:
10+
group: s3.snappcloud.io
11+
names:
12+
kind: S3Bucket
13+
listKind: S3BucketList
14+
plural: s3buckets
15+
shortNames:
16+
- s3b
17+
singular: s3bucket
18+
scope: Namespaced
19+
versions:
20+
- additionalPrinterColumns:
21+
- jsonPath: .spec.s3UserRef
22+
name: S3USERREF
23+
type: string
24+
name: v1alpha1
25+
schema:
26+
openAPIV3Schema:
27+
description: S3Bucket is the Schema for the s3buckets API
28+
properties:
29+
apiVersion:
30+
description: 'APIVersion defines the versioned schema of this representation
31+
of an object. Servers should convert recognized schemas to the latest
32+
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
33+
type: string
34+
kind:
35+
description: 'Kind is a string value representing the REST resource this
36+
object represents. Servers may infer this from the endpoint the client
37+
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
38+
type: string
39+
metadata:
40+
type: object
41+
spec:
42+
description: S3BucketSpec defines the desired state of S3Bucket
43+
properties:
44+
s3DeletionPolicy:
45+
default: delete
46+
enum:
47+
- delete
48+
- retain
49+
type: string
50+
s3SubuserBinding:
51+
items:
52+
properties:
53+
access:
54+
default: read
55+
description: access of the subuser which can be read or write
56+
enum:
57+
- read
58+
- write
59+
type: string
60+
name:
61+
description: name of the subuser
62+
type: string
63+
required:
64+
- name
65+
type: object
66+
type: array
67+
s3UserRef:
68+
type: string
69+
required:
70+
- s3UserRef
71+
type: object
72+
status:
73+
description: S3BucketStatus defines the observed state of S3Bucket
74+
properties:
75+
created:
76+
default: false
77+
type: boolean
78+
policy:
79+
type: string
80+
reason:
81+
type: string
82+
type: object
83+
type: object
84+
served: true
85+
storage: true
86+
subresources:
87+
status: {}
88+
status:
89+
acceptedNames:
90+
kind: ""
91+
plural: ""
92+
conditions: []
93+
storedVersions: []

deploy/charts/s3-operator/templates/s3user-crd.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ spec:
120120
properties:
121121
maxBuckets:
122122
description: max number of buckets the user can create
123+
format: int64
123124
type: integer
124125
maxObjects:
125126
anyOf:

deploy/charts/s3-operator/templates/s3userclaim-crd.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ spec:
1212
kind: S3UserClaim
1313
listKind: S3UserClaimList
1414
plural: s3userclaims
15+
shortNames:
16+
- s3u
1517
singular: s3userclaim
1618
scope: Namespaced
1719
versions:
@@ -64,6 +66,7 @@ spec:
6466
properties:
6567
maxBuckets:
6668
description: max number of buckets the user can create
69+
format: int64
6770
type: integer
6871
maxObjects:
6972
anyOf:
@@ -84,6 +87,11 @@ spec:
8487
type: string
8588
s3UserClass:
8689
type: string
90+
subusers:
91+
items:
92+
pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$
93+
type: string
94+
type: array
8795
required:
8896
- adminSecret
8997
- readonlySecret
@@ -96,6 +104,7 @@ spec:
96104
properties:
97105
maxBuckets:
98106
description: max number of buckets the user can create
107+
format: int64
99108
type: integer
100109
maxObjects:
101110
anyOf:
@@ -114,6 +123,11 @@ spec:
114123
type: object
115124
s3UserName:
116125
type: string
126+
subusers:
127+
items:
128+
pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$
129+
type: string
130+
type: array
117131
type: object
118132
type: object
119133
served: true

deploy/charts/s3-operator/templates/validating-webhook-configuration.yaml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,26 @@ metadata:
77
labels:
88
{{- include "s3-operator.labels" . | nindent 4 }}
99
webhooks:
10+
- admissionReviewVersions:
11+
- v1
12+
clientConfig:
13+
service:
14+
name: '{{ include "s3-operator.fullname" . }}-webhook-service'
15+
namespace: '{{ .Release.Namespace }}'
16+
path: /validate-s3-snappcloud-io-v1alpha1-s3bucket
17+
failurePolicy: Fail
18+
name: vs3bucket.kb.io
19+
rules:
20+
- apiGroups:
21+
- s3.snappcloud.io
22+
apiVersions:
23+
- v1alpha1
24+
operations:
25+
- CREATE
26+
- UPDATE
27+
resources:
28+
- s3buckets
29+
sideEffects: None
1030
- admissionReviewVersions:
1131
- v1
1232
clientConfig:
@@ -24,6 +44,7 @@ webhooks:
2444
operations:
2545
- CREATE
2646
- UPDATE
47+
- DELETE
2748
resources:
2849
- s3userclaims
2950
sideEffects: None

0 commit comments

Comments
 (0)