Skip to content

Commit

Permalink
Merge pull request #60 from appuio/use-patch-operator
Browse files Browse the repository at this point in the history
Use `patch-operator.libsonnet` directly
  • Loading branch information
simu authored Jul 4, 2023
2 parents cd9cfd9 + 071fa1a commit 4674464
Show file tree
Hide file tree
Showing 10 changed files with 59 additions and 251 deletions.
10 changes: 5 additions & 5 deletions component/main.jsonnet
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
local kap = import 'lib/kapitan.libjsonnet';
local kube = import 'lib/kube.libjsonnet';
local rl = import 'lib/resource-locker.libjsonnet';
local po = import 'lib/patch-operator.libsonnet';

local inv = kap.inventory();
local params = inv.parameters.openshift4_console;
Expand Down Expand Up @@ -129,7 +129,7 @@ local consoleRoutePatch =
},
};
[
if std.member([ 'ResourceLocker', 'Patch' ], obj.kind) then
if obj.kind == 'Patch' then
obj {
metadata+: {
annotations+: {
Expand All @@ -141,7 +141,7 @@ local consoleRoutePatch =
}
else
obj
for obj in rl.Patch(
for obj in po.Patch(
target,
patch,
patchstrategy='application/merge-patch+json'
Expand Down Expand Up @@ -174,7 +174,7 @@ local openshiftConfigNsAnnotationPatch =
},
};
[
if std.member([ 'ResourceLocker', 'Patch' ], obj.kind) then
if obj.kind == 'Patch' then
obj {
metadata+: {
annotations+: {
Expand All @@ -187,7 +187,7 @@ local openshiftConfigNsAnnotationPatch =
else
obj
for obj in
rl.Patch(
po.Patch(
target,
patch,
patchstrategy='application/merge-patch+json'
Expand Down
10 changes: 6 additions & 4 deletions tests/custom-logo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@ parameters:
kapitan:
dependencies:
- type: https
source: https://raw.githubusercontent.com/projectsyn/component-resource-locker/v2.1.0/lib/resource-locker.libjsonnet
output_path: vendor/lib/resource-locker.libjsonnet
source: https://raw.githubusercontent.com/projectsyn/component-patch-operator/v1.2.0/lib/patch-operator.libsonnet
output_path: vendor/lib/patch-operator.libsonnet

resource_locker:
namespace: syn-resource-locker
patch_operator:
patch_serviceaccount:
name: patch-sa
namespace: syn-patch-operator

openshift4_console:
config:
Expand Down
10 changes: 6 additions & 4 deletions tests/custom-route-legacy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@ parameters:
kapitan:
dependencies:
- type: https
source: https://raw.githubusercontent.com/projectsyn/component-resource-locker/v2.1.0/lib/resource-locker.libjsonnet
output_path: vendor/lib/resource-locker.libjsonnet
source: https://raw.githubusercontent.com/projectsyn/component-patch-operator/v1.2.0/lib/patch-operator.libsonnet
output_path: vendor/lib/patch-operator.libsonnet

resource_locker:
namespace: syn-resource-locker
patch_operator:
patch_serviceaccount:
name: patch-sa
namespace: syn-patch-operator

openshift4_console:
config:
Expand Down
10 changes: 6 additions & 4 deletions tests/custom-route-managed-tls.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,16 @@ parameters:
source: https://raw.githubusercontent.com/projectsyn/component-cert-manager/v2.2.0/lib/cert-manager.libsonnet
output_path: vendor/lib/cert-manager.libsonnet
- type: https
source: https://raw.githubusercontent.com/projectsyn/component-resource-locker/v2.3.2/lib/resource-locker.libjsonnet
output_path: vendor/lib/resource-locker.libjsonnet
source: https://raw.githubusercontent.com/projectsyn/component-patch-operator/v1.2.0/lib/patch-operator.libsonnet
output_path: vendor/lib/patch-operator.libsonnet
- type: https
source: https://raw.githubusercontent.com/projectsyn/component-kyverno/v1.4.0/lib/kyverno.libsonnet
output_path: vendor/lib/kyverno.libsonnet

resource_locker:
namespace: syn-resource-locker
patch_operator:
patch_serviceaccount:
name: patch-sa
namespace: syn-patch-operator

openshift4_console:
route:
Expand Down
10 changes: 6 additions & 4 deletions tests/custom-route.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@ parameters:
kapitan:
dependencies:
- type: https
source: https://raw.githubusercontent.com/projectsyn/component-resource-locker/v2.1.0/lib/resource-locker.libjsonnet
output_path: vendor/lib/resource-locker.libjsonnet
source: https://raw.githubusercontent.com/projectsyn/component-patch-operator/v1.2.0/lib/patch-operator.libsonnet
output_path: vendor/lib/patch-operator.libsonnet

resource_locker:
namespace: syn-resource-locker
patch_operator:
patch_serviceaccount:
name: patch-sa
namespace: syn-patch-operator

openshift4_console:
route:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,56 +1,16 @@
apiVersion: v1
kind: ServiceAccount
metadata:
labels:
name: cluster-manager
name: cluster-manager
namespace: syn-resource-locker
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
labels:
name: syn-resource-locker-cluster-manager
name: syn-resource-locker-cluster-manager
rules:
- apiGroups:
- config.openshift.io
resources:
- ingresses
verbs:
- get
- list
- patch
- watch
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
labels:
name: syn-resource-locker-cluster-manager
name: syn-resource-locker-cluster-manager
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: syn-resource-locker-cluster-manager
subjects:
- kind: ServiceAccount
name: cluster-manager
namespace: syn-resource-locker
---
apiVersion: redhatcop.redhat.io/v1alpha1
kind: ResourceLocker
kind: Patch
metadata:
annotations:
argocd.argoproj.io/sync-options: SkipDryRunOnMissingResource=true
argocd.argoproj.io/sync-wave: '10'
labels:
name: cluster
name: cluster
namespace: syn-resource-locker
name: ingress-cluster-96338c6a0d5b244
name: ingress-cluster-96338c6a0d5b244
namespace: syn-patch-operator
spec:
patches:
- id: patch1
ingress-cluster-96338c6a0d5b244-patch:
patchTemplate: |-
"spec":
"componentRoutes":
Expand All @@ -65,4 +25,4 @@ spec:
kind: Ingress
name: cluster
serviceAccountRef:
name: cluster-manager
name: patch-sa
Original file line number Diff line number Diff line change
@@ -1,56 +1,16 @@
apiVersion: v1
kind: ServiceAccount
metadata:
labels:
name: cluster-manager
name: cluster-manager
namespace: syn-resource-locker
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
labels:
name: syn-resource-locker-cluster-manager
name: syn-resource-locker-cluster-manager
rules:
- apiGroups:
- config.openshift.io
resources:
- ingresses
verbs:
- get
- list
- patch
- watch
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
labels:
name: syn-resource-locker-cluster-manager
name: syn-resource-locker-cluster-manager
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: syn-resource-locker-cluster-manager
subjects:
- kind: ServiceAccount
name: cluster-manager
namespace: syn-resource-locker
---
apiVersion: redhatcop.redhat.io/v1alpha1
kind: ResourceLocker
kind: Patch
metadata:
annotations:
argocd.argoproj.io/sync-options: SkipDryRunOnMissingResource=true
argocd.argoproj.io/sync-wave: '10'
labels:
name: cluster
name: cluster
namespace: syn-resource-locker
name: ingress-cluster-96338c6a0d5b244
name: ingress-cluster-96338c6a0d5b244
namespace: syn-patch-operator
spec:
patches:
- id: patch1
ingress-cluster-96338c6a0d5b244-patch:
patchTemplate: |-
"spec":
"componentRoutes":
Expand All @@ -63,4 +23,4 @@ spec:
kind: Ingress
name: cluster
serviceAccountRef:
name: cluster-manager
name: patch-sa
Original file line number Diff line number Diff line change
@@ -1,56 +1,16 @@
apiVersion: v1
kind: ServiceAccount
metadata:
labels:
name: ingress-config-openshift-io-cluster-manager
name: ingress-config-openshift-io-cluster-manager
namespace: syn-resource-locker
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
labels:
name: syn-resource-locker-ingress-config-openshift-io-cluster-manager
name: syn-resource-locker-ingress-config-openshift-io-cluster-manager
rules:
- apiGroups:
- config.openshift.io
resources:
- ingresses
verbs:
- get
- list
- patch
- watch
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
labels:
name: syn-resource-locker-ingress-config-openshift-io-cluster-manager
name: syn-resource-locker-ingress-config-openshift-io-cluster-manager
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: syn-resource-locker-ingress-config-openshift-io-cluster-manager
subjects:
- kind: ServiceAccount
name: ingress-config-openshift-io-cluster-manager
namespace: syn-resource-locker
---
apiVersion: redhatcop.redhat.io/v1alpha1
kind: ResourceLocker
kind: Patch
metadata:
annotations:
argocd.argoproj.io/sync-options: SkipDryRunOnMissingResource=true
argocd.argoproj.io/sync-wave: '10'
labels:
name: ingress-config-openshift-io-cluster
name: ingress-config-openshift-io-cluster
namespace: syn-resource-locker
name: ingress-cluster-96338c6a0d5b244
name: ingress-cluster-96338c6a0d5b244
namespace: syn-patch-operator
spec:
patches:
- id: patch1
ingress-cluster-96338c6a0d5b244-patch:
patchTemplate: |-
"spec":
"componentRoutes":
Expand All @@ -65,4 +25,4 @@ spec:
kind: Ingress
name: cluster
serviceAccountRef:
name: ingress-config-openshift-io-cluster-manager
name: patch-sa
Original file line number Diff line number Diff line change
@@ -1,56 +1,16 @@
apiVersion: v1
kind: ServiceAccount
metadata:
labels:
name: namespace-openshift-config-manager
name: namespace-openshift-config-manager
namespace: syn-resource-locker
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
labels:
name: syn-resource-locker-namespace-openshift-config-manager
name: syn-resource-locker-namespace-openshift-config-manager
rules:
- apiGroups:
- ''
resources:
- namespaces
verbs:
- get
- list
- patch
- watch
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
labels:
name: syn-resource-locker-namespace-openshift-config-manager
name: syn-resource-locker-namespace-openshift-config-manager
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: syn-resource-locker-namespace-openshift-config-manager
subjects:
- kind: ServiceAccount
name: namespace-openshift-config-manager
namespace: syn-resource-locker
---
apiVersion: redhatcop.redhat.io/v1alpha1
kind: ResourceLocker
kind: Patch
metadata:
annotations:
argocd.argoproj.io/sync-options: SkipDryRunOnMissingResource=true
argocd.argoproj.io/sync-wave: '5'
labels:
name: namespace-openshift-config
name: namespace-openshift-config
namespace: syn-resource-locker
name: namespace-openshift-config-2c8343f13594d63
name: namespace-openshift-config-2c8343f13594d63
namespace: syn-patch-operator
spec:
patches:
- id: patch1
namespace-openshift-config-2c8343f13594d63-patch:
patchTemplate: |-
"metadata":
"annotations":
Expand All @@ -61,4 +21,4 @@ spec:
kind: Namespace
name: openshift-config
serviceAccountRef:
name: namespace-openshift-config-manager
name: patch-sa
Loading

0 comments on commit 4674464

Please sign in to comment.