Skip to content

Commit 489146a

Browse files
Merge pull request #256 from exdx/feat/add-bundle-objects
feat: generate a bundle with configmap and secret objects
2 parents da66554 + 8af4f19 commit 489146a

File tree

3 files changed

+34
-17
lines changed

3 files changed

+34
-17
lines changed

pkg/lib/bundle/supported_resources.go

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ const (
66
SecretKind = "Secret"
77
ClusterRoleKind = "ClusterRole"
88
ClusterRoleBindingKind = "ClusterRoleBinding"
9+
ConfigMapKind = "ConfigMap"
910
ServiceAccountKind = "ServiceAccount"
1011
ServiceKind = "Service"
1112
RoleKind = "Role"
@@ -14,28 +15,28 @@ const (
1415
ServiceMonitorKind = "ServiceMonitor"
1516
)
1617

17-
var supportedResources map[string]bool
18+
// Namespaced indicates whether the resource is namespace scoped (true) or cluster-scoped (false).
19+
type Namespaced bool
1820

19-
// Add a list of supported resources to the map
2021
// Key: Kind name
21-
// Value: If namaspaced kind, true. Otherwise, false
22-
func init() {
23-
supportedResources = make(map[string]bool, 11)
24-
25-
supportedResources[CSVKind] = true
26-
supportedResources[CRDKind] = false
27-
supportedResources[ClusterRoleKind] = false
28-
supportedResources[ClusterRoleBindingKind] = false
29-
supportedResources[ServiceKind] = true
30-
supportedResources[ServiceAccountKind] = true
31-
supportedResources[RoleKind] = true
32-
supportedResources[RoleBindingKind] = true
33-
supportedResources[PrometheusRuleKind] = true
34-
supportedResources[ServiceMonitorKind] = true
22+
// Value: If namespaced kind, true. Otherwise, false
23+
var supportedResources = map[string]Namespaced{
24+
CSVKind: true,
25+
CRDKind: false,
26+
ClusterRoleKind: false,
27+
ClusterRoleBindingKind: false,
28+
ServiceKind: true,
29+
ServiceAccountKind: true,
30+
RoleKind: true,
31+
RoleBindingKind: true,
32+
PrometheusRuleKind: true,
33+
ServiceMonitorKind: true,
34+
SecretKind: true,
35+
ConfigMapKind: true,
3536
}
3637

3738
// IsSupported checks if the object kind is OLM-supported and if it is namespaced
38-
func IsSupported(kind string) (bool, bool) {
39+
func IsSupported(kind string) (bool, Namespaced) {
3940
namespaced, ok := supportedResources[kind]
4041
return ok, namespaced
4142
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
apiVersion: v1
2+
kind: ConfigMap
3+
metadata:
4+
name: "my-config-map"
5+
data:
6+
allowed: '"true"'
7+
enemies: aliens
8+
lives: "3"
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
apiVersion: v1
2+
kind: Secret
3+
metadata:
4+
name: mysecret
5+
type: Opaque
6+
data:
7+
username: YWRtaW4=
8+
password: MWYyZDFlMmU2N2Rm

0 commit comments

Comments
 (0)