Skip to content

Commit dcaa292

Browse files
committed
changes
1 parent c97d77c commit dcaa292

File tree

5 files changed

+20
-7
lines changed

5 files changed

+20
-7
lines changed

bindata/cert-manager-deployment/network-policy/operator-allow-egress-to-api-server.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ apiVersion: networking.k8s.io/v1
22
kind: NetworkPolicy
33
metadata:
44
name: operator-allow-egress-to-api-server
5-
namespace: cert-manager-operator
5+
namespace: ${NAMESPACE}
66
spec:
77
podSelector:
88
matchLabels:

bindata/cert-manager-deployment/network-policy/operator-allow-ingress-to-metrics.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ apiVersion: networking.k8s.io/v1
22
kind: NetworkPolicy
33
metadata:
44
name: operator-allow-ingress-to-metrics
5-
namespace: cert-manager-operator
5+
namespace: ${NAMESPACE}
66
spec:
77
podSelector:
88
matchLabels:

bindata/cert-manager-deployment/network-policy/operator-deny-all-pod-selector.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ apiVersion: networking.k8s.io/v1
22
kind: NetworkPolicy
33
metadata:
44
name: operator-deny-all-traffic
5-
namespace: cert-manager-operator
5+
namespace: ${NAMESPACE}
66
spec:
77
podSelector:
88
matchLabels:

pkg/controller/deployment/cert_manager_operator_static_resource.go

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package deployment
22

33
import (
4+
"bytes"
5+
"github.com/openshift/cert-manager-operator/pkg/operator/operatorclient"
46
"github.com/openshift/library-go/pkg/controller/factory"
57
"github.com/openshift/library-go/pkg/operator/events"
68
"github.com/openshift/library-go/pkg/operator/resource/resourceapply"
@@ -12,6 +14,7 @@ import (
1214

1315
const (
1416
certManagerOperatorStaticResourcesControllerName = operatorName + "-operator-static-resources-"
17+
namespaceKey = "${NAMESPACE}"
1518
)
1619

1720
var (
@@ -29,10 +32,20 @@ func NewCertManagerOperatorStaticResourcesController(operatorClient v1helpers.Op
2932
) factory.Controller {
3033
return staticresourcecontroller.NewStaticResourceController(
3134
certManagerOperatorStaticResourcesControllerName,
32-
assets.Asset,
35+
replaceNamespaceFunc(operatorclient.OperatorNamespace),
3336
certManagerOperatorAssetFiles,
3437
kubeClientContainer,
3538
operatorClient,
3639
eventsRecorder,
3740
).AddKubeInformers(kubeInformersForNamespaces)
3841
}
42+
43+
func replaceNamespaceFunc(namespace string) resourceapply.AssetFunc {
44+
return func(name string) ([]byte, error) {
45+
content, err := assets.Asset(name)
46+
if err != nil {
47+
panic(err)
48+
}
49+
return bytes.ReplaceAll(content, []byte(namespaceKey), []byte(namespace)), nil
50+
}
51+
}

pkg/operator/assets/bindata.go

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)