Skip to content

Commit

Permalink
feat: update helm chart for deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
andrejpetras committed Dec 1, 2023
1 parent b463409 commit a32141f
Show file tree
Hide file tree
Showing 10 changed files with 132 additions and 19 deletions.
51 changes: 51 additions & 0 deletions src/main/helm/crds/products.io.github.onecx.product.store-v1.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Generated by Fabric8 CRDGenerator, manual edits might get overwritten!
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: products.io.github.onecx.product.store
spec:
group: io.github.onecx.product.store
names:
kind: Product
plural: products
singular: product
scope: Namespaced
versions:
- name: v1
schema:
openAPIV3Schema:
properties:
spec:
properties:
image-url:
type: string
name:
type: string
base-path:
type: string
description:
type: string
type: object
status:
properties:
response-code:
type: integer
product-name:
type: string
status:
enum:
- UPDATED
- CREATED
- ERROR
- UNDEFINED
type: string
message:
type: string
observedGeneration:
type: integer
type: object
type: object
served: true
storage: true
subresources:
status: {}
11 changes: 0 additions & 11 deletions src/main/helm/templates/cluster-role-binding.yaml

This file was deleted.

12 changes: 12 additions & 0 deletions src/main/helm/templates/operator-cluster-role-binding.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: {{ .Release.Name }}-{{ .Values.app.name }}-validating-role-binding
roleRef:
kind: ClusterRole
apiGroup: rbac.authorization.k8s.io
name: {{ .Release.Name }}-{{ .Values.app.name }}-validating-cluster-role
subjects:
- kind: ServiceAccount
name: {{ .Release.Name }}-{{ .Values.app.name }}
namespace: {{ .Release.Namespace }}
12 changes: 12 additions & 0 deletions src/main/helm/templates/operator-cluster-role.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: {{ .Release.Name }}-{{ .Values.app.name }}-validating-cluster-role
rules:
- apiGroups:
- apiextensions.k8s.io
resources:
- customresourcedefinitions
verbs:
- get
- list
43 changes: 43 additions & 0 deletions src/main/helm/templates/product-cluster-role-binding.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{{ if eq $.Values.watchNamespaces "JOSDK_WATCH_CURRENT" }}
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: {{ .Release.Name }}-{{ .Values.app.name }}-role-binding
roleRef:
kind: ClusterRole
apiGroup: rbac.authorization.k8s.io
name: {{ .Release.Name }}-{{ .Values.app.name }}-cluster-role
subjects:
- kind: ServiceAccount
name: {{ .Release.Name }}-{{ .Values.app.name }}
{{ else if eq $.Values.watchNamespaces "JOSDK_ALL_NAMESPACES" }}
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: {{ .Release.Name }}-{{ .Values.app.name }}-role-binding
roleRef:
kind: ClusterRole
apiGroup: rbac.authorization.k8s.io
name: {{ .Release.Name }}-{{ .Values.app.name }}-cluster-role
subjects:
- kind: ServiceAccount
name: {{ .Release.Name }}-{{ .Values.app.name }}
namespace: {{ $.Release.Namespace }}
{{ else }}
{{ range $anamespace := ( split "," $.Values.watchNamespaces ) }}
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: {{ .Release.Name }}-{{ .Values.app.name }}-role-binding
namespace: {{ $anamespace }}
roleRef:
kind: ClusterRole
apiGroup: rbac.authorization.k8s.io
name: {{ .Release.Name }}-{{ .Values.app.name }}-cluster-role
subjects:
- kind: ServiceAccount
name: {{ .Release.Name }}-{{ .Values.app.name }}
namespace: {{ $.Release.Namespace }}
---
{{- end }}
{{- end }}
File renamed without changes.
8 changes: 7 additions & 1 deletion src/main/helm/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,17 @@ app:
name: product-operator
image:
repository: "onecx/onecx-product-store-operator"
tag: 999-SNAPSHOT
env:
"TKIT_LOG_JSON_ENABLED": "false"
# See watchNamespaces
"QUARKUS_OPERATOR_SDK_CONTROLLERS_PRODUCT_NAMESPACES": "JOSDK_WATCH_CURRENT"
envCustom:
- name: KUBERNETES_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
serviceAccount:
enabled: true

# Values: JOSDK_WATCH_CURRENT, JOSDK_ALL_NAMESPACES or comma separated list of namespaces
watchNamespaces: "JOSDK_WATCH_CURRENT"
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
import io.javaoperatorsdk.operator.processing.event.source.filter.OnAddFilter;
import io.javaoperatorsdk.operator.processing.event.source.filter.OnUpdateFilter;

@ControllerConfiguration(onAddFilter = ProductReconciler.AddFilter.class, onUpdateFilter = ProductReconciler.UpdateFilter.class)
public class ProductReconciler implements Reconciler<Product>, ErrorStatusHandler<Product> {
private static final Logger log = LoggerFactory.getLogger(ProductReconciler.class);
@ControllerConfiguration(name = "product", onAddFilter = ProductController.AddFilter.class, onUpdateFilter = ProductController.UpdateFilter.class)
public class ProductController implements Reconciler<Product>, ErrorStatusHandler<Product> {
private static final Logger log = LoggerFactory.getLogger(ProductController.class);

@Inject
ProductStoreService service;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@
import io.quarkus.test.junit.QuarkusTest;

@QuarkusTest
class ProductReconcilerResponseTest extends AbstractTest {
class ProductControllerResponseTest extends AbstractTest {

@InjectMock
ProductStoreService productStoreService;

@Inject
ProductReconciler reconciler;
ProductController reconciler;

@BeforeEach
void beforeAll() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
import io.quarkus.test.junit.QuarkusTest;

@QuarkusTest
class ProductReconcilerTest extends AbstractTest {
class ProductControllerTest extends AbstractTest {

final static Logger log = LoggerFactory.getLogger(ProductReconcilerTest.class);
final static Logger log = LoggerFactory.getLogger(ProductControllerTest.class);

@Inject
Operator operator;
Expand Down

0 comments on commit a32141f

Please sign in to comment.