-
Notifications
You must be signed in to change notification settings - Fork 115
CNTRLPLANE-2610: Create network policies for AUTH components #825
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
Open
liouk
wants to merge
4
commits into
openshift:master
Choose a base branch
from
liouk:network-policies
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
317487e
manifests: add authentication-operator pod and namespace network poli…
liouk 07b80f3
bindata: add oauth-server pod and namespace network policies
liouk 8c3d112
bindata: add oauth-apiserver pod and namespace network policies
liouk e9f60f8
om: add test data relevant to network policies
liouk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
10 changes: 10 additions & 0 deletions
10
bindata/oauth-apiserver/networkpolicy_namespace_default-deny-all.yaml
This file contains hidden or 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,10 @@ | ||
| apiVersion: networking.k8s.io/v1 | ||
| kind: NetworkPolicy | ||
| metadata: | ||
| name: default-deny-all | ||
| namespace: openshift-oauth-apiserver | ||
| spec: | ||
| podSelector: {} | ||
| policyTypes: | ||
| - Ingress | ||
| - Egress |
72 changes: 72 additions & 0 deletions
72
bindata/oauth-apiserver/networkpolicy_oauth-apiserver.yaml
This file contains hidden or 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,72 @@ | ||
| apiVersion: networking.k8s.io/v1 | ||
| kind: NetworkPolicy | ||
| metadata: | ||
| name: oauth-apiserver-networkpolicy | ||
| namespace: openshift-oauth-apiserver | ||
| spec: | ||
| podSelector: | ||
| matchLabels: | ||
| app: openshift-oauth-apiserver | ||
| policyTypes: | ||
| - Ingress | ||
| - Egress | ||
| ingress: | ||
| # allow metrics scraping from anywhere | ||
| - ports: | ||
| - protocol: TCP | ||
| port: 8443 | ||
| # allow ingress from the oauth-server | ||
| - from: | ||
| - namespaceSelector: | ||
| matchLabels: | ||
| kubernetes.io/metadata.name: openshift-authentication | ||
| podSelector: | ||
| matchLabels: | ||
| app: oauth-openshift | ||
| ports: | ||
| - protocol: TCP | ||
| port: 8443 | ||
| # allow ingress from the cluster-authentication-operator due to health checks | ||
| - from: | ||
| - namespaceSelector: | ||
| matchLabels: | ||
| kubernetes.io/metadata.name: openshift-authentication-operator | ||
| podSelector: | ||
| matchLabels: | ||
| app: authentication-operator | ||
| ports: | ||
| - protocol: TCP | ||
| port: 8443 | ||
| # allow ingress TCP traffic | ||
| # required for ingress from the kube-apiserver due to the webhook authenticator and aggregated APIs | ||
| - ports: | ||
| - protocol: TCP | ||
| port: 8443 | ||
| egress: | ||
| # allow egress to DNS | ||
| - to: | ||
| - namespaceSelector: | ||
| matchLabels: | ||
| kubernetes.io/metadata.name: openshift-dns | ||
| podSelector: | ||
| matchLabels: | ||
| dns.operator.openshift.io/daemonset-dns: default | ||
| ports: | ||
| - protocol: TCP | ||
| port: 5353 | ||
| - protocol: UDP | ||
| port: 5353 | ||
| # allow egress to etcd | ||
| - to: | ||
| - namespaceSelector: | ||
| matchLabels: | ||
| kubernetes.io/metadata.name: openshift-etcd | ||
| podSelector: | ||
| matchLabels: | ||
| app: etcd | ||
| ports: | ||
| - protocol: TCP | ||
| port: 2379 | ||
| # allow all egress traffic | ||
| # required for egress to kube-apiserver pods | ||
| - {} |
10 changes: 10 additions & 0 deletions
10
bindata/oauth-openshift/networkpolicy_namespace_default-deny-all.yaml
This file contains hidden or 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,10 @@ | ||
| apiVersion: networking.k8s.io/v1 | ||
| kind: NetworkPolicy | ||
| metadata: | ||
| name: default-deny-all | ||
| namespace: openshift-authentication | ||
| spec: | ||
| podSelector: {} | ||
| policyTypes: | ||
| - Ingress | ||
| - Egress |
This file contains hidden or 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,71 @@ | ||
| apiVersion: networking.k8s.io/v1 | ||
| kind: NetworkPolicy | ||
| metadata: | ||
| name: oauth-server-networkpolicy | ||
| namespace: openshift-authentication | ||
| spec: | ||
| podSelector: | ||
| matchLabels: | ||
| app: oauth-openshift | ||
| policyTypes: | ||
| - Ingress | ||
| - Egress | ||
| ingress: | ||
| # allow metrics scraping from anywhere | ||
| - ports: | ||
| - protocol: TCP | ||
| port: 6443 | ||
| # allow ingress from the router | ||
| - from: | ||
| - namespaceSelector: | ||
| matchLabels: | ||
| policy-group.network.openshift.io/ingress: "" | ||
| ports: | ||
| - protocol: TCP | ||
| port: 6443 | ||
| # allow ingress from the cluster-authentication-operator due to health checks | ||
| - from: | ||
| - namespaceSelector: | ||
| matchLabels: | ||
| kubernetes.io/metadata.name: openshift-authentication-operator | ||
| podSelector: | ||
| matchLabels: | ||
| app: authentication-operator | ||
| ports: | ||
| - protocol: TCP | ||
| port: 6443 | ||
| # allow ingress from oauth-proxy as it can live in any namespace and pod (it's a sidecar) | ||
| - from: | ||
| - namespaceSelector: {} | ||
| ports: | ||
| - protocol: TCP | ||
| port: 6443 | ||
| egress: | ||
| # allow egress to DNS | ||
| - to: | ||
| - namespaceSelector: | ||
| matchLabels: | ||
| kubernetes.io/metadata.name: openshift-dns | ||
| podSelector: | ||
| matchLabels: | ||
| dns.operator.openshift.io/daemonset-dns: default | ||
| ports: | ||
| - protocol: TCP | ||
| port: 5353 | ||
| - protocol: UDP | ||
| port: 5353 | ||
| # allow egress traffic to oauth-apiserver pods to access oauth APIs | ||
| # this rule overlaps with the generic TCP egress rule but exists for documentation purposes | ||
| - to: | ||
| - namespaceSelector: | ||
| matchLabels: | ||
| kubernetes.io/metadata.name: openshift-oauth-apiserver | ||
| podSelector: | ||
| matchLabels: | ||
| app: openshift-oauth-apiserver | ||
| ports: | ||
| - protocol: TCP | ||
| port: 8443 | ||
| # allow all egress traffic | ||
| # required for egress to kube-apiserver pods and configured IDPs | ||
| - {} | ||
61 changes: 61 additions & 0 deletions
61
manifests/0000_10_networkpolicy_00_authentication-operator.yaml
This file contains hidden or 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,61 @@ | ||
| apiVersion: networking.k8s.io/v1 | ||
| kind: NetworkPolicy | ||
| metadata: | ||
| name: authentication-operator-networkpolicy | ||
| namespace: openshift-authentication-operator | ||
| annotations: | ||
| include.release.openshift.io/self-managed-high-availability: "true" | ||
| include.release.openshift.io/single-node-developer: "true" | ||
| spec: | ||
| podSelector: | ||
| matchLabels: | ||
| app: authentication-operator | ||
| policyTypes: | ||
| - Ingress | ||
| - Egress | ||
| ingress: | ||
| # allow metrics scraping from anywhere | ||
| - ports: | ||
| - protocol: TCP | ||
| port: 8443 | ||
| egress: | ||
| # allow egress to DNS | ||
| - to: | ||
| - namespaceSelector: | ||
| matchLabels: | ||
| kubernetes.io/metadata.name: openshift-dns | ||
| podSelector: | ||
| matchLabels: | ||
| dns.operator.openshift.io/daemonset-dns: default | ||
| ports: | ||
| - protocol: TCP | ||
| port: 5353 | ||
| - protocol: UDP | ||
| port: 5353 | ||
| # allow egress traffic to oauth-server pods for health checks | ||
| # this rule overlaps with the generic TCP egress rule but exists for documentation purposes | ||
| - to: | ||
| - namespaceSelector: | ||
| matchLabels: | ||
| kubernetes.io/metadata.name: openshift-authentication | ||
| podSelector: | ||
| matchLabels: | ||
| app: oauth-openshift | ||
| ports: | ||
| - protocol: TCP | ||
| port: 6443 | ||
| # allow egress traffic to oauth-apiserver pods for health checks | ||
| # this rule overlaps with the generic TCP egress rule but exists for documentation purposes | ||
| - to: | ||
| - namespaceSelector: | ||
| matchLabels: | ||
| kubernetes.io/metadata.name: openshift-oauth-apiserver | ||
| podSelector: | ||
| matchLabels: | ||
| app: openshift-oauth-apiserver | ||
| ports: | ||
| - protocol: TCP | ||
| port: 8443 | ||
| # allow all egress traffic | ||
| # required for egress to kube-apiserver pods and openID provider discovery (external OIDC and via oauth) | ||
| - {} |
13 changes: 13 additions & 0 deletions
13
manifests/0000_10_networkpolicy_99_namespace_default-deny-all.yaml
This file contains hidden or 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,13 @@ | ||
| apiVersion: networking.k8s.io/v1 | ||
| kind: NetworkPolicy | ||
| metadata: | ||
| name: default-deny-all | ||
| namespace: openshift-authentication-operator | ||
| annotations: | ||
| include.release.openshift.io/self-managed-high-availability: "true" | ||
| include.release.openshift.io/single-node-developer: "true" | ||
| spec: | ||
| podSelector: {} | ||
| policyTypes: | ||
| - Ingress | ||
| - Egress |
This file contains hidden or 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 hidden or 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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
24 changes: 24 additions & 0 deletions
24
...ion-operator/core/events/3f86-body-authentication-operator.17fe72c59b829800.05fbd8b8.yaml
This file contains hidden or 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,24 @@ | ||
| apiVersion: v1 | ||
| count: 1 | ||
| eventTime: null | ||
| firstTimestamp: "2024-10-14T22:38:20Z" | ||
| involvedObject: | ||
| kind: Deployment | ||
| name: authentication-operator | ||
| namespace: openshift-authentication-operator | ||
| kind: Event | ||
| lastTimestamp: "2024-10-14T22:38:20Z" | ||
| message: 'Writing updated section ("oauthAPIServer") of observed config: "@@ -1 +1,24 | ||
| @@\n-null\n+{\n+ \"apiServerArguments\": {\n+ \"api-audiences\": [\n+ \"https://kubernetes.default.svc\"\n+ ],\n+ \"cors-allowed-origins\": | ||
| [\n+ \"//127\\\\.0\\\\.0\\\\.1(:|$)\",\n+ \"//localhost(:|$)\"\n+ ],\n+ \"feature-gates\": | ||
| [],\n+ \"tls-cipher-suites\": [\n+ \"TLS_AES_128_GCM_SHA256\",\n+ \"TLS_AES_256_GCM_SHA384\",\n+ \"TLS_CHACHA20_POLY1305_SHA256\",\n+ \"TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256\",\n+ \"TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256\",\n+ \"TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384\",\n+ \"TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384\",\n+ \"TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256\",\n+ \"TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256\"\n+ ],\n+ \"tls-min-version\": | ||
| \"VersionTLS12\"\n+ }\n+}\n"' | ||
| metadata: | ||
| name: authentication-operator.17fe72c59b829800.05fbd8b8 | ||
| namespace: openshift-authentication-operator | ||
| reason: ObservedConfigChanged | ||
| reportingComponent: "" | ||
| reportingInstance: "" | ||
| source: | ||
| component: cluster-authentication-operator-run-once-sync-context | ||
| type: Normal |
2 changes: 1 addition & 1 deletion
2
...n-operator.17fe72c59b829800.2a24f1b5.yaml → ...n-operator.17fe72c59b829800.05fbd8b8.yaml
This file contains hidden or 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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
21 changes: 21 additions & 0 deletions
21
...ion-operator/core/events/53aa-body-authentication-operator.17fe72c59b829800.ec96ffd6.yaml
This file contains hidden or 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,21 @@ | ||
| apiVersion: v1 | ||
| count: 1 | ||
| eventTime: null | ||
| firstTimestamp: "2024-10-14T22:38:20Z" | ||
| involvedObject: | ||
| kind: Deployment | ||
| name: authentication-operator | ||
| namespace: openshift-authentication-operator | ||
| kind: Event | ||
| lastTimestamp: "2024-10-14T22:38:20Z" | ||
| message: Created NetworkPolicy.networking.k8s.io/default-deny-all -n openshift-authentication | ||
| because it was missing | ||
| metadata: | ||
| name: authentication-operator.17fe72c59b829800.ec96ffd6 | ||
| namespace: openshift-authentication-operator | ||
| reason: NetworkPolicyCreated | ||
| reportingComponent: "" | ||
| reportingInstance: "" | ||
| source: | ||
| component: cluster-authentication-operator-run-once-sync-context | ||
| type: Normal |
2 changes: 1 addition & 1 deletion
2
...n-operator.17fe72c59b829800.ad6de22d.yaml → ...n-operator.17fe72c59b829800.ec96ffd6.yaml
This file contains hidden or 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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
21 changes: 21 additions & 0 deletions
21
...ion-operator/core/events/6393-body-authentication-operator.17fe72c59b829800.c879600c.yaml
This file contains hidden or 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,21 @@ | ||
| apiVersion: v1 | ||
| count: 1 | ||
| eventTime: null | ||
| firstTimestamp: "2024-10-14T22:38:20Z" | ||
| involvedObject: | ||
| kind: Deployment | ||
| name: authentication-operator | ||
| namespace: openshift-authentication-operator | ||
| kind: Event | ||
| lastTimestamp: "2024-10-14T22:38:20Z" | ||
| message: Created NetworkPolicy.networking.k8s.io/default-deny-all -n openshift-oauth-apiserver | ||
| because it was missing | ||
| metadata: | ||
| name: authentication-operator.17fe72c59b829800.c879600c | ||
| namespace: openshift-authentication-operator | ||
| reason: NetworkPolicyCreated | ||
| reportingComponent: "" | ||
| reportingInstance: "" | ||
| source: | ||
| component: cluster-authentication-operator-run-once-sync-context | ||
| type: Normal |
2 changes: 1 addition & 1 deletion
2
...n-operator.18599d2230299800.5f2cc1a1.yaml → ...n-operator.17fe72c59b829800.c879600c.yaml
This file contains hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.