Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(network): implement optional cryostat egress network policy #1051

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions api/v1beta2/cryostat_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -440,10 +440,14 @@ type NetworkPoliciesList struct {
}

type NetworkPolicyConfig struct {
// Disable the NetworkPolicy for a given service.
// Disable the NetworkPolicy for ingress to a given service. Enabled by default.
// +optional
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Disable NetworkPolicy creation",xDescriptors={"urn:alm:descriptor:com.tectonic.ui:booleanSwitch"}
Disabled *bool `json:"disabled,omitempty"`
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Disable ingress NetworkPolicy creation",xDescriptors={"urn:alm:descriptor:com.tectonic.ui:booleanSwitch"}
IngressDisabled *bool `json:"ingressDisabled,omitempty"`
// Enable the NetworkPolicy for egress from a given pod. Disabled by default.
// +optional
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Enable egress NetworkPolicy creation",xDescriptors={"urn:alm:descriptor:com.tectonic.ui:booleanSwitch"}
EgressEnabled *bool `json:"egressEnabled,omitempty"`
}

// NetworkConfiguration provides customization for how to expose a Cryostat
Expand Down
9 changes: 7 additions & 2 deletions api/v1beta2/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

44 changes: 32 additions & 12 deletions bundle/manifests/cryostat-operator.clusterserviceversion.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -170,24 +170,44 @@ spec:
- description: Options to customize the NetworkPolicy objects created for Cryostat's various Services.
displayName: Network Policies
path: networkPolicies
- description: Disable the NetworkPolicy for a given service.
displayName: Disable NetworkPolicy creation
path: networkPolicies.coreConfig.disabled
- description: Enable the NetworkPolicy for egress from a given pod. Disabled by default.
displayName: Enable egress NetworkPolicy creation
path: networkPolicies.coreConfig.egressEnabled
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:booleanSwitch
- description: Disable the NetworkPolicy for a given service.
displayName: Disable NetworkPolicy creation
path: networkPolicies.databaseConfig.disabled
- description: Disable the NetworkPolicy for ingress to a given service. Enabled by default.
displayName: Disable ingress NetworkPolicy creation
path: networkPolicies.coreConfig.ingressDisabled
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:booleanSwitch
- description: Disable the NetworkPolicy for a given service.
displayName: Disable NetworkPolicy creation
path: networkPolicies.reportsConfig.disabled
- description: Enable the NetworkPolicy for egress from a given pod. Disabled by default.
displayName: Enable egress NetworkPolicy creation
path: networkPolicies.databaseConfig.egressEnabled
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:booleanSwitch
- description: Disable the NetworkPolicy for a given service.
displayName: Disable NetworkPolicy creation
path: networkPolicies.storageConfig.disabled
- description: Disable the NetworkPolicy for ingress to a given service. Enabled by default.
displayName: Disable ingress NetworkPolicy creation
path: networkPolicies.databaseConfig.ingressDisabled
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:booleanSwitch
- description: Enable the NetworkPolicy for egress from a given pod. Disabled by default.
displayName: Enable egress NetworkPolicy creation
path: networkPolicies.reportsConfig.egressEnabled
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:booleanSwitch
- description: Disable the NetworkPolicy for ingress to a given service. Enabled by default.
displayName: Disable ingress NetworkPolicy creation
path: networkPolicies.reportsConfig.ingressDisabled
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:booleanSwitch
- description: Enable the NetworkPolicy for egress from a given pod. Disabled by default.
displayName: Enable egress NetworkPolicy creation
path: networkPolicies.storageConfig.egressEnabled
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:booleanSwitch
- description: Disable the NetworkPolicy for ingress to a given service. Enabled by default.
displayName: Disable ingress NetworkPolicy creation
path: networkPolicies.storageConfig.ingressDisabled
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:booleanSwitch
- description: Options to configure the Cryostat deployments and pods metadata
Expand Down
36 changes: 28 additions & 8 deletions bundle/manifests/operator.cryostat.io_cryostats.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5871,30 +5871,50 @@ spec:
description: NetworkPolicy configuration for the Cryostat application
service.
properties:
disabled:
description: Disable the NetworkPolicy for a given service.
egressEnabled:
description: Enable the NetworkPolicy for egress from a given
pod. Disabled by default.
type: boolean
ingressDisabled:
description: Disable the NetworkPolicy for ingress to a given
service. Enabled by default.
type: boolean
type: object
databaseConfig:
description: NetworkPolicy configuration for the database service.
properties:
disabled:
description: Disable the NetworkPolicy for a given service.
egressEnabled:
description: Enable the NetworkPolicy for egress from a given
pod. Disabled by default.
type: boolean
ingressDisabled:
description: Disable the NetworkPolicy for ingress to a given
service. Enabled by default.
type: boolean
type: object
reportsConfig:
description: NetworkPolicy configuration for the cryostat-reports
service.
properties:
disabled:
description: Disable the NetworkPolicy for a given service.
egressEnabled:
description: Enable the NetworkPolicy for egress from a given
pod. Disabled by default.
type: boolean
ingressDisabled:
description: Disable the NetworkPolicy for ingress to a given
service. Enabled by default.
type: boolean
type: object
storageConfig:
description: NetworkPolicy configuration for the storage service.
properties:
disabled:
description: Disable the NetworkPolicy for a given service.
egressEnabled:
description: Enable the NetworkPolicy for egress from a given
pod. Disabled by default.
type: boolean
ingressDisabled:
description: Disable the NetworkPolicy for ingress to a given
service. Enabled by default.
type: boolean
type: object
type: object
Expand Down
36 changes: 28 additions & 8 deletions config/crd/bases/operator.cryostat.io_cryostats.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5858,30 +5858,50 @@ spec:
description: NetworkPolicy configuration for the Cryostat application
service.
properties:
disabled:
description: Disable the NetworkPolicy for a given service.
egressEnabled:
description: Enable the NetworkPolicy for egress from a given
pod. Disabled by default.
type: boolean
ingressDisabled:
description: Disable the NetworkPolicy for ingress to a given
service. Enabled by default.
type: boolean
type: object
databaseConfig:
description: NetworkPolicy configuration for the database service.
properties:
disabled:
description: Disable the NetworkPolicy for a given service.
egressEnabled:
description: Enable the NetworkPolicy for egress from a given
pod. Disabled by default.
type: boolean
ingressDisabled:
description: Disable the NetworkPolicy for ingress to a given
service. Enabled by default.
type: boolean
type: object
reportsConfig:
description: NetworkPolicy configuration for the cryostat-reports
service.
properties:
disabled:
description: Disable the NetworkPolicy for a given service.
egressEnabled:
description: Enable the NetworkPolicy for egress from a given
pod. Disabled by default.
type: boolean
ingressDisabled:
description: Disable the NetworkPolicy for ingress to a given
service. Enabled by default.
type: boolean
type: object
storageConfig:
description: NetworkPolicy configuration for the storage service.
properties:
disabled:
description: Disable the NetworkPolicy for a given service.
egressEnabled:
description: Enable the NetworkPolicy for egress from a given
pod. Disabled by default.
type: boolean
ingressDisabled:
description: Disable the NetworkPolicy for ingress to a given
service. Enabled by default.
type: boolean
type: object
type: object
Expand Down
52 changes: 40 additions & 12 deletions config/manifests/bases/cryostat-operator.clusterserviceversion.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -187,24 +187,52 @@ spec:
various Services.
displayName: Network Policies
path: networkPolicies
- description: Disable the NetworkPolicy for a given service.
displayName: Disable NetworkPolicy creation
path: networkPolicies.coreConfig.disabled
- description: Enable the NetworkPolicy for egress from a given pod. Disabled
by default.
displayName: Enable egress NetworkPolicy creation
path: networkPolicies.coreConfig.egressEnabled
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:booleanSwitch
- description: Disable the NetworkPolicy for a given service.
displayName: Disable NetworkPolicy creation
path: networkPolicies.databaseConfig.disabled
- description: Disable the NetworkPolicy for ingress to a given service. Enabled
by default.
displayName: Disable ingress NetworkPolicy creation
path: networkPolicies.coreConfig.ingressDisabled
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:booleanSwitch
- description: Disable the NetworkPolicy for a given service.
displayName: Disable NetworkPolicy creation
path: networkPolicies.reportsConfig.disabled
- description: Enable the NetworkPolicy for egress from a given pod. Disabled
by default.
displayName: Enable egress NetworkPolicy creation
path: networkPolicies.databaseConfig.egressEnabled
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:booleanSwitch
- description: Disable the NetworkPolicy for a given service.
displayName: Disable NetworkPolicy creation
path: networkPolicies.storageConfig.disabled
- description: Disable the NetworkPolicy for ingress to a given service. Enabled
by default.
displayName: Disable ingress NetworkPolicy creation
path: networkPolicies.databaseConfig.ingressDisabled
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:booleanSwitch
- description: Enable the NetworkPolicy for egress from a given pod. Disabled
by default.
displayName: Enable egress NetworkPolicy creation
path: networkPolicies.reportsConfig.egressEnabled
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:booleanSwitch
- description: Disable the NetworkPolicy for ingress to a given service. Enabled
by default.
displayName: Disable ingress NetworkPolicy creation
path: networkPolicies.reportsConfig.ingressDisabled
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:booleanSwitch
- description: Enable the NetworkPolicy for egress from a given pod. Disabled
by default.
displayName: Enable egress NetworkPolicy creation
path: networkPolicies.storageConfig.egressEnabled
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:booleanSwitch
- description: Disable the NetworkPolicy for ingress to a given service. Enabled
by default.
displayName: Disable ingress NetworkPolicy creation
path: networkPolicies.storageConfig.ingressDisabled
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:booleanSwitch
- description: Options to configure the Cryostat deployments and pods metadata
Expand Down
Loading