-
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.
Support deploying container network addons (#15)
Co-authored-by: Debakel Orakel <debakel.orakel@tegridy.io>
- Loading branch information
1 parent
dbf6568
commit 9d32dec
Showing
14 changed files
with
7,812 additions
and
8 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
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
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
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,48 @@ | ||
// main template for kubevirt-operator | ||
local com = import 'lib/commodore.libjsonnet'; | ||
local kap = import 'lib/kapitan.libjsonnet'; | ||
local kube = import 'lib/kube.libjsonnet'; | ||
|
||
local helper = import 'helper.libsonnet'; | ||
|
||
// The hiera parameters for the component | ||
local inv = kap.inventory(); | ||
local operator = inv.parameters.kubevirt_operator.operators.network_addons; | ||
local config = inv.parameters.kubevirt_operator.config.network_addons; | ||
local isOpenshift = std.startsWith(inv.parameters.facts.distribution, 'openshift'); | ||
|
||
// Namespace | ||
local namespace = kube.Namespace(operator.namespace.name) { | ||
metadata+: { | ||
annotations+: operator.namespace.annotations, | ||
labels+: { | ||
// Configure the namespaces so that the OCP4 cluster-monitoring | ||
// Prometheus can find the servicemonitors and rules. | ||
[if isOpenshift then 'openshift.io/cluster-monitoring']: 'true', | ||
} + com.makeMergeable(operator.namespace.labels), | ||
}, | ||
}; | ||
|
||
// Bundle | ||
local bundle = helper.load('cna-%s/crd.yaml' % operator.version, operator.namespace.name) | ||
+ helper.load('cna-%s/operator.yaml' % operator.version, operator.namespace.name); | ||
|
||
// Instance | ||
local instance = kube._Object('networkaddonsoperator.network.kubevirt.io/v1', 'NetworkAddonsConfig', 'instance') { | ||
metadata+: { | ||
labels: { | ||
'app.kubernetes.io/managed-by': 'commodore', | ||
'app.kubernetes.io/name': 'instance', | ||
'app.kubernetes.io/instance': 'instance', | ||
}, | ||
namespace: operator.namespace.name, | ||
}, | ||
spec: config, | ||
}; | ||
|
||
// Define outputs below | ||
if helper.isEnabled('importer') then { | ||
'30_network_addons/00_namespace': namespace, | ||
'30_network_addons/10_bundle': bundle, | ||
[if std.length(config) > 0 then '30_network_addons/20_instance']: instance, | ||
} else {} |
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
6 changes: 6 additions & 0 deletions
6
tests/golden/defaults/kubevirt-operator/apps/kubevirt-cna.yaml
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,6 @@ | ||
spec: | ||
source: | ||
path: manifests/kubevirt-operator/30_network_addons | ||
syncPolicy: | ||
syncOptions: | ||
- ServerSideApply=true |
7 changes: 7 additions & 0 deletions
7
...s/golden/defaults/kubevirt-operator/kubevirt-operator/30_network_addons/00_namespace.yaml
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,7 @@ | ||
apiVersion: v1 | ||
kind: Namespace | ||
metadata: | ||
annotations: {} | ||
labels: | ||
name: syn-kubevirt-cna | ||
name: syn-kubevirt-cna |
Oops, something went wrong.