Skip to content

Commit fca9509

Browse files
committed
adds the changes for dns and port selector
1 parent 70e3ca6 commit fca9509

File tree

7 files changed

+61
-14
lines changed

7 files changed

+61
-14
lines changed

api/v1alpha1/external_secrets_config_types.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,13 @@ type ControllerConfig struct {
131131
// If this field is not provided, external-secrets components will be isolated
132132
// with deny-all network policies, which will prevent proper operation.
133133
//
134+
// +kubebuilder:validation:XValidation:rule="oldSelf.all(op, self.exists(p, p.name == op.name && p.componentName == op.componentName))",message="name and componentName fields in networkPolicies are immutable"
135+
// +kubebuilder:validation:MinItems:=0
136+
// +kubebuilder:validation:MaxItems:=50
134137
// +kubebuilder:validation:Optional
135-
// +optional
138+
// +listType=map
139+
// +listMapKey=name
140+
// +listMapKey=componentName
136141
NetworkPolicies []NetworkPolicy `json:"networkPolicies,omitempty"`
137142
}
138143

@@ -245,7 +250,7 @@ type NetworkPolicy struct {
245250
// egress is a list of egress rules to be applied to the selected pods. Outgoing traffic
246251
// is allowed if there are no NetworkPolicies selecting the pod (and cluster policy
247252
// otherwise allows the traffic), OR if the traffic matches at least one egress rule
248-
// across all of the NetworkPolicy objects whose podSelector matches the pod. If
253+
// across all the NetworkPolicy objects whose podSelector matches the pod. If
249254
// this field is empty then this NetworkPolicy limits all outgoing traffic (and serves
250255
// solely to ensure that the pods it selects are isolated by default).
251256
// The operator will automatically handle ingress rules based on the current running ports.

bindata/external-secrets/networkpolicy_allow-api-server-egress-for-bitwarden-sever.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,10 @@ spec:
2020
- ports:
2121
- protocol: TCP
2222
port: 9998
23-
# Allow access to Kubernetes API server
23+
# Allow access to Kubernetes API server and bitwarden sdk external server
2424
egress:
2525
- ports:
2626
- protocol: TCP
27-
port: 6443
27+
port: 6443
28+
- protocol: TCP
29+
port: 443

bindata/external-secrets/networkpolicy_allow-dns.yaml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,12 @@ metadata:
99
name: allow-to-dns
1010
spec:
1111
podSelector:
12-
matchLabels:
13-
app.kubernetes.io/name: external-secrets
12+
matchExpressions:
13+
- key: app.kubernetes.io/name
14+
operator: In
15+
values:
16+
- external-secrets
17+
- bitwarden-sdk-server
1418
egress:
1519
- to:
1620
- namespaceSelector:
@@ -24,5 +28,9 @@ spec:
2428
port: 5353
2529
- protocol: UDP
2630
port: 5353
31+
- protocol: TCP
32+
port: 53
33+
- protocol: UDP
34+
port: 53
2735
policyTypes:
2836
- Egress

bundle/manifests/operator.openshift.io_externalsecretsconfigs.yaml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1300,7 +1300,7 @@ spec:
13001300
egress is a list of egress rules to be applied to the selected pods. Outgoing traffic
13011301
is allowed if there are no NetworkPolicies selecting the pod (and cluster policy
13021302
otherwise allows the traffic), OR if the traffic matches at least one egress rule
1303-
across all of the NetworkPolicy objects whose podSelector matches the pod. If
1303+
across all the NetworkPolicy objects whose podSelector matches the pod. If
13041304
this field is empty then this NetworkPolicy limits all outgoing traffic (and serves
13051305
solely to ensure that the pods it selects are isolated by default).
13061306
The operator will automatically handle ingress rules based on the current running ports.
@@ -1505,7 +1505,18 @@ spec:
15051505
- egress
15061506
- name
15071507
type: object
1508+
maxItems: 50
1509+
minItems: 0
15081510
type: array
1511+
x-kubernetes-list-map-keys:
1512+
- name
1513+
- componentName
1514+
x-kubernetes-list-type: map
1515+
x-kubernetes-validations:
1516+
- message: name and componentName fields in networkPolicies are
1517+
immutable
1518+
rule: oldSelf.all(op, self.exists(p, p.name == op.name && p.componentName
1519+
== op.componentName))
15091520
periodicReconcileInterval:
15101521
default: 300
15111522
description: |-

config/crd/bases/operator.openshift.io_externalsecretsconfigs.yaml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1300,7 +1300,7 @@ spec:
13001300
egress is a list of egress rules to be applied to the selected pods. Outgoing traffic
13011301
is allowed if there are no NetworkPolicies selecting the pod (and cluster policy
13021302
otherwise allows the traffic), OR if the traffic matches at least one egress rule
1303-
across all of the NetworkPolicy objects whose podSelector matches the pod. If
1303+
across all the NetworkPolicy objects whose podSelector matches the pod. If
13041304
this field is empty then this NetworkPolicy limits all outgoing traffic (and serves
13051305
solely to ensure that the pods it selects are isolated by default).
13061306
The operator will automatically handle ingress rules based on the current running ports.
@@ -1505,7 +1505,18 @@ spec:
15051505
- egress
15061506
- name
15071507
type: object
1508+
maxItems: 50
1509+
minItems: 0
15081510
type: array
1511+
x-kubernetes-list-map-keys:
1512+
- name
1513+
- componentName
1514+
x-kubernetes-list-type: map
1515+
x-kubernetes-validations:
1516+
- message: name and componentName fields in networkPolicies are
1517+
immutable
1518+
rule: oldSelf.all(op, self.exists(p, p.name == op.name && p.componentName
1519+
== op.componentName))
15091520
periodicReconcileInterval:
15101521
default: 300
15111522
description: |-

docs/api_reference.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ _Appears in:_
181181
| `certProvider` _[CertProvidersConfig](#certprovidersconfig)_ | certProvider is for defining the configuration for certificate providers used to manage TLS certificates for webhook and plugins. | | Optional: \{\} <br /> |
182182
| `labels` _object (keys:string, values:string)_ | labels to apply to all resources created for the external-secrets operand deployment.<br />This field can have a maximum of 20 entries. | | MaxProperties: 20 <br />MinProperties: 0 <br />Optional: \{\} <br /> |
183183
| `periodicReconcileInterval` _integer_ | periodicReconcileInterval specifies the time interval in seconds for periodic reconciliation by the operator.<br />This controls how often the operator checks resources created for external-secrets operand to ensure they remain in desired state.<br />Interval can have value between 120-18000 seconds (2 minutes to 5 hours). Defaults to 300 seconds (5 minutes) if not specified. | 300 | Maximum: 18000 <br />Minimum: 120 <br />Optional: \{\} <br /> |
184-
| `networkPolicies` _[NetworkPolicy](#networkpolicy) array_ | networkPolicies specifies the list of network policy configurations<br />to be applied to external-secrets pods.<br />Each entry allows specifying a name for the generated NetworkPolicy object,<br />along with its full Kubernetes NetworkPolicy definition.<br />If this field is not provided, external-secrets components will be isolated<br />with deny-all network policies, which will prevent proper operation. | | Optional: \{\} <br /> |
184+
| `networkPolicies` _[NetworkPolicy](#networkpolicy) array_ | networkPolicies specifies the list of network policy configurations<br />to be applied to external-secrets pods.<br />Each entry allows specifying a name for the generated NetworkPolicy object,<br />along with its full Kubernetes NetworkPolicy definition.<br />If this field is not provided, external-secrets components will be isolated<br />with deny-all network policies, which will prevent proper operation. | | MaxItems: 50 <br />MinItems: 0 <br />Optional: \{\} <br /> |
185185

186186

187187
#### ControllerStatus
@@ -410,7 +410,7 @@ _Appears in:_
410410
| --- | --- | --- | --- |
411411
| `name` _string_ | name is a unique identifier for this network policy configuration.<br />This name will be used as part of the generated NetworkPolicy resource name. | | MaxLength: 253 <br />MinLength: 1 <br />Required: \{\} <br /> |
412412
| `componentName` _[ComponentName](#componentname)_ | componentName specifies which external-secrets component this network policy applies to. | | Enum: [ExternalSecretsCoreController BitwardenSDKServer] <br />Required: \{\} <br /> |
413-
| `egress` _[NetworkPolicyEgressRule](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.32/#networkpolicyegressrule-v1-networking) array_ | egress is a list of egress rules to be applied to the selected pods. Outgoing traffic<br />is allowed if there are no NetworkPolicies selecting the pod (and cluster policy<br />otherwise allows the traffic), OR if the traffic matches at least one egress rule<br />across all of the NetworkPolicy objects whose podSelector matches the pod. If<br />this field is empty then this NetworkPolicy limits all outgoing traffic (and serves<br />solely to ensure that the pods it selects are isolated by default).<br />The operator will automatically handle ingress rules based on the current running ports. | | Required: \{\} <br /> |
413+
| `egress` _[NetworkPolicyEgressRule](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.32/#networkpolicyegressrule-v1-networking) array_ | egress is a list of egress rules to be applied to the selected pods. Outgoing traffic<br />is allowed if there are no NetworkPolicies selecting the pod (and cluster policy<br />otherwise allows the traffic), OR if the traffic matches at least one egress rule<br />across all the NetworkPolicy objects whose podSelector matches the pod. If<br />this field is empty then this NetworkPolicy limits all outgoing traffic (and serves<br />solely to ensure that the pods it selects are isolated by default).<br />The operator will automatically handle ingress rules based on the current running ports. | | Required: \{\} <br /> |
414414

415415

416416
#### ObjectReference

pkg/operator/assets/bindata.go

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

0 commit comments

Comments
 (0)