-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from appuio/switch-to-more-configurable-deployment
Make deployment more configurable
- Loading branch information
Showing
26 changed files
with
1,805 additions
and
96 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,15 @@ | ||
parameters: | ||
group_sync_operator: | ||
=_metadata: {} | ||
namespace: syn-group-sync-operator | ||
subscription: | ||
channel: 'alpha' | ||
installPlanApproval: 'Automatic' | ||
name: 'group-sync-operator' | ||
source: 'community-operators' | ||
sourceNamespace: 'openshift-marketplace' | ||
|
||
images: | ||
operator: | ||
registry: quay.io | ||
repository: redhat-cop/group-sync-operator | ||
tag: v0.0.14 | ||
|
||
manifest_version: ${group_sync_operator:images:operator:tag} | ||
manifest_url: https://raw.githubusercontent.com/redhat-cop/group-sync-operator/${group_sync_operator:manifest_version}/config | ||
|
||
sync: {} | ||
secrets: {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,41 @@ | ||
parameters: | ||
kapitan: | ||
dependencies: | ||
- type: https | ||
source: ${group_sync_operator:manifest_url}/crd/bases/redhatcop.redhat.io_groupsyncs.yaml | ||
output_path: dependencies/group-sync-operator/manifests/crds/${group_sync_operator:manifest_version}/redhatcop.redhat.io_groupsyncs.yaml | ||
|
||
- type: https | ||
source: ${group_sync_operator:manifest_url}/manager/manager.yaml | ||
output_path: dependencies/group-sync-operator/manifests/controller/${group_sync_operator:manifest_version}/deployment.yaml | ||
- type: https | ||
source: ${group_sync_operator:manifest_url}/rbac/role.yaml | ||
output_path: dependencies/group-sync-operator/manifests/controller/${group_sync_operator:manifest_version}/role.yaml | ||
- type: https | ||
source: ${group_sync_operator:manifest_url}/rbac/role_binding.yaml | ||
output_path: dependencies/group-sync-operator/manifests/controller/${group_sync_operator:manifest_version}/role_binding.yaml | ||
- type: https | ||
source: ${group_sync_operator:manifest_url}/rbac/leader_election_role.yaml | ||
output_path: dependencies/group-sync-operator/manifests/controller/${group_sync_operator:manifest_version}/leader_election_role.yaml | ||
- type: https | ||
source: ${group_sync_operator:manifest_url}/rbac/leader_election_role_binding.yaml | ||
output_path: dependencies/group-sync-operator/manifests/controller/${group_sync_operator:manifest_version}/leader_election_role_binding.yaml | ||
- type: https | ||
source: ${group_sync_operator:manifest_url}/rbac/service_account.yaml | ||
output_path: dependencies/group-sync-operator/manifests/controller/${group_sync_operator:manifest_version}/service_account.yaml | ||
|
||
compile: | ||
- input_paths: | ||
- group-sync-operator/manifests/crds/${group_sync_operator:manifest_version}/ | ||
input_type: copy | ||
output_path: group-sync-operator/00_crds/ | ||
|
||
- input_paths: | ||
- group-sync-operator/component/app.jsonnet | ||
input_type: jsonnet | ||
output_path: apps/ | ||
- input_paths: | ||
- group-sync-operator/component/main.jsonnet | ||
- group-sync-operator/component/operator.jsonnet | ||
- group-sync-operator/component/config.jsonnet | ||
input_type: jsonnet | ||
output_path: group-sync-operator/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
local CommonLabels = { | ||
'app.kubernetes.io/managed-by': 'commodore', | ||
'app.kubernetes.io/part-of': 'syn', | ||
'app.kubernetes.io/name': 'group-sync-operator', | ||
}; | ||
|
||
local AddCommonLabels = function(object) object { | ||
metadata+: { | ||
labels+: CommonLabels, | ||
}, | ||
}; | ||
|
||
{ | ||
CommonLabels: CommonLabels, | ||
AddCommonLabels: AddCommonLabels, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,98 @@ | ||
// main template for group-sync-operator | ||
local common = import 'common.libsonnet'; | ||
local kap = import 'lib/kapitan.libjsonnet'; | ||
local kube = import 'lib/kube.libjsonnet'; | ||
local inv = kap.inventory(); | ||
// The hiera parameters for the component | ||
local params = inv.parameters.group_sync_operator; | ||
|
||
local prefix = 'group-sync-'; | ||
|
||
local role = std.parseJson(kap.yaml_load('group-sync-operator/manifests/controller/' + params.manifest_version + '/role.yaml')); | ||
local service_account = std.parseJson(kap.yaml_load('group-sync-operator/manifests/controller/' + params.manifest_version + '/service_account.yaml')); | ||
local role_binding = std.parseJson(kap.yaml_load('group-sync-operator/manifests/controller/' + params.manifest_version + '/role_binding.yaml')); | ||
local leader_election_role = std.parseJson(kap.yaml_load('group-sync-operator/manifests/controller/' + params.manifest_version + '/leader_election_role.yaml')); | ||
local leader_election_role_binding = std.parseJson(kap.yaml_load('group-sync-operator/manifests/controller/' + params.manifest_version + '/leader_election_role_binding.yaml')); | ||
local deployment = std.filter( | ||
function(o) o.kind == 'Deployment', | ||
std.parseJson(kap.yaml_load_stream('group-sync-operator/manifests/controller/' + params.manifest_version + '/deployment.yaml')) | ||
)[0]; | ||
|
||
local image = '%(registry)s/%(repository)s:%(tag)s' % params.images.operator; | ||
|
||
local objects = [ | ||
leader_election_role { | ||
metadata+: { | ||
name: prefix + super.name, | ||
}, | ||
}, | ||
leader_election_role_binding { | ||
metadata+: { | ||
name: prefix + super.name, | ||
}, | ||
roleRef+: { | ||
name: prefix + super.name, | ||
}, | ||
subjects: std.map(function(s) s { | ||
name: prefix + super.name, | ||
namespace: params.namespace, | ||
}, super.subjects), | ||
}, | ||
role { | ||
metadata+: { | ||
name: prefix + super.name, | ||
}, | ||
}, | ||
role_binding { | ||
metadata+: { | ||
name: prefix + super.name, | ||
}, | ||
roleRef+: { | ||
name: prefix + super.name, | ||
}, | ||
subjects: std.map(function(s) s { | ||
name: prefix + super.name, | ||
namespace: params.namespace, | ||
}, super.subjects), | ||
}, | ||
service_account { | ||
metadata+: { | ||
name: prefix + super.name, | ||
}, | ||
}, | ||
deployment { | ||
metadata+: { | ||
name: prefix + super.name, | ||
}, | ||
spec+: { | ||
template+: { | ||
spec+: { | ||
serviceAccountName: prefix + super.serviceAccountName, | ||
containers: [ | ||
if c.name == 'manager' then | ||
c { | ||
image: image, | ||
args: [], | ||
} | ||
else | ||
c | ||
for c in super.containers | ||
], | ||
}, | ||
}, | ||
}, | ||
}, | ||
]; | ||
|
||
{ | ||
'10_namespace': kube.Namespace(params.namespace), | ||
} | ||
+ | ||
{ | ||
'00_namespace': kube.Namespace(params.namespace), | ||
['20_' + std.asciiLower(obj.kind) + '_' + std.asciiLower(obj.metadata.name)]: common.AddCommonLabels(obj) { | ||
metadata+: { | ||
namespace: params.namespace, | ||
}, | ||
} | ||
for obj in objects | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.