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

add info about ingress allow list and which port is public #1100

Merged
merged 4 commits into from
Sep 26, 2024
Merged
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
4 changes: 2 additions & 2 deletions src/components/component/component-ports.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ export const ComponentPorts: FunctionComponent<{ ports: Array<Port> }> = ({
<div>
<Typography>Open ports:</Typography>
<List className="o-indent-list">
{ports.map(({ name, port }) => (
{ports.map(({ name, port, isPublic }) => (
<List.Item key={port}>
{port} ({name})
{port} ({name}) {isPublic && '- public'}
</List.Item>
))}
</List>
Expand Down
23 changes: 23 additions & 0 deletions src/components/component/ingress-allow-list.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { List, Typography } from '@equinor/eds-core-react';
import * as PropTypes from 'prop-types';
import type { FunctionComponent } from 'react';

export const IngressAllowList: FunctionComponent<{
allowedIpRanges?: Array<string>;
}> = ({ allowedIpRanges }) =>
allowedIpRanges?.length > 0 ? (
<div>
<Typography>Accessible from public IP address ranges:</Typography>
<List className="o-indent-list">
{allowedIpRanges.map((ip) => (
<List.Item key={ip}>{ip}</List.Item>
))}
</List>
</div>
) : (
<Typography>Accessible from all public IP addresses</Typography>
);

IngressAllowList.propTypes = {
allowedIpRanges: PropTypes.arrayOf(PropTypes.string),
};
6 changes: 6 additions & 0 deletions src/components/page-active-component/overview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import type {
ExternalDns,
} from '../../store/radix-api';
import './style.css';
import { IngressAllowList } from '../component/ingress-allow-list';
import { ResourceRequirements } from '../resource-requirements';
import { Runtime } from '../runtime';
import { DNSAliases } from './dns-aliases';
Expand Down Expand Up @@ -97,6 +98,11 @@ export const Overview = ({
title={'DNS external aliases'}
/>
)}
{component.ports?.some(({ isPublic }) => isPublic) && (
<IngressAllowList
allowedIpRanges={component.network?.ingress?.public?.allow}
/>
)}
<ComponentPorts ports={component.ports} />
{component.runtime && (
<div className="grid grid--gap-medium">
Expand Down
20 changes: 15 additions & 5 deletions src/components/page-deployment-component/dev.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const testData: Array<
}
> = [
{
appName: 'Consistent',
appName: 'myapp',
deploymentName: 'prod-gyslp-0raq4x2c',
componentName: 'www',
deployment: {
Expand All @@ -31,7 +31,10 @@ const testData: Array<
name: 'www',
type: 'component',
status: 'Consistent',
ports: [{ name: 'http', port: 3003 }],
ports: [
{ name: 'http', port: 3003, isPublic: true },
{ name: 'metrics', port: 9000, isPublic: false },
],
replicaList: [
{
name: 'server-6ff44564cb-f45q9',
Expand Down Expand Up @@ -73,8 +76,8 @@ const testData: Array<
},
},
{
appName: 'Stopped',
deploymentName: 'prod-gyslp-0raq4x2c',
appName: 'myapp',
deploymentName: 'prod-gyslp-0raq4x2d',
componentName: 'www',
deployment: {
name: 'prod-gyslp-0raq4x2c',
Expand All @@ -89,7 +92,14 @@ const testData: Array<
name: 'www',
type: 'component',
status: 'Stopped',
ports: [{ name: 'http', port: 3003 }],
ports: [{ name: 'http', port: 3003, isPublic: true }],
network: {
ingress: {
public: {
allow: ['100.1.1.1', '200.1.1.1/32'],
},
},
},
replicaList: [
{
name: 'server-6ff44564cb-f45q9',
Expand Down
20 changes: 10 additions & 10 deletions src/components/page-deployment-job-component/dev.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const testData: Array<
name: 'api',
type: 'component',
status: 'Consistent',
ports: [{ name: 'http', port: 5005 }],
ports: [{ name: 'http', port: 5005, isPublic: true }],
replicaList: [
{
name: 'api-587b8877c-9xr4x',
Expand Down Expand Up @@ -63,7 +63,7 @@ const testData: Array<
name: 'auth-proxy',
type: 'component',
status: 'Consistent',
ports: [{ name: 'http', port: 8000 }],
ports: [{ name: 'http', port: 8000, isPublic: true }],
replicaList: [
{
name: 'auth-proxy-86bb8c47c-wwhx8',
Expand Down Expand Up @@ -117,7 +117,7 @@ const testData: Array<
name: 'auth-state',
type: 'component',
status: 'Consistent',
ports: [{ name: 'redis', port: 6379 }],
ports: [{ name: 'redis', port: 6379, isPublic: true }],
replicaList: [
{
name: 'auth-state-74f5b9488b-pwm2c',
Expand Down Expand Up @@ -147,7 +147,7 @@ const testData: Array<
name: 'compute',
type: 'job',
status: 'Consistent',
ports: [{ name: 'http', port: 8080 }],
ports: [{ name: 'http', port: 8080, isPublic: true }],
schedulerPort: 8080,
scheduledJobPayloadPath: '/compute/payload',
replicaList: [
Expand Down Expand Up @@ -184,7 +184,7 @@ const testData: Array<
name: 'compute2',
type: 'job',
status: 'Consistent',
ports: [{ name: 'http', port: 8080 }],
ports: [{ name: 'http', port: 8080, isPublic: true }],
schedulerPort: 8080,
scheduledJobPayloadPath: '/compute/payload',
replicaList: [
Expand Down Expand Up @@ -232,7 +232,7 @@ const testData: Array<
name: 'api',
type: 'component',
status: 'Consistent',
ports: [{ name: 'http', port: 5005 }],
ports: [{ name: 'http', port: 5005, isPublic: true }],
replicaList: [
{
name: 'api-587b8877c-9xr4x',
Expand Down Expand Up @@ -266,7 +266,7 @@ const testData: Array<
name: 'auth-proxy',
type: 'component',
status: 'Consistent',
ports: [{ name: 'http', port: 8000 }],
ports: [{ name: 'http', port: 8000, isPublic: true }],
replicaList: [
{
name: 'auth-proxy-86bb8c47c-wwhx8',
Expand Down Expand Up @@ -320,7 +320,7 @@ const testData: Array<
name: 'auth-state',
type: 'component',
status: 'Consistent',
ports: [{ name: 'redis', port: 6379 }],
ports: [{ name: 'redis', port: 6379, isPublic: true }],
replicaList: [
{
name: 'auth-state-74f5b9488b-pwm2c',
Expand Down Expand Up @@ -350,7 +350,7 @@ const testData: Array<
name: 'compute',
type: 'job',
status: 'Stopped',
ports: [{ name: 'http', port: 8080 }],
ports: [{ name: 'http', port: 8080, isPublic: true }],
schedulerPort: 8080,
scheduledJobPayloadPath: '/compute/payload',
replicaList: [
Expand Down Expand Up @@ -385,7 +385,7 @@ const testData: Array<
name: 'compute2',
type: 'job',
status: 'Consistent',
ports: [{ name: 'http', port: 8080 }],
ports: [{ name: 'http', port: 8080, isPublic: true }],
schedulerPort: 8080,
scheduledJobPayloadPath: '/compute/payload',
replicaList: [
Expand Down
14 changes: 7 additions & 7 deletions src/components/page-deployment/dev.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const testData: Array<
name: 'server',
type: 'component',
status: 'Reconciling',
ports: [{ name: 'http', port: 5005 }],
ports: [{ name: 'http', port: 5005, isPublic: true }],
replicaList: [
{
name: 'server-68f6cc7984-sw9zv',
Expand Down Expand Up @@ -63,7 +63,7 @@ const testData: Array<
name: 'auth-proxy',
type: 'component',
status: 'Reconciling',
ports: [{ name: 'http', port: 8000 }],
ports: [{ name: 'http', port: 8000, isPublic: true }],
replicaList: [
{
name: 'auth-proxy-79db7d5668-nsz8c',
Expand Down Expand Up @@ -120,7 +120,7 @@ const testData: Array<
name: 'auth-state',
type: 'component',
status: 'Consistent',
ports: [{ name: 'redis', port: 6379 }],
ports: [{ name: 'redis', port: 6379, isPublic: true }],
replicaList: [
{
name: 'auth-state-6dbd7cfb4c-g7qsn',
Expand Down Expand Up @@ -148,7 +148,7 @@ const testData: Array<
name: 'compute',
type: 'job',
status: 'Consistent',
ports: [{ name: 'http', port: 8000 }],
ports: [{ name: 'http', port: 8000, isPublic: true }],
schedulerPort: 8080,
scheduledJobPayloadPath: '/compute/payload',
replicaList: [
Expand Down Expand Up @@ -196,7 +196,7 @@ const testData: Array<
name: 'server',
type: 'component',
status: 'Reconciling',
ports: [{ name: 'http', port: 5005 }],
ports: [{ name: 'http', port: 5005, isPublic: true }],
replicaList: [
{
name: 'server-68f6cc7984-sw9zv',
Expand Down Expand Up @@ -234,7 +234,7 @@ const testData: Array<
name: 'auth-proxy',
type: 'component',
status: 'Reconciling',
ports: [{ name: 'http', port: 8000 }],
ports: [{ name: 'http', port: 8000, isPublic: true }],
replicaList: [
{
name: 'auth-proxy-79db7d5668-nsz8c',
Expand Down Expand Up @@ -291,7 +291,7 @@ const testData: Array<
name: 'auth-state',
type: 'component',
status: 'Consistent',
ports: [{ name: 'redis', port: 6379 }],
ports: [{ name: 'redis', port: 6379, isPublic: true }],
replicaList: [
{
name: 'auth-state-6dbd7cfb4c-g7qsn',
Expand Down
15 changes: 14 additions & 1 deletion src/store/radix-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2321,6 +2321,16 @@ export type AzureIdentity = {
export type Identity = {
azure?: AzureIdentity;
};
export type IngressPublic = {
/** List of allowed IP addresses or CIDRs. All traffic is allowed if list is empty. */
allow: string[];
};
export type Ingress = {
public?: IngressPublic;
};
export type Network = {
ingress?: Ingress;
};
export type Notifications = {
/** Webhook is a URL for notification about internal events or changes. The URL should be of a Radix component or job-component, with not public port. */
webhook?: string;
Expand Down Expand Up @@ -2413,10 +2423,12 @@ export type OAuth2AuxiliaryResource = {
deployment: AuxiliaryResourceDeployment;
};
export type Port = {
/** IsPublic indicates that the port is accessible from the Internet by proxying traffic from 443 */
isPublic: boolean;
/** Component port name. From radixconfig.yaml */
name: string;
/** Component port number. From radixconfig.yaml */
port?: number;
port: number;
};
export type Runtime = {
/** CPU architecture */
Expand All @@ -2435,6 +2447,7 @@ export type Component = {
image: string;
/** Name the component */
name: string;
network?: Network;
notifications?: Notifications;
oauth2?: OAuth2AuxiliaryResource;
/** Ports defines the port number and protocol that a component is exposed for internally in environment */
Expand Down