Skip to content

Commit

Permalink
Improve/GitHub workflows (#24)
Browse files Browse the repository at this point in the history
* separate docker and bundle steps workflows

* update helm chart

* specify version of operator-sdk as env in workflow
  • Loading branch information
hoptical authored Dec 4, 2023
1 parent 2aac745 commit b71aeb3
Show file tree
Hide file tree
Showing 12 changed files with 222 additions and 12 deletions.
12 changes: 9 additions & 3 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ on:
- 'v*'

jobs:
docker:
name: docker
build-push-docker:
name: build-docker
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand All @@ -33,9 +33,15 @@ jobs:
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

build-push-bundle:
name: build-push-bundle
runs-on: ubuntu-latest
env:
OPERATOR_SDK_VERSION: v1.31.0
steps:
- name: Install operator-sdk
run: |
curl -L https://github.com/operator-framework/operator-sdk/releases/download/v1.31.0/operator-sdk_linux_amd64 -o /usr/local/bin/operator-sdk
curl -L https://github.com/operator-framework/operator-sdk/releases/download/${OPERATOR_SDK_VERSION}/operator-sdk_linux_amd64 -o /usr/local/bin/operator-sdk
chmod +x /usr/local/bin/operator-sdk
- name: Build and push the bundle
Expand Down
7 changes: 0 additions & 7 deletions config/manager/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,3 @@ resources:
- secret.yaml
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
images:
- name: controller
newName: controller
newTag: latest
- name: ghcr.io/snapp-incubator/s3-operator
newName: s3-operator
newTag: latest
4 changes: 2 additions & 2 deletions deploy/charts/s3-operator/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.2.4
version: 0.3.0
# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "0.1.5"
appVersion: "v0.3.4"
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: {{ include "s3-operator.fullname" . }}-clusterresourcequota-updater-binding
labels:
{{- include "s3-operator.labels" . | nindent 4 }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: '{{ include "s3-operator.fullname" . }}-clusterresourcequota-updater'
subjects:
- kind: ServiceAccount
name: '{{ include "s3-operator.fullname" . }}-controller-manager'
namespace: '{{ .Release.Namespace }}'
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: {{ include "s3-operator.fullname" . }}-clusterresourcequota-updater
labels:
{{- include "s3-operator.labels" . | nindent 4 }}
rules:
- apiGroups:
- quota.openshift.io
resources:
- clusterresourcequotas/status
verbs:
- update
- patch
26 changes: 26 additions & 0 deletions deploy/charts/s3-operator/templates/manager-rbac.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,32 @@ rules:
- patch
- update
- watch
- apiGroups:
- s3.snappcloud.io
resources:
- s3buckets
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- s3.snappcloud.io
resources:
- s3buckets/finalizers
verbs:
- update
- apiGroups:
- s3.snappcloud.io
resources:
- s3buckets/status
verbs:
- get
- patch
- update
- apiGroups:
- s3.snappcloud.io
resources:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: {{ include "s3-operator.fullname" . }}-resourcequota-status-updater-binding
labels:
{{- include "s3-operator.labels" . | nindent 4 }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: '{{ include "s3-operator.fullname" . }}-resourcequota-status-updater'
subjects:
- kind: ServiceAccount
name: '{{ include "s3-operator.fullname" . }}-controller-manager'
namespace: '{{ .Release.Namespace }}'
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: {{ include "s3-operator.fullname" . }}-resourcequota-status-updater
labels:
{{- include "s3-operator.labels" . | nindent 4 }}
rules:
- apiGroups:
- ""
resources:
- resourcequotas/status
verbs:
- update
- patch
93 changes: 93 additions & 0 deletions deploy/charts/s3-operator/templates/s3bucket-crd.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: s3buckets.s3.snappcloud.io
annotations:
controller-gen.kubebuilder.io/version: v0.11.1
labels:
{{- include "s3-operator.labels" . | nindent 4 }}
spec:
group: s3.snappcloud.io
names:
kind: S3Bucket
listKind: S3BucketList
plural: s3buckets
shortNames:
- s3b
singular: s3bucket
scope: Namespaced
versions:
- additionalPrinterColumns:
- jsonPath: .spec.s3UserRef
name: S3USERREF
type: string
name: v1alpha1
schema:
openAPIV3Schema:
description: S3Bucket is the Schema for the s3buckets API
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
type: string
kind:
description: 'Kind is a string value representing the REST resource this
object represents. Servers may infer this from the endpoint the client
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
metadata:
type: object
spec:
description: S3BucketSpec defines the desired state of S3Bucket
properties:
s3DeletionPolicy:
default: delete
enum:
- delete
- retain
type: string
s3SubuserBinding:
items:
properties:
access:
default: read
description: access of the subuser which can be read or write
enum:
- read
- write
type: string
name:
description: name of the subuser
type: string
required:
- name
type: object
type: array
s3UserRef:
type: string
required:
- s3UserRef
type: object
status:
description: S3BucketStatus defines the observed state of S3Bucket
properties:
created:
default: false
type: boolean
policy:
type: string
reason:
type: string
type: object
type: object
served: true
storage: true
subresources:
status: {}
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []
1 change: 1 addition & 0 deletions deploy/charts/s3-operator/templates/s3user-crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ spec:
properties:
maxBuckets:
description: max number of buckets the user can create
format: int64
type: integer
maxObjects:
anyOf:
Expand Down
14 changes: 14 additions & 0 deletions deploy/charts/s3-operator/templates/s3userclaim-crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ spec:
kind: S3UserClaim
listKind: S3UserClaimList
plural: s3userclaims
shortNames:
- s3u
singular: s3userclaim
scope: Namespaced
versions:
Expand Down Expand Up @@ -64,6 +66,7 @@ spec:
properties:
maxBuckets:
description: max number of buckets the user can create
format: int64
type: integer
maxObjects:
anyOf:
Expand All @@ -84,6 +87,11 @@ spec:
type: string
s3UserClass:
type: string
subusers:
items:
pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$
type: string
type: array
required:
- adminSecret
- readonlySecret
Expand All @@ -96,6 +104,7 @@ spec:
properties:
maxBuckets:
description: max number of buckets the user can create
format: int64
type: integer
maxObjects:
anyOf:
Expand All @@ -114,6 +123,11 @@ spec:
type: object
s3UserName:
type: string
subusers:
items:
pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$
type: string
type: array
type: object
type: object
served: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,26 @@ metadata:
labels:
{{- include "s3-operator.labels" . | nindent 4 }}
webhooks:
- admissionReviewVersions:
- v1
clientConfig:
service:
name: '{{ include "s3-operator.fullname" . }}-webhook-service'
namespace: '{{ .Release.Namespace }}'
path: /validate-s3-snappcloud-io-v1alpha1-s3bucket
failurePolicy: Fail
name: vs3bucket.kb.io
rules:
- apiGroups:
- s3.snappcloud.io
apiVersions:
- v1alpha1
operations:
- CREATE
- UPDATE
resources:
- s3buckets
sideEffects: None
- admissionReviewVersions:
- v1
clientConfig:
Expand All @@ -24,6 +44,7 @@ webhooks:
operations:
- CREATE
- UPDATE
- DELETE
resources:
- s3userclaims
sideEffects: None

0 comments on commit b71aeb3

Please sign in to comment.