Rename all to rules_resf and resf_frontend

This commit is contained in:
Mustafa Gezen 2022-10-30 08:58:16 +01:00
parent bc3e8ce58e
commit 5ac71b67c2
Signed by untrusted user who does not match committer: mustafa
GPG Key ID: DCDF010D946438C1
83 changed files with 296 additions and 290 deletions

View File

@ -51,4 +51,4 @@ For best experience use IntelliJ+Bazel but `govendor` creates structure that is
#### Run UI in development mode #### Run UI in development mode
`ibazel run //TARGET:TARGET.server` - example: `ibazel run //apollo/ui:apollo.server` `ibazel run //TARGET:TARGET.server` - example: `ibazel run //apollo/ui:apollo.server`
#### Find UI server targets #### Find UI server targets
`bazel query 'attr(tags, "byc_frontend_server", //...)'` `bazel query 'attr(tags, "resf_frontend_server", //...)'`

View File

@ -100,6 +100,23 @@ go_repository(
version = "v0.0.0-20210514164344-f6687ab2804c", version = "v0.0.0-20210514164344-f6687ab2804c",
) )
# --start target-determinator--
http_archive(
name = "bazel_contrib_target_determinator",
sha256 = "1245f255cf5b857181adb7606a45a738ac4404278f33b3dc0ce0097ec70ccbb3",
strip_prefix = "target-determinator-61d25f5e13a4b2205b338531b929464e3ed5eb3d",
urls = ["https://github.com/bazel-contrib/target-determinator/archive/61d25f5e13a4b2205b338531b929464e3ed5eb3d.tar.gz"],
)
load("@bazel_contrib_target_determinator//:third_party/go/deps.bzl", td_go_dependencies = "go_dependencies")
td_go_dependencies()
load("@bazel_contrib_target_determinator//:third_party/go/bazel_differ_deps.bzl", td_differ_go_dependencies = "go_dependencies")
td_differ_go_dependencies()
# --end target-determinator--
gazelle_dependencies() gazelle_dependencies()
load("@io_bazel_rules_go//extras:embed_data_deps.bzl", "go_embed_data_dependencies") load("@io_bazel_rules_go//extras:embed_data_deps.bzl", "go_embed_data_dependencies")

View File

@ -1,4 +1,4 @@
load("//rules_byc:defs.bzl", "BYCDEPLOY_OUTS_MIGRATE", "container", "peridot_k8s") load("//rules_resf:defs.bzl", "RESFDEPLOY_OUTS_MIGRATE", "container", "peridot_k8s")
container( container(
base = "//bases/bazel/go", base = "//bases/bazel/go",
@ -14,6 +14,6 @@ container(
peridot_k8s( peridot_k8s(
name = "apollo", name = "apollo",
src = "deploy.jsonnet", src = "deploy.jsonnet",
outs = BYCDEPLOY_OUTS_MIGRATE, outs = RESFDEPLOY_OUTS_MIGRATE,
deps = ["//ci"], deps = ["//ci"],
) )

View File

@ -1,10 +1,10 @@
local bycdeploy = import 'ci/bycdeploy.jsonnet'; local RESFDEPLOY = import 'ci/RESFDEPLOY.jsonnet';
local db = import 'ci/db.jsonnet'; local db = import 'ci/db.jsonnet';
local kubernetes = import 'ci/kubernetes.jsonnet'; local kubernetes = import 'ci/kubernetes.jsonnet';
local temporal = import 'ci/temporal.jsonnet'; local temporal = import 'ci/temporal.jsonnet';
local utils = import 'ci/utils.jsonnet'; local utils = import 'ci/utils.jsonnet';
bycdeploy.new({ RESFDEPLOY.new({
name: 'apollo', name: 'apollo',
replicas: 1, replicas: 1,
dbname: 'apollo', dbname: 'apollo',

View File

@ -1,4 +1,4 @@
load("//rules_byc:defs.bzl", "BYCDEPLOY_OUTS_MIGRATE", "container", "peridot_k8s") load("//rules_resf:defs.bzl", "RESFDEPLOY_OUTS_MIGRATE", "container", "peridot_k8s")
container( container(
base = "//bases/bazel/go", base = "//bases/bazel/go",
@ -11,7 +11,7 @@ container(
peridot_k8s( peridot_k8s(
name = "apollostarter", name = "apollostarter",
src = "deploy.jsonnet", src = "deploy.jsonnet",
outs = BYCDEPLOY_OUTS_MIGRATE, outs = RESFDEPLOY_OUTS_MIGRATE,
deps = [ deps = [
"//ci", "//ci",
], ],

View File

@ -1,4 +1,4 @@
local bycdeploy = import 'ci/bycdeploy.jsonnet'; local RESFDEPLOY = import 'ci/RESFDEPLOY.jsonnet';
local db = import 'ci/db.jsonnet'; local db = import 'ci/db.jsonnet';
local kubernetes = import 'ci/kubernetes.jsonnet'; local kubernetes = import 'ci/kubernetes.jsonnet';
local temporal = import 'ci/temporal.jsonnet'; local temporal = import 'ci/temporal.jsonnet';
@ -6,7 +6,7 @@ local utils = import 'ci/utils.jsonnet';
local site = std.extVar('site'); local site = std.extVar('site');
bycdeploy.new({ RESFDEPLOY.new({
name: 'apollostarter', name: 'apollostarter',
replicas: 1, replicas: 1,
dbname: 'apollo', dbname: 'apollo',

View File

@ -1,4 +1,4 @@
load("//rules_byc:defs.bzl", "BYCDEPLOY_OUTS_MIGRATE", "container", "peridot_k8s") load("//rules_resf:defs.bzl", "RESFDEPLOY_OUTS_MIGRATE", "container", "peridot_k8s")
container( container(
base = "//bases/bazel/go", base = "//bases/bazel/go",
@ -11,7 +11,7 @@ container(
peridot_k8s( peridot_k8s(
name = "apolloworker", name = "apolloworker",
src = "deploy.jsonnet", src = "deploy.jsonnet",
outs = BYCDEPLOY_OUTS_MIGRATE, outs = RESFDEPLOY_OUTS_MIGRATE,
deps = [ deps = [
"//ci", "//ci",
], ],

View File

@ -1,4 +1,4 @@
local bycdeploy = import 'ci/bycdeploy.jsonnet'; local RESFDEPLOY = import 'ci/RESFDEPLOY.jsonnet';
local db = import 'ci/db.jsonnet'; local db = import 'ci/db.jsonnet';
local kubernetes = import 'ci/kubernetes.jsonnet'; local kubernetes = import 'ci/kubernetes.jsonnet';
local temporal = import 'ci/temporal.jsonnet'; local temporal = import 'ci/temporal.jsonnet';
@ -6,7 +6,7 @@ local utils = import 'ci/utils.jsonnet';
local site = std.extVar('site'); local site = std.extVar('site');
bycdeploy.new({ RESFDEPLOY.new({
name: 'apolloworker', name: 'apolloworker',
replicas: 1, replicas: 1,
dbname: 'apollo', dbname: 'apollo',

View File

@ -1,5 +1,5 @@
package(default_visibility = ["//visibility:public"]) package(default_visibility = ["//visibility:public"])
load("//rules_byc:defs.bzl", "migration_tar") load("//rules_resf:defs.bzl", "migration_tar")
migration_tar() migration_tar()

View File

@ -1,4 +1,4 @@
load("//rules_byc:defs.bzl", "BYCDEPLOY_OUTS_BASE", "byc_frontend", "container", "peridot_k8s") load("//rules_resf:defs.bzl", "RESFDEPLOY_OUTS_BASE", "container", "peridot_k8s", "resf_frontend")
package(default_visibility = ["//visibility:public"]) package(default_visibility = ["//visibility:public"])
@ -8,18 +8,18 @@ server_entrypoint = "server/index.mjs"
server_srcs = glob(["server/**/*.mjs"]) server_srcs = glob(["server/**/*.mjs"])
byc_frontend( resf_frontend(
name = "apollo", name = "apollo",
srcs = glob([ srcs = glob([
"src/**/*.tsx", "src/**/*.tsx",
"src/**/*.ts", "src/**/*.ts",
]), ]),
entrypoint = "apollo/ui/src/entrypoint.tsx", entrypoint = "apollo/ui/src/entrypoint.tsx",
index_html = "//rules_byc/internal/byc_bundle:index_no_mobile.hbs", index_html = "//rules_resf/internal/resf_bundle:index_no_mobile.hbs",
server_deps = server_deps, server_deps = server_deps,
server_entrypoint = server_entrypoint, server_entrypoint = server_entrypoint,
server_srcs = server_srcs, server_srcs = server_srcs,
tailwind_config = "//rules_byc/internal/byc_bundle:tailwind.config.nopreflight.js", tailwind_config = "//rules_resf/internal/resf_bundle:tailwind.config.nopreflight.js",
title = "Rocky Enterprise Software Foundation Product Errata", title = "Rocky Enterprise Software Foundation Product Errata",
deps = [ deps = [
"//apollo/proto/v1:client_typescript", "//apollo/proto/v1:client_typescript",
@ -52,6 +52,6 @@ container(
peridot_k8s( peridot_k8s(
name = "apollo-frontend", name = "apollo-frontend",
src = "deploy.jsonnet", src = "deploy.jsonnet",
outs = BYCDEPLOY_OUTS_BASE, outs = RESFDEPLOY_OUTS_BASE,
deps = ["//ci"], deps = ["//ci"],
) )

View File

@ -1,10 +1,10 @@
local bycdeploy = import 'ci/bycdeploy.jsonnet'; local RESFDEPLOY = import 'ci/RESFDEPLOY.jsonnet';
local kubernetes = import 'ci/kubernetes.jsonnet'; local kubernetes = import 'ci/kubernetes.jsonnet';
local frontend = import 'ci/frontend.jsonnet'; local frontend = import 'ci/frontend.jsonnet';
local tag = std.extVar('tag'); local tag = std.extVar('tag');
bycdeploy.new({ RESFDEPLOY.new({
name: 'apollo-frontend', name: 'apollo-frontend',
backend: false, backend: false,
migrate: false, migrate: false,

View File

@ -31,24 +31,28 @@
*/ */
import server from '../../../common/frontend_server/index.mjs'; import server from '../../../common/frontend_server/index.mjs';
import { svcNameHttp, endpointHttp, NS } from '../../../common/frontend_server/upstream.mjs'; import {
svcNameHttp,
endpointHttp,
NS,
} from '../../../common/frontend_server/upstream.mjs';
export default async function run(webpackConfig) { export default async function run(webpackConfig) {
const devFrontendUrl = 'http://errata.pdot.localhost:9007'; const devFrontendUrl = 'http://errata.pdot.localhost:9007';
const envPublicUrl = process.env['APOLLO_FRONTEND_HTTP_PUBLIC_URL']; const envPublicUrl = process.env['APOLLO_FRONTEND_HTTP_PUBLIC_URL'];
const frontendUrl = process.env['BYC_NS'] ? envPublicUrl : devFrontendUrl; const frontendUrl = process.env['RESF_NS'] ? envPublicUrl : devFrontendUrl;
server({ server({
baseURL: frontendUrl, baseURL: frontendUrl,
apis: { apis: {
'/api': { '/api': {
prodApiUrl: endpointHttp(svcNameHttp('apollo'), NS('apollo')), prodApiUrl: endpointHttp(svcNameHttp('apollo'), NS('apollo')),
devApiUrl: `https://apollo-dev.internal.rdev.ciq.localhost` devApiUrl: `https://apollo-dev.internal.rdev.ciq.localhost`,
}, },
}, },
port: 9007, port: 9007,
disableAuth: true, disableAuth: true,
webpackConfig webpackConfig,
}).then(); }).then();
} }

View File

@ -38,20 +38,8 @@ import CssBaseline from '@mui/material/CssBaseline';
import { Root } from './components/Root'; import { Root } from './components/Root';
import 'tailwind/tailwind.css'; import 'tailwind/tailwind.css';
import { createMuiTheme, ThemeProvider } from '@mui/material';
import { PeridotThemeProvider } from 'common/mui/theme'; import { PeridotThemeProvider } from 'common/mui/theme';
const theme = createMuiTheme({
palette: {
primary: {
main: '#18181b',
},
secondary: {
main: '#10b981',
},
},
});
export const app = () => { export const app = () => {
ReactDOM.render( ReactDOM.render(
<BrowserRouter> <BrowserRouter>

View File

@ -9,7 +9,7 @@
value: 'production', value: 'production',
}, },
{ {
name: 'BYC_SECRET', name: 'RESF_SECRET',
valueFrom: true, valueFrom: true,
secret: { secret: {
name: 'server', name: 'server',
@ -27,4 +27,4 @@
}, },
}, },
] ]
} }

View File

@ -3,7 +3,7 @@ local base = import 'ci/istio/base.libsonnet';
{ {
FILTER_TYPE_CUSTOM: 'custom', FILTER_TYPE_CUSTOM: 'custom',
FILTER_TYPE_REDIRECT: 'redirect', FILTER_TYPE_REDIRECT: 'redirect',
MATCH_TYPE_BYCDEPLOY: 'bycdeploy', MATCH_TYPE_RESFDEPLOY: 'RESFDEPLOY',
MATCH_TYPE_ALL: 'all', MATCH_TYPE_ALL: 'all',
envoy_filter(info):: envoy_filter(info)::
@ -18,7 +18,7 @@ local base = import 'ci/istio/base.libsonnet';
}, },
spec: if filterType == $.FILTER_TYPE_CUSTOM then info.filter else { spec: if filterType == $.FILTER_TYPE_CUSTOM then info.filter else {
workloadSelector: if matchType == $.MATCH_TYPE_ALL then {} workloadSelector: if matchType == $.MATCH_TYPE_ALL then {}
else if matchType == $.MATCH_TYPE_BYCDEPLOY then { else if matchType == $.MATCH_TYPE_RESFDEPLOY then {
} }
else non_existing_value, else non_existing_value,
}, },

View File

@ -16,16 +16,16 @@ local utils = import 'ci/utils.jsonnet';
local defaultEnvs = [ local defaultEnvs = [
{ {
name: 'BYC_ENV', name: 'RESF_ENV',
value: stageNoDash, value: stageNoDash,
}, },
{ {
name: 'BYC_NS', name: 'RESF_NS',
valueFrom: true, valueFrom: true,
field: 'metadata.namespace', field: 'metadata.namespace',
}, },
{ {
name: 'BYC_SERVICE_ACCOUNT', name: 'RESF_SERVICE_ACCOUNT',
valueFrom: true, valueFrom: true,
field: 'spec.serviceAccountName', field: 'spec.serviceAccountName',
}, },

View File

@ -50,18 +50,18 @@ const { createProxyMiddleware } = httpProxyMiddleware;
const { auth } = expressOidc; const { auth } = expressOidc;
export default async function(opts) { export default async function (opts) {
// Create a new app for health checks. // Create a new app for health checks.
const appZ = express(); const appZ = express();
appZ.get('/healthz', ((req, res) => { appZ.get('/healthz', (req, res) => {
res.end(); res.end();
})); });
appZ.get('/_/healthz', ((req, res) => { appZ.get('/_/healthz', (req, res) => {
res.end(); res.end();
})); });
const app = express(); const app = express();
app.use(function(req, res, next) { app.use(function (req, res, next) {
// Including byc-internal-req: 1 should return the Z page // Including byc-internal-req: 1 should return the Z page
if (req.header('byc-internal-req') === 'yes') { if (req.header('byc-internal-req') === 'yes') {
appZ(req, res, next); appZ(req, res, next);
@ -71,9 +71,9 @@ export default async function(opts) {
}); });
const prod = process.env.NODE_ENV === 'production'; const prod = process.env.NODE_ENV === 'production';
const port = prod ? (process.env.PORT || 8086) : opts.port; const port = prod ? process.env.PORT || 8086 : opts.port;
opts.secret = process.env.BYC_SECRET; opts.secret = process.env.RESF_SECRET;
// If we're in prod, then a secret has to be present // If we're in prod, then a secret has to be present
if (prod && (!opts.secret || opts.secret.length < 32)) { if (prod && (!opts.secret || opts.secret.length < 32)) {
@ -86,9 +86,11 @@ export default async function(opts) {
console.log(`Using clientID: ${opts.clientID}`); console.log(`Using clientID: ${opts.clientID}`);
console.log(`Using baseURL: ${opts.baseURL}`); console.log(`Using baseURL: ${opts.baseURL}`);
if ((opts.issuerBaseURL.endsWith('.localhost') if (
|| opts.issuerBaseURL.endsWith('.localhost/')) (opts.issuerBaseURL.endsWith('.localhost') ||
&& process.env['BYC_ENV']) { opts.issuerBaseURL.endsWith('.localhost/')) &&
process.env['RESF_ENV']
) {
const kong = 'kong-proxy.kong.svc.cluster.local'; const kong = 'kong-proxy.kong.svc.cluster.local';
const urlObject = new URL(opts.issuerBaseURL); const urlObject = new URL(opts.issuerBaseURL);
console.warn(`Forcing ${urlObject.hostname} to resolve to ${kong}`); console.warn(`Forcing ${urlObject.hostname} to resolve to ${kong}`);
@ -128,18 +130,18 @@ export default async function(opts) {
idpLogout: true, idpLogout: true,
authorizationParams: { authorizationParams: {
response_type: 'code', response_type: 'code',
scope: 'openid profile email offline_access' scope: 'openid profile email offline_access',
}, },
session: { session: {
rolling: true, rolling: true,
rollingDuration: 86400, rollingDuration: 86400,
absoluteDuration: 86400 * 7 absoluteDuration: 86400 * 7,
}, },
routes: { routes: {
callback: '/oauth2/callback', callback: '/oauth2/callback',
logout: '/oauth2/logout', logout: '/oauth2/logout',
login: '/oauth2/login' login: '/oauth2/login',
} },
}; };
// If we have a authentication prefix, only force redirect on paths with that prefix // If we have a authentication prefix, only force redirect on paths with that prefix
@ -153,8 +155,8 @@ export default async function(opts) {
// Again, a bypass here doesn't accomplish anything. // Again, a bypass here doesn't accomplish anything.
let requireEmailSuffix = opts.authOptions?.requireEmailSuffix; let requireEmailSuffix = opts.authOptions?.requireEmailSuffix;
if (process.env['AUTH_OPTIONS_REQUIRE_EMAIL_SUFFIX']) { if (process.env['AUTH_OPTIONS_REQUIRE_EMAIL_SUFFIX']) {
requireEmailSuffix = process.env['AUTH_OPTIONS_REQUIRE_EMAIL_SUFFIX'].split( requireEmailSuffix =
','); process.env['AUTH_OPTIONS_REQUIRE_EMAIL_SUFFIX'].split(',');
} }
if (requireEmailSuffix) { if (requireEmailSuffix) {
middlewares.push((req, res, next) => { middlewares.push((req, res, next) => {
@ -174,21 +176,26 @@ export default async function(opts) {
if (isAllowed) { if (isAllowed) {
next(); next();
} else { } else {
res.redirect(process.env['AUTH_REJECT_REDIRECT_URL'] res.redirect(
? process.env['AUTH_REJECT_REDIRECT_URL'] process.env['AUTH_REJECT_REDIRECT_URL']
: (opts.authOptions.authRejectRedirectUrl ? process.env['AUTH_REJECT_REDIRECT_URL']
|| 'https://rockylinux.org')); : opts.authOptions.authRejectRedirectUrl ||
'https://rockylinux.org'
);
} }
}); });
} }
app.use((req, res, next) => { app.use(
try { (req, res, next) => {
auth(config)(req, res, next); try {
} catch (err) { auth(config)(req, res, next);
next(err); } catch (err) {
} next(err);
}, [middlewares]); }
},
[middlewares]
);
} }
// Currently in dev, webpack is handling all file serving // Currently in dev, webpack is handling all file serving
@ -196,9 +203,11 @@ export default async function(opts) {
let distDir = process.cwd() + '/dist'; let distDir = process.cwd() + '/dist';
if (prod) { if (prod) {
// Enable security hardening in prod // Enable security hardening in prod
app.use(helmet({ app.use(
contentSecurityPolicy: false helmet({
})); contentSecurityPolicy: false,
})
);
// Prod expects a certain container structure for all apps // Prod expects a certain container structure for all apps
// Packaging this application with the web base should do // Packaging this application with the web base should do
@ -215,7 +224,7 @@ export default async function(opts) {
app.use(express.static(distDir)); app.use(express.static(distDir));
if (opts.apis) { if (opts.apis) {
Object.keys(opts.apis).forEach(x => { Object.keys(opts.apis).forEach((x) => {
app.use(x, async (req, res, next) => { app.use(x, async (req, res, next) => {
let authorization = ''; let authorization = '';
@ -244,23 +253,25 @@ export default async function(opts) {
// Make it possible to override api url using an env variable. // Make it possible to override api url using an env variable.
// Example: /api can be set with URL_API // Example: /api can be set with URL_API
// Example 2: /manage/api can be set with URL_MANAGE_API // Example 2: /manage/api can be set with URL_MANAGE_API
const prodEnvName = `URL_${x.substr(1).replace('/', const prodEnvName = `URL_${x
'_').toUpperCase()}`; .substr(1)
.replace('/', '_')
.toUpperCase()}`;
const apiUrl = process.env[prodEnvName] const apiUrl = process.env[prodEnvName]
? process.env[prodEnvName] ? process.env[prodEnvName]
: prod : prod
? opts.apis[x].prodApiUrl ? opts.apis[x].prodApiUrl
: opts.apis[x].devApiUrl; : opts.apis[x].devApiUrl;
createProxyMiddleware({ createProxyMiddleware({
target: apiUrl, target: apiUrl,
changeOrigin: true, changeOrigin: true,
headers: { headers: {
host: apiUrl, host: apiUrl,
authorization authorization,
}, },
pathRewrite: rewrite pathRewrite: rewrite,
})(req, res); })(req, res);
}); });
}); });
@ -292,7 +303,7 @@ export default async function(opts) {
return { return {
email, email,
name, name,
picture picture,
}; };
}; };
@ -314,7 +325,7 @@ export default async function(opts) {
webpackMildCompile(compiler); webpackMildCompile(compiler);
const wdm = webpackDevMiddleware(compiler, { const wdm = webpackDevMiddleware(compiler, {
publicPath: opts.webpackConfig.output.publicPath publicPath: opts.webpackConfig.output.publicPath,
}); });
app.use(history()); app.use(history());
@ -322,14 +333,15 @@ export default async function(opts) {
// Here we cache the old send function to re-use after we run the HTML through handlebars // Here we cache the old send function to re-use after we run the HTML through handlebars
const oldSend = res.send; const oldSend = res.send;
res.send = data => { res.send = (data) => {
let newData; let newData;
// Check if the request returned a HTML page // Check if the request returned a HTML page
// For SPAs, the only HTML page is the index page // For SPAs, the only HTML page is the index page
if (res.get('content-type').indexOf('text/html') !== -1) { if (res.get('content-type').indexOf('text/html') !== -1) {
// Run through handlebars compiler with our template parameters // Run through handlebars compiler with our template parameters
newData = hbs.handlebars.compile(data.toString())( newData = hbs.handlebars.compile(data.toString())(
templateParams(req)); templateParams(req)
);
} else { } else {
// No new data, just return old data // No new data, just return old data
newData = data; newData = data;

View File

@ -42,7 +42,7 @@ export function envOverridable(svcName, protocol, x) {
} }
export function svcName(svc, protocol) { export function svcName(svc, protocol) {
let env = process.env['BYC_ENV']; let env = process.env['RESF_ENV'];
if (!env) { if (!env) {
env = 'dev'; env = 'dev';
} }
@ -54,7 +54,7 @@ export function svcNameHttp(svc) {
} }
export function endpoint(generatedServiceName, ns, port) { export function endpoint(generatedServiceName, ns, port) {
const forceNs = process.env['BYC_FORCE_NS']; const forceNs = process.env['RESF_FORCE_NS'];
if (forceNs) { if (forceNs) {
ns = forceNs; ns = forceNs;
} }
@ -67,9 +67,9 @@ export function endpointHttp(generatedServiceName, ns, port = '') {
} }
export function NS(ns) { export function NS(ns) {
const env = process.env['BYC_ENV']; const env = process.env['RESF_ENV'];
if (!env || env === 'dev') { if (!env || env === 'dev') {
const bycNs = process.env['BYC_NS']; const bycNs = process.env['RESF_NS'];
if (!bycNs) { if (!bycNs) {
return `${os.userInfo().username}-dev`; return `${os.userInfo().username}-dev`;
} }

View File

@ -1,9 +1,9 @@
load("//rules_byc:defs.bzl", "BYCDEPLOY_OUTS_MIGRATE", "peridot_k8s") load("//rules_resf:defs.bzl", "RESFDEPLOY_OUTS_MIGRATE", "peridot_k8s")
peridot_k8s( peridot_k8s(
name = "admin", name = "admin",
src = "deploy.jsonnet", src = "deploy.jsonnet",
outs = BYCDEPLOY_OUTS_MIGRATE, outs = RESFDEPLOY_OUTS_MIGRATE,
force_normal_tags = True, force_normal_tags = True,
deps = [ deps = [
"//ci", "//ci",

View File

@ -1,9 +1,9 @@
local bycdeploy = import 'ci/bycdeploy.jsonnet'; local RESFDEPLOY = import 'ci/RESFDEPLOY.jsonnet';
local db = import 'ci/db.jsonnet'; local db = import 'ci/db.jsonnet';
local kubernetes = import 'ci/kubernetes.jsonnet'; local kubernetes = import 'ci/kubernetes.jsonnet';
local common = import 'hydra/deploy/common.jsonnet'; local common = import 'hydra/deploy/common.jsonnet';
bycdeploy.new({ RESFDEPLOY.new({
name: 'hydra-admin', name: 'hydra-admin',
replicas: 1, replicas: 1,
dbname: 'hydra', dbname: 'hydra',

View File

@ -1,9 +1,9 @@
load("//rules_byc:defs.bzl", "BYCDEPLOY_OUTS_MIGRATE", "peridot_k8s") load("//rules_resf:defs.bzl", "RESFDEPLOY_OUTS_MIGRATE", "peridot_k8s")
peridot_k8s( peridot_k8s(
name = "public", name = "public",
src = "deploy.jsonnet", src = "deploy.jsonnet",
outs = BYCDEPLOY_OUTS_MIGRATE, outs = RESFDEPLOY_OUTS_MIGRATE,
force_normal_tags = True, force_normal_tags = True,
deps = [ deps = [
"//ci", "//ci",

View File

@ -1,9 +1,9 @@
local bycdeploy = import 'ci/bycdeploy.jsonnet'; local RESFDEPLOY = import 'ci/RESFDEPLOY.jsonnet';
local db = import 'ci/db.jsonnet'; local db = import 'ci/db.jsonnet';
local kubernetes = import 'ci/kubernetes.jsonnet'; local kubernetes = import 'ci/kubernetes.jsonnet';
local common = import 'hydra/deploy/common.jsonnet'; local common = import 'hydra/deploy/common.jsonnet';
bycdeploy.new({ RESFDEPLOY.new({
name: 'hydra-public', name: 'hydra-public',
replicas: 1, replicas: 1,
dbname: 'hydra', dbname: 'hydra',

View File

@ -35,9 +35,10 @@ import (
"fmt" "fmt"
"net/url" "net/url"
"os" "os"
"peridot.resf.org/servicecatalog"
"strings" "strings"
"peridot.resf.org/servicecatalog"
"github.com/ory/hydra-client-go/client" "github.com/ory/hydra-client-go/client"
"github.com/ory/hydra-client-go/client/admin" "github.com/ory/hydra-client-go/client/admin"
"github.com/ory/hydra-client-go/models" "github.com/ory/hydra-client-go/models"
@ -64,7 +65,7 @@ func redirectUri(req *AutoSignupRequest) []string {
} }
func secret() string { func secret() string {
env := os.Getenv("BYC_ENV") env := os.Getenv("RESF_ENV")
if env == "" { if env == "" {
return "dev-123-secret" return "dev-123-secret"
} }
@ -92,7 +93,7 @@ func AutoSignup(req *AutoSignupRequest) *AutoSignupResponse {
ctx := context.TODO() ctx := context.TODO()
ns := os.Getenv("BYC_NS") ns := os.Getenv("RESF_NS")
if ns == "" { if ns == "" {
ns = "dev" ns = "dev"
} }

View File

@ -37,7 +37,7 @@ import {
svcNameHttp, svcNameHttp,
endpointHttp, endpointHttp,
NS, NS,
envOverridable envOverridable,
} from '../../../common/frontend_server/upstream.mjs'; } from '../../../common/frontend_server/upstream.mjs';
import pkg from '@ory/hydra-client'; import pkg from '@ory/hydra-client';
import os from 'os'; import os from 'os';
@ -60,18 +60,18 @@ function hydraAdminUrl() {
const hydraAdmin = new AdminApi( const hydraAdmin = new AdminApi(
new Configuration({ new Configuration({
basePath: hydraAdminUrl() basePath: hydraAdminUrl(),
}) })
); );
export const hydraPublic = new PublicApi( export const hydraPublic = new PublicApi(
new Configuration({ new Configuration({
basePath: hydraPublicUrl() basePath: hydraPublicUrl(),
}) })
); );
function secret() { function secret() {
const env = process.env['BYC_ENV']; const env = process.env['RESF_ENV'];
if (!env || env === 'dev') { if (!env || env === 'dev') {
return 'dev-123-secret'; return 'dev-123-secret';
} }
@ -85,7 +85,7 @@ function secret() {
} }
export async function hydraAutoSignup(req) { export async function hydraAutoSignup(req) {
let ns = process.env['BYC_NS']; let ns = process.env['RESF_NS'];
if (!ns || ns === '') { if (!ns || ns === '') {
ns = 'dev'; ns = 'dev';
} }
@ -109,7 +109,7 @@ export async function hydraAutoSignup(req) {
const ret = { const ret = {
clientID: serviceName, clientID: serviceName,
secret: secret() secret: secret(),
}; };
try { try {

View File

@ -1,4 +1,4 @@
load("//rules_byc:defs.bzl", "k8s_apply") load("//rules_resf:defs.bzl", "k8s_apply")
k8s_apply( k8s_apply(
name = "certmanager", name = "certmanager",

View File

@ -1,4 +1,4 @@
load("//rules_byc:defs.bzl", "k8s_apply") load("//rules_resf:defs.bzl", "k8s_apply")
k8s_apply( k8s_apply(
name = "externaldns", name = "externaldns",

View File

@ -1,4 +1,4 @@
load("//rules_byc:defs.bzl", "k8s_apply") load("//rules_resf:defs.bzl", "k8s_apply")
k8s_apply( k8s_apply(
name = "istio-dev", name = "istio-dev",

View File

@ -1,4 +1,4 @@
load("//rules_byc:defs.bzl", "k8s_apply") load("//rules_resf:defs.bzl", "k8s_apply")
k8s_apply( k8s_apply(
name = "istio-prod", name = "istio-prod",

View File

@ -1,5 +1,5 @@
load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
load("//rules_byc:defs.bzl", "container") load("//rules_resf:defs.bzl", "container")
go_library( go_library(
name = "initdb_lib", name = "initdb_lib",

View File

@ -81,8 +81,8 @@ func mn(_ *cobra.Command, _ []string) {
log.Fatal("no target db") log.Fatal("no target db")
} }
env := os.Getenv("BYC_ENV") env := os.Getenv("RESF_ENV")
namespace := os.Getenv("BYC_NS") namespace := os.Getenv("RESF_NS")
roleName := fmt.Sprintf("%s-%s", namespace, targetDB) roleName := fmt.Sprintf("%s-%s", namespace, targetDB)
secretName := fmt.Sprintf("%s-database-password", targetDB) secretName := fmt.Sprintf("%s-database-password", targetDB)

View File

@ -1,4 +1,4 @@
load("//rules_byc:defs.bzl", "BYCDEPLOY_OUTS_MIGRATE", "container", "peridot_k8s") load("//rules_resf:defs.bzl", "RESFDEPLOY_OUTS_MIGRATE", "container", "peridot_k8s")
container( container(
base = "//bases/bazel/go", base = "//bases/bazel/go",
@ -14,6 +14,6 @@ container(
peridot_k8s( peridot_k8s(
name = "obsidian", name = "obsidian",
src = "deploy.jsonnet", src = "deploy.jsonnet",
outs = BYCDEPLOY_OUTS_MIGRATE, outs = RESFDEPLOY_OUTS_MIGRATE,
deps = ["//ci"], deps = ["//ci"],
) )

View File

@ -1,8 +1,8 @@
local bycdeploy = import 'ci/bycdeploy.jsonnet'; local RESFDEPLOY = import 'ci/RESFDEPLOY.jsonnet';
local db = import 'ci/db.jsonnet'; local db = import 'ci/db.jsonnet';
local kubernetes = import 'ci/kubernetes.jsonnet'; local kubernetes = import 'ci/kubernetes.jsonnet';
bycdeploy.new({ RESFDEPLOY.new({
name: 'obsidian', name: 'obsidian',
dbname: 'obsidian', dbname: 'obsidian',
backend: true, backend: true,

View File

@ -34,6 +34,8 @@ import (
"context" "context"
"database/sql" "database/sql"
"fmt" "fmt"
"os"
"github.com/coreos/go-oidc/v3/oidc" "github.com/coreos/go-oidc/v3/oidc"
"github.com/ory/hydra-client-go/client/admin" "github.com/ory/hydra-client-go/client/admin"
hydramodels "github.com/ory/hydra-client-go/models" hydramodels "github.com/ory/hydra-client-go/models"
@ -43,7 +45,6 @@ import (
"google.golang.org/grpc/codes" "google.golang.org/grpc/codes"
"google.golang.org/grpc/metadata" "google.golang.org/grpc/metadata"
"google.golang.org/grpc/status" "google.golang.org/grpc/status"
"os"
"peridot.resf.org/obsidian/db/models" "peridot.resf.org/obsidian/db/models"
obsidianpb "peridot.resf.org/obsidian/pb" obsidianpb "peridot.resf.org/obsidian/pb"
"peridot.resf.org/utils" "peridot.resf.org/utils"
@ -57,7 +58,7 @@ type NameClaim struct {
} }
func callbackForwarder(callbackURL string) string { func callbackForwarder(callbackURL string) string {
env := os.Getenv("BYC_ENV") env := os.Getenv("RESF_ENV")
// this section contained a callback forwarder, but cannot be published // this section contained a callback forwarder, but cannot be published
// todo(mustafa): evaluate other ways to make it easier for dev // todo(mustafa): evaluate other ways to make it easier for dev
if env == "dev" || env == "" { if env == "dev" || env == "" {

View File

@ -1,4 +1,4 @@
load("//rules_byc:defs.bzl", "migration_tar") load("//rules_resf:defs.bzl", "migration_tar")
package(default_visibility = ["//visibility:public"]) package(default_visibility = ["//visibility:public"])

View File

@ -1,4 +1,4 @@
load("//rules_byc:defs.bzl", "BYCDEPLOY_OUTS_BASE", "byc_frontend", "container", "peridot_k8s") load("//rules_resf:defs.bzl", "RESFDEPLOY_OUTS_BASE", "container", "peridot_k8s", "resf_frontend")
package(default_visibility = ["//visibility:public"]) package(default_visibility = ["//visibility:public"])
@ -10,14 +10,14 @@ server_entrypoint = "server/index.mjs"
server_srcs = glob(["server/**/*.mjs"]) server_srcs = glob(["server/**/*.mjs"])
byc_frontend( resf_frontend(
name = "obsidian", name = "obsidian",
srcs = glob([ srcs = glob([
"src/**/*.tsx", "src/**/*.tsx",
"src/**/*.ts", "src/**/*.ts",
]), ]),
entrypoint = "obsidian/ui/src/entrypoint.tsx", entrypoint = "obsidian/ui/src/entrypoint.tsx",
index_html = "//rules_byc/internal/byc_bundle:index_no_mobile.hbs", index_html = "//rules_resf/internal/resf_bundle:index_no_mobile.hbs",
server_deps = server_deps, server_deps = server_deps,
server_entrypoint = server_entrypoint, server_entrypoint = server_entrypoint,
server_srcs = server_srcs, server_srcs = server_srcs,
@ -30,6 +30,8 @@ byc_frontend(
"//tailwind:css", "//tailwind:css",
"@npm//@mui/icons-material", "@npm//@mui/icons-material",
"@npm//@mui/material", "@npm//@mui/material",
"@npm//@mui/styles",
"@npm//@mui/system",
"@npm//await-to-js", "@npm//await-to-js",
"@npm//react-router", "@npm//react-router",
"@npm//react-router-dom", "@npm//react-router-dom",
@ -51,6 +53,6 @@ container(
peridot_k8s( peridot_k8s(
name = "obsidian-frontend", name = "obsidian-frontend",
src = "deploy.jsonnet", src = "deploy.jsonnet",
outs = BYCDEPLOY_OUTS_BASE, outs = RESFDEPLOY_OUTS_BASE,
deps = ["//ci"], deps = ["//ci"],
) )

View File

@ -1,10 +1,10 @@
local bycdeploy = import 'ci/bycdeploy.jsonnet'; local RESFDEPLOY = import 'ci/RESFDEPLOY.jsonnet';
local kubernetes = import 'ci/kubernetes.jsonnet'; local kubernetes = import 'ci/kubernetes.jsonnet';
local frontend = import 'ci/frontend.jsonnet'; local frontend = import 'ci/frontend.jsonnet';
local tag = std.extVar('tag'); local tag = std.extVar('tag');
bycdeploy.new({ RESFDEPLOY.new({
name: 'obsidian-frontend', name: 'obsidian-frontend',
backend: false, backend: false,
migrate: false, migrate: false,
@ -22,4 +22,4 @@ bycdeploy.new({
health: { health: {
port: 8086, port: 8086,
}, },
}) })

View File

@ -33,12 +33,16 @@
// noinspection ES6PreferShortImport // noinspection ES6PreferShortImport
import server from '../../../common/frontend_server/index.mjs'; import server from '../../../common/frontend_server/index.mjs';
import { endpointHttp, NS, svcNameHttp } from '../../../common/frontend_server/upstream.mjs'; import {
endpointHttp,
NS,
svcNameHttp,
} from '../../../common/frontend_server/upstream.mjs';
export default async function run(webpackConfig) { export default async function run(webpackConfig) {
const devFrontendUrl = 'http://obsidian.pdot.localhost:16000'; const devFrontendUrl = 'http://obsidian.pdot.localhost:16000';
const envPublicUrl = process.env['OBSIDIAN_FRONTEND_HTTP_PUBLIC_URL']; const envPublicUrl = process.env['OBSIDIAN_FRONTEND_HTTP_PUBLIC_URL'];
const frontendUrl = process.env['BYC_NS'] ? envPublicUrl : devFrontendUrl; const frontendUrl = process.env['RESF_NS'] ? envPublicUrl : devFrontendUrl;
server({ server({
disableAuth: true, disableAuth: true,
@ -46,11 +50,11 @@ export default async function run(webpackConfig) {
apis: { apis: {
'/api': { '/api': {
prodApiUrl: endpointHttp(svcNameHttp('obsidian'), NS('obsidian')), prodApiUrl: endpointHttp(svcNameHttp('obsidian'), NS('obsidian')),
devApiUrl: `https://id-api-dev.internal.pdev.resf.localhost` devApiUrl: `https://id-api-dev.internal.pdev.resf.localhost`,
} },
}, },
port: 16000, port: 16000,
webpackConfig webpackConfig,
}).then(); }).then();
} }

View File

@ -36,6 +36,12 @@ import (
"database/sql" "database/sql"
"errors" "errors"
"fmt" "fmt"
"math/rand"
"os"
"runtime"
"strings"
"time"
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
"github.com/spf13/viper" "github.com/spf13/viper"
"go.temporal.io/api/enums/v1" "go.temporal.io/api/enums/v1"
@ -49,14 +55,9 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/kubernetes" "k8s.io/client-go/kubernetes"
"k8s.io/client-go/rest" "k8s.io/client-go/rest"
"math/rand"
"os"
"peridot.resf.org/peridot/db/models" "peridot.resf.org/peridot/db/models"
peridotpb "peridot.resf.org/peridot/pb" peridotpb "peridot.resf.org/peridot/pb"
"peridot.resf.org/utils" "peridot.resf.org/utils"
"runtime"
"strings"
"time"
) )
type ProvisionWorkerRequest struct { type ProvisionWorkerRequest struct {
@ -583,7 +584,7 @@ func (c *Controller) CreateK8sPodActivity(ctx context.Context, req *ProvisionWor
}, },
}, },
Spec: v1.PodSpec{ Spec: v1.PodSpec{
ServiceAccountName: os.Getenv("BYC_SERVICE_ACCOUNT"), ServiceAccountName: os.Getenv("RESF_SERVICE_ACCOUNT"),
ImagePullSecrets: imagePullSecrets, ImagePullSecrets: imagePullSecrets,
Containers: []v1.Container{ Containers: []v1.Container{
{ {
@ -592,16 +593,16 @@ func (c *Controller) CreateK8sPodActivity(ctx context.Context, req *ProvisionWor
Args: []string{command}, Args: []string{command},
Env: []v1.EnvVar{ Env: []v1.EnvVar{
{ {
Name: "BYC_ENV", Name: "RESF_ENV",
Value: os.Getenv("BYC_ENV"), Value: os.Getenv("RESF_ENV"),
}, },
{ {
Name: "BYC_NS", Name: "RESF_NS",
Value: os.Getenv("BYC_NS"), Value: os.Getenv("RESF_NS"),
}, },
{ {
Name: "BYC_FORCE_NS", Name: "RESF_FORCE_NS",
Value: os.Getenv("BYC_FORCE_NS"), Value: os.Getenv("RESF_FORCE_NS"),
}, },
{ {
Name: "LOCALSTACK_ENDPOINT", Name: "LOCALSTACK_ENDPOINT",

View File

@ -1,4 +1,4 @@
load("//rules_byc:defs.bzl", "BYCDEPLOY_OUTS_MIGRATE", "container", "peridot_k8s") load("//rules_resf:defs.bzl", "RESFDEPLOY_OUTS_MIGRATE", "container", "peridot_k8s")
container( container(
base = "//bases/build", base = "//bases/build",
@ -11,6 +11,6 @@ container(
peridot_k8s( peridot_k8s(
name = "keykeeper", name = "keykeeper",
src = "deploy.jsonnet", src = "deploy.jsonnet",
outs = BYCDEPLOY_OUTS_MIGRATE, outs = RESFDEPLOY_OUTS_MIGRATE,
deps = ["//ci"], deps = ["//ci"],
) )

View File

@ -1,10 +1,10 @@
local bycdeploy = import 'ci/bycdeploy.jsonnet'; local RESFDEPLOY = import 'ci/RESFDEPLOY.jsonnet';
local db = import 'ci/db.jsonnet'; local db = import 'ci/db.jsonnet';
local kubernetes = import 'ci/kubernetes.jsonnet'; local kubernetes = import 'ci/kubernetes.jsonnet';
local temporal = import 'ci/temporal.jsonnet'; local temporal = import 'ci/temporal.jsonnet';
local utils = import 'ci/utils.jsonnet'; local utils = import 'ci/utils.jsonnet';
bycdeploy.new({ RESFDEPLOY.new({
name: 'keykeeper', name: 'keykeeper',
replicas: if kubernetes.prod() then 3 else 1, replicas: if kubernetes.prod() then 3 else 1,
dbname: 'peridot', dbname: 'peridot',

View File

@ -1,4 +1,4 @@
load("//rules_byc:defs.bzl", "BYCDEPLOY_OUTS_CUSTOM", "container") load("//rules_resf:defs.bzl", "RESFDEPLOY_OUTS_CUSTOM", "container")
container( container(
architecture = "amd64", architecture = "amd64",

View File

@ -1,4 +1,4 @@
load("//rules_byc:defs.bzl", "BYCDEPLOY_OUTS_MIGRATE_CUSTOM", "container", "peridot_k8s") load("//rules_resf:defs.bzl", "RESFDEPLOY_OUTS_MIGRATE_CUSTOM", "container", "peridot_k8s")
container( container(
base = "//bases/bazel/go", base = "//bases/bazel/go",
@ -11,7 +11,7 @@ container(
peridot_k8s( peridot_k8s(
name = "peridotephemeral", name = "peridotephemeral",
src = "deploy.jsonnet", src = "deploy.jsonnet",
outs = BYCDEPLOY_OUTS_MIGRATE_CUSTOM, outs = RESFDEPLOY_OUTS_MIGRATE_CUSTOM,
dependent_push = select({ dependent_push = select({
"//platforms:x86_64": [ "//platforms:x86_64": [
"//peridot/cmd/v1/peridotbuilder/ci:peridotbuilder_amd64_container", "//peridot/cmd/v1/peridotbuilder/ci:peridotbuilder_amd64_container",

View File

@ -1,4 +1,4 @@
local bycdeploy = import 'ci/bycdeploy.jsonnet'; local RESFDEPLOY = import 'ci/RESFDEPLOY.jsonnet';
local db = import 'ci/db.jsonnet'; local db = import 'ci/db.jsonnet';
local kubernetes = import 'ci/kubernetes.jsonnet'; local kubernetes = import 'ci/kubernetes.jsonnet';
local temporal = import 'ci/temporal.jsonnet'; local temporal = import 'ci/temporal.jsonnet';
@ -14,7 +14,7 @@ local provisionWorkerRole(metadata) = kubernetes.define_role_v2(metadata, 'provi
} }
]); ]);
bycdeploy.new({ RESFDEPLOY.new({
name: 'peridotephemeral', name: 'peridotephemeral',
replicas: if kubernetes.prod() then if site == 'extarches' then 5 else 10 else 1, replicas: if kubernetes.prod() then if site == 'extarches' then 5 else 10 else 1,
dbname: 'peridot', dbname: 'peridot',

View File

@ -1,4 +1,4 @@
load("//rules_byc:defs.bzl", "BYCDEPLOY_OUTS_MIGRATE", "container", "peridot_k8s") load("//rules_resf:defs.bzl", "RESFDEPLOY_OUTS_MIGRATE", "container", "peridot_k8s")
container( container(
base = "//bases/bazel/go", base = "//bases/bazel/go",
@ -14,6 +14,6 @@ container(
peridot_k8s( peridot_k8s(
name = "peridotserver", name = "peridotserver",
src = "deploy.jsonnet", src = "deploy.jsonnet",
outs = BYCDEPLOY_OUTS_MIGRATE, outs = RESFDEPLOY_OUTS_MIGRATE,
deps = ["//ci"], deps = ["//ci"],
) )

View File

@ -1,10 +1,10 @@
local bycdeploy = import 'ci/bycdeploy.jsonnet'; local RESFDEPLOY = import 'ci/RESFDEPLOY.jsonnet';
local db = import 'ci/db.jsonnet'; local db = import 'ci/db.jsonnet';
local kubernetes = import 'ci/kubernetes.jsonnet'; local kubernetes = import 'ci/kubernetes.jsonnet';
local temporal = import 'ci/temporal.jsonnet'; local temporal = import 'ci/temporal.jsonnet';
local utils = import 'ci/utils.jsonnet'; local utils = import 'ci/utils.jsonnet';
bycdeploy.new({ RESFDEPLOY.new({
name: 'peridotserver', name: 'peridotserver',
replicas: if kubernetes.prod() then 5 else 1, replicas: if kubernetes.prod() then 5 else 1,
dbname: 'peridot', dbname: 'peridot',

View File

@ -1,4 +1,4 @@
load("//rules_byc:defs.bzl", "BYCDEPLOY_OUTS_MIGRATE", "container", "peridot_k8s") load("//rules_resf:defs.bzl", "RESFDEPLOY_OUTS_MIGRATE", "container", "peridot_k8s")
container( container(
base = "//bases/bazel/go", base = "//bases/bazel/go",
@ -11,6 +11,6 @@ container(
peridot_k8s( peridot_k8s(
name = "yumrepofs", name = "yumrepofs",
src = "deploy.jsonnet", src = "deploy.jsonnet",
outs = BYCDEPLOY_OUTS_MIGRATE, outs = RESFDEPLOY_OUTS_MIGRATE,
deps = ["//ci"], deps = ["//ci"],
) )

View File

@ -1,9 +1,9 @@
local bycdeploy = import 'ci/bycdeploy.jsonnet'; local RESFDEPLOY = import 'ci/RESFDEPLOY.jsonnet';
local db = import 'ci/db.jsonnet'; local db = import 'ci/db.jsonnet';
local kubernetes = import 'ci/kubernetes.jsonnet'; local kubernetes = import 'ci/kubernetes.jsonnet';
local utils = import 'ci/utils.jsonnet'; local utils = import 'ci/utils.jsonnet';
bycdeploy.new({ RESFDEPLOY.new({
name: 'yumrepofs', name: 'yumrepofs',
replicas: if kubernetes.prod() then 3 else 1, replicas: if kubernetes.prod() then 3 else 1,
dbname: 'peridot', dbname: 'peridot',

View File

@ -1,4 +1,4 @@
load("//rules_byc:defs.bzl", "BYCDEPLOY_OUTS_MIGRATE", "container", "peridot_k8s") load("//rules_resf:defs.bzl", "RESFDEPLOY_OUTS_MIGRATE", "container", "peridot_k8s")
container( container(
base = "//bases/bazel/go", base = "//bases/bazel/go",
@ -11,6 +11,6 @@ container(
peridot_k8s( peridot_k8s(
name = "yumrepofsupdater", name = "yumrepofsupdater",
src = "deploy.jsonnet", src = "deploy.jsonnet",
outs = BYCDEPLOY_OUTS_MIGRATE, outs = RESFDEPLOY_OUTS_MIGRATE,
deps = ["//ci"], deps = ["//ci"],
) )

View File

@ -1,10 +1,10 @@
local bycdeploy = import 'ci/bycdeploy.jsonnet'; local RESFDEPLOY = import 'ci/RESFDEPLOY.jsonnet';
local db = import 'ci/db.jsonnet'; local db = import 'ci/db.jsonnet';
local kubernetes = import 'ci/kubernetes.jsonnet'; local kubernetes = import 'ci/kubernetes.jsonnet';
local temporal = import 'ci/temporal.jsonnet'; local temporal = import 'ci/temporal.jsonnet';
local utils = import 'ci/utils.jsonnet'; local utils = import 'ci/utils.jsonnet';
bycdeploy.new({ RESFDEPLOY.new({
name: 'yumrepofsupdater', name: 'yumrepofsupdater',
replicas: if kubernetes.prod() then 4 else 1, replicas: if kubernetes.prod() then 4 else 1,
dbname: 'peridot', dbname: 'peridot',

View File

@ -1,4 +1,4 @@
load("//rules_byc:defs.bzl", "migration_tar") load("//rules_resf:defs.bzl", "migration_tar")
package(default_visibility = ["//visibility:public"]) package(default_visibility = ["//visibility:public"])

View File

@ -1,4 +1,4 @@
load("//rules_byc:defs.bzl", "BYCDEPLOY_OUTS_BASE", "byc_frontend", "container", "peridot_k8s") load("//rules_resf:defs.bzl", "RESFDEPLOY_OUTS_BASE", "container", "peridot_k8s", "resf_frontend")
package(default_visibility = ["//visibility:public"]) package(default_visibility = ["//visibility:public"])
@ -11,14 +11,14 @@ server_entrypoint = "server/index.mjs"
server_srcs = glob(["server/**/*.mjs"]) server_srcs = glob(["server/**/*.mjs"])
byc_frontend( resf_frontend(
name = "peridot", name = "peridot",
srcs = glob([ srcs = glob([
"src/**/*.tsx", "src/**/*.tsx",
"src/**/*.ts", "src/**/*.ts",
]), ]),
entrypoint = "peridot/ui/src/entrypoint.tsx", entrypoint = "peridot/ui/src/entrypoint.tsx",
index_html = "//rules_byc/internal/byc_bundle:index_no_mobile.hbs", index_html = "//rules_resf/internal/resf_bundle:index_no_mobile.hbs",
server_deps = server_deps, server_deps = server_deps,
server_entrypoint = server_entrypoint, server_entrypoint = server_entrypoint,
server_srcs = server_srcs, server_srcs = server_srcs,
@ -54,6 +54,6 @@ container(
peridot_k8s( peridot_k8s(
name = "peridot-frontend", name = "peridot-frontend",
src = "deploy.jsonnet", src = "deploy.jsonnet",
outs = BYCDEPLOY_OUTS_BASE, outs = RESFDEPLOY_OUTS_BASE,
deps = ["//ci"], deps = ["//ci"],
) )

View File

@ -1,10 +1,10 @@
local bycdeploy = import 'ci/bycdeploy.jsonnet'; local RESFDEPLOY = import 'ci/RESFDEPLOY.jsonnet';
local kubernetes = import 'ci/kubernetes.jsonnet'; local kubernetes = import 'ci/kubernetes.jsonnet';
local frontend = import 'ci/frontend.jsonnet'; local frontend = import 'ci/frontend.jsonnet';
local tag = std.extVar('tag'); local tag = std.extVar('tag');
bycdeploy.new({ RESFDEPLOY.new({
name: 'peridot-frontend', name: 'peridot-frontend',
backend: false, backend: false,
migrate: false, migrate: false,
@ -22,4 +22,4 @@ bycdeploy.new({
health: { health: {
port: 8086, port: 8086,
}, },
}) })

View File

@ -33,13 +33,20 @@
// noinspection ES6PreferShortImport // noinspection ES6PreferShortImport
import server from '../../../common/frontend_server/index.mjs'; import server from '../../../common/frontend_server/index.mjs';
import { svcNameHttp, endpointHttp, NS } from '../../../common/frontend_server/upstream.mjs'; import {
import { hydraAutoSignup, hydraPublic } from '../../../hydra/pkg/hydra/autosignup.mjs'; svcNameHttp,
endpointHttp,
NS,
} from '../../../common/frontend_server/upstream.mjs';
import {
hydraAutoSignup,
hydraPublic,
} from '../../../hydra/pkg/hydra/autosignup.mjs';
export default async function run(webpackConfig) { export default async function run(webpackConfig) {
const devFrontendUrl = 'http://peridot.pdot.localhost:15000'; const devFrontendUrl = 'http://peridot.pdot.localhost:15000';
const envPublicUrl = process.env['PERIDOT_FRONTEND_HTTP_PUBLIC_URL']; const envPublicUrl = process.env['PERIDOT_FRONTEND_HTTP_PUBLIC_URL'];
const frontendUrl = process.env['BYC_NS'] ? envPublicUrl : devFrontendUrl; const frontendUrl = process.env['RESF_NS'] ? envPublicUrl : devFrontendUrl;
const wellKnown = await hydraPublic.discoverOpenIDConfiguration(); const wellKnown = await hydraPublic.discoverOpenIDConfiguration();
const hdr = await hydraAutoSignup({ const hdr = await hydraAutoSignup({
@ -49,7 +56,7 @@ export default async function run(webpackConfig) {
frontend: true, frontend: true,
scopes: 'openid profile email offline_access', scopes: 'openid profile email offline_access',
redirectUri: `${frontendUrl}/oauth2/callback`, redirectUri: `${frontendUrl}/oauth2/callback`,
postLogoutRedirectUri: frontendUrl postLogoutRedirectUri: frontendUrl,
}); });
server({ server({
@ -59,13 +66,16 @@ export default async function run(webpackConfig) {
baseURL: frontendUrl, baseURL: frontendUrl,
apis: { apis: {
'/api': { '/api': {
prodApiUrl: endpointHttp(svcNameHttp('peridotserver'), NS('peridotserver')), prodApiUrl: endpointHttp(
devApiUrl: `https://peridot-api-dev.internal.pdev.resf.localhost` svcNameHttp('peridotserver'),
} NS('peridotserver')
),
devApiUrl: `https://peridot-api-dev.internal.pdev.resf.localhost`,
},
}, },
port: 15000, port: 15000,
disableAuthEnforce: true, disableAuthEnforce: true,
webpackConfig webpackConfig,
}).then(); }).then();
} }

View File

@ -1,5 +1,5 @@
load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
load("//rules_byc:defs.bzl", "container") load("//rules_resf:defs.bzl", "container")
go_library( go_library(
name = "publisher-legacy-errata_lib", name = "publisher-legacy-errata_lib",

View File

@ -1,3 +0,0 @@
package(default_visibility = ["//rules_byc/internal:__subpackages__"])
exports_files(["container.bzl"])

View File

@ -1,6 +0,0 @@
package(default_visibility = ["//rules_byc/internal:__subpackages__"])
exports_files([
"k8s.bzl",
"k8s.bash",
])

View File

@ -1,30 +1,30 @@
load("//rules_byc/internal/byc_bundle:byc_bundle.bzl", _byc_bundle = "byc_bundle", _byc_bundle_run = "byc_bundle_run") load("//rules_resf/internal/resf_bundle:resf_bundle.bzl", _resf_bundle = "resf_bundle", _resf_bundle_run = "resf_bundle_run")
load("//rules_byc/internal/k8s:k8s.bzl", _k8s_apply = "k8s_apply") load("//rules_resf/internal/k8s:k8s.bzl", _k8s_apply = "k8s_apply")
load("//rules_byc/internal/container:container.bzl", _container = "container", _migration_tar = "migration_tar") load("//rules_resf/internal/container:container.bzl", _container = "container", _migration_tar = "migration_tar")
load("@io_bazel_rules_jsonnet//jsonnet:jsonnet.bzl", "jsonnet_to_json") load("@io_bazel_rules_jsonnet//jsonnet:jsonnet.bzl", "jsonnet_to_json")
load("@build_bazel_rules_nodejs//:index.bzl", "nodejs_binary") load("@build_bazel_rules_nodejs//:index.bzl", "nodejs_binary")
load("@com_github_atlassian_bazel_tools//:multirun/def.bzl", "multirun") load("@com_github_atlassian_bazel_tools//:multirun/def.bzl", "multirun")
byc_bundle = _byc_bundle resf_bundle = _resf_bundle
k8s_apply = _k8s_apply k8s_apply = _k8s_apply
container = _container container = _container
migration_tar = _migration_tar migration_tar = _migration_tar
BYCDEPLOY_OUTS_BASE = [ RESFDEPLOY_OUTS_BASE = [
"001-ns-sa.yaml", "001-ns-sa.yaml",
"003-deployment.yaml", "003-deployment.yaml",
"004-svc-vs-dr.yaml", "004-svc-vs-dr.yaml",
] ]
BYCDEPLOY_OUTS_MIGRATE = BYCDEPLOY_OUTS_BASE + [ RESFDEPLOY_OUTS_MIGRATE = RESFDEPLOY_OUTS_BASE + [
"002-migrate.yaml", "002-migrate.yaml",
] ]
BYCDEPLOY_OUTS_CUSTOM = BYCDEPLOY_OUTS_BASE + [ RESFDEPLOY_OUTS_CUSTOM = RESFDEPLOY_OUTS_BASE + [
"005-custom.yaml", "005-custom.yaml",
] ]
BYCDEPLOY_OUTS_MIGRATE_CUSTOM = BYCDEPLOY_OUTS_BASE + [ RESFDEPLOY_OUTS_MIGRATE_CUSTOM = RESFDEPLOY_OUTS_BASE + [
"002-migrate.yaml", "002-migrate.yaml",
"005-custom.yaml", "005-custom.yaml",
] ]
@ -104,23 +104,23 @@ def peridot_k8s(name, src, tags = [], outs = [], static = False, prod_only = Fal
tags = ["manual"], tags = ["manual"],
) )
def byc_frontend(name, tags = [], **kwargs): def resf_frontend(name, tags = [], **kwargs):
_byc_bundle( _resf_bundle(
name = "{}.bundle".format(name), name = "{}.bundle".format(name),
build = True, build = True,
tags = tags + [ tags = tags + [
"manual", "manual",
"byc_frontend_bundle", "resf_frontend_bundle",
], ],
**kwargs **kwargs
) )
_byc_bundle_run( _resf_bundle_run(
name = "{}.server".format(name), name = "{}.server".format(name),
build = False, build = False,
tags = tags + [ tags = tags + [
"manual", "manual",
"byc_frontend_server", "resf_frontend_server",
"ibazel_notify_changes", "ibazel_notify_changes",
"ibazel_live_reload", "ibazel_live_reload",
], ],

View File

@ -0,0 +1,3 @@
package(default_visibility = ["//rules_resf/internal:__subpackages__"])
exports_files(["container.bzl"])

View File

@ -0,0 +1,6 @@
package(default_visibility = ["//rules_resf/internal:__subpackages__"])
exports_files([
"k8s.bzl",
"k8s.bash",
])

View File

@ -59,7 +59,7 @@ k8s_apply = rule(
default = Label("@bazel_tools//tools/bash/runfiles"), default = Label("@bazel_tools//tools/bash/runfiles"),
), ),
"_k8s_bash": attr.label( "_k8s_bash": attr.label(
default = Label("//rules_byc/internal/k8s:k8s.bash"), default = Label("//rules_resf/internal/k8s:k8s.bash"),
allow_single_file = True, allow_single_file = True,
), ),
}, },

View File

@ -1,7 +1,7 @@
package(default_visibility = ["//rules_byc/internal:__subpackages__"]) package(default_visibility = ["//rules_resf/internal:__subpackages__"])
load("@build_bazel_rules_nodejs//:index.bzl", "nodejs_binary") load("@build_bazel_rules_nodejs//:index.bzl", "nodejs_binary")
load(":byc_bundle.bzl", "WEBPACK_DATA") load(":resf_bundle.bzl", "WEBPACK_DATA")
exports_files([ exports_files([
"assembler.js", "assembler.js",
@ -15,7 +15,7 @@ exports_files([
"index.hbs", "index.hbs",
"index_no_mobile.hbs", "index_no_mobile.hbs",
"index_internal.hbs", "index_internal.hbs",
"byc_bundle.bzl", "resf_bundle.bzl",
"run_child.mjs", "run_child.mjs",
"packserver.bash", "packserver.bash",
]) ])

View File

@ -109,11 +109,6 @@ def get_inputs(ctx, config, dep_files_attr, dep_attr, index_html = None, extra =
if ctx.file.license_banner: if ctx.file.license_banner:
direct_inputs += [ctx.file.license_banner] direct_inputs += [ctx.file.license_banner]
if ctx.version_file:
direct_inputs += [ctx.version_file]
if ctx.info_file:
direct_inputs += [ctx.info_file]
return direct_inputs return direct_inputs
@ -209,8 +204,6 @@ def write_webpack_config(ctx, plugins = [], root_dir = None, filename = "_%s.web
"TMPL_module_mappings": str(mappings), "TMPL_module_mappings": str(mappings),
"TMPL_output_format": output_format, "TMPL_output_format": output_format,
"TMPL_indexHtml": index_html.short_path if index_html != None else "null", "TMPL_indexHtml": index_html.short_path if index_html != None else "null",
"TMPL_stamp_data": "\"%s\"" % ctx.version_file.path if ctx.version_file else "undefined",
"TMPL_stable_stamp_data": "\"%s\"" % ctx.info_file.path if ctx.info_file else "undefined",
"TMPL_target": str(ctx.label), "TMPL_target": str(ctx.label),
"TMPL_title": ctx.attr.title if ctx.attr.title else "Peridot", "TMPL_title": ctx.attr.title if ctx.attr.title else "Peridot",
"TMPL_body_script": ctx.attr.script, "TMPL_body_script": ctx.attr.script,
@ -272,7 +265,7 @@ def packserver(ctx, webpack_config, webpack_inputs):
executable = out_file, executable = out_file,
)] )]
def _byc_bundle(ctx): def _resf_bundle(ctx):
index_html = ctx.file.index_html index_html = ctx.file.index_html
config = write_webpack_config(ctx, index_html = index_html) config = write_webpack_config(ctx, index_html = index_html)
webpack_config = config["webpack"] webpack_config = config["webpack"]
@ -298,10 +291,10 @@ def _byc_bundle(ctx):
return packserver(ctx, webpack_config, direct_inputs) return packserver(ctx, webpack_config, direct_inputs)
WEBPACK_DATA = [ WEBPACK_DATA = [
"//rules_byc/internal/byc_bundle:babel.config.js", "//rules_resf/internal/resf_bundle:babel.config.js",
"//rules_byc/internal/byc_bundle:tailwind.config.js", "//rules_resf/internal/resf_bundle:tailwind.config.js",
"//rules_byc/internal/byc_bundle:index.hbs", "//rules_resf/internal/resf_bundle:index.hbs",
"//rules_byc/internal/byc_bundle:tsconfig.json", "//rules_resf/internal/resf_bundle:tsconfig.json",
"@npm//@babel/plugin-transform-modules-commonjs", "@npm//@babel/plugin-transform-modules-commonjs",
"@npm//@babel/preset-env", "@npm//@babel/preset-env",
"@npm//@babel/preset-react", "@npm//@babel/preset-react",
@ -338,7 +331,7 @@ WEBPACK_DATA = [
"@npm//core-js-pure", "@npm//core-js-pure",
] ]
BYC_BUNDLE_ATTRS = { resf_bundle_ATTRS = {
"title": attr.string(), "title": attr.string(),
"script": attr.string( "script": attr.string(
default = "", default = "",
@ -351,7 +344,7 @@ BYC_BUNDLE_ATTRS = {
default = "https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap", default = "https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap",
), ),
"index_html": attr.label( "index_html": attr.label(
default = Label("//rules_byc/internal/byc_bundle:index.hbs"), default = Label("//rules_resf/internal/resf_bundle:index.hbs"),
allow_single_file = True, allow_single_file = True,
), ),
"prefix": attr.string( "prefix": attr.string(
@ -390,11 +383,11 @@ BYC_BUNDLE_ATTRS = {
aspects = [module_mappings_aspect, node_modules_aspect], aspects = [module_mappings_aspect, node_modules_aspect],
), ),
"_webpack_config_tmpl": attr.label( "_webpack_config_tmpl": attr.label(
default = Label("//rules_byc/internal/byc_bundle:webpack.config.js"), default = Label("//rules_resf/internal/resf_bundle:webpack.config.js"),
allow_single_file = True, allow_single_file = True,
), ),
"_webpack": attr.label( "_webpack": attr.label(
default = Label("//rules_byc/internal/byc_bundle:webpack"), default = Label("//rules_resf/internal/resf_bundle:webpack"),
executable = True, executable = True,
cfg = "host", cfg = "host",
allow_files = True, allow_files = True,
@ -414,21 +407,21 @@ BYC_BUNDLE_ATTRS = {
allow_files = True, allow_files = True,
), ),
"_run_child": attr.label( "_run_child": attr.label(
default = Label("//rules_byc/internal/byc_bundle:run_child"), default = Label("//rules_resf/internal/resf_bundle:run_child"),
executable = True, executable = True,
cfg = "host", cfg = "host",
allow_files = True, allow_files = True,
), ),
"_run_child_script": attr.label( "_run_child_script": attr.label(
default = Label("//rules_byc/internal/byc_bundle:run_child.mjs"), default = Label("//rules_resf/internal/resf_bundle:run_child.mjs"),
allow_single_file = True, allow_single_file = True,
), ),
"_packserver": attr.label( "_packserver": attr.label(
default = Label("//rules_byc/internal/byc_bundle:packserver.bash"), default = Label("//rules_resf/internal/resf_bundle:packserver.bash"),
allow_single_file = True, allow_single_file = True,
), ),
"_tsconfig": attr.label( "_tsconfig": attr.label(
default = Label("//rules_byc/internal/byc_bundle:tsconfig.json"), default = Label("//rules_resf/internal/resf_bundle:tsconfig.json"),
allow_single_file = True, allow_single_file = True,
), ),
"entrypoint": attr.string( "entrypoint": attr.string(
@ -438,15 +431,15 @@ BYC_BUNDLE_ATTRS = {
mandatory = False, mandatory = False,
), ),
"_babel_config": attr.label( "_babel_config": attr.label(
default = Label("//rules_byc/internal/byc_bundle:babel.config.js"), default = Label("//rules_resf/internal/resf_bundle:babel.config.js"),
allow_single_file = True, allow_single_file = True,
), ),
"tailwind_config": attr.label( "tailwind_config": attr.label(
default = Label("//rules_byc/internal/byc_bundle:tailwind.config.js"), default = Label("//rules_resf/internal/resf_bundle:tailwind.config.js"),
allow_single_file = True, allow_single_file = True,
), ),
"_base_tailwind_config": attr.label( "_base_tailwind_config": attr.label(
default = Label("//rules_byc/internal/byc_bundle:tailwind.config.js"), default = Label("//rules_resf/internal/resf_bundle:tailwind.config.js"),
allow_single_file = True, allow_single_file = True,
), ),
"_bash_runfiles": attr.label( "_bash_runfiles": attr.label(
@ -457,13 +450,13 @@ BYC_BUNDLE_ATTRS = {
), ),
} }
byc_bundle = rule( resf_bundle = rule(
implementation = _byc_bundle, implementation = _resf_bundle,
attrs = BYC_BUNDLE_ATTRS, attrs = resf_bundle_ATTRS,
) )
byc_bundle_run = rule( resf_bundle_run = rule(
implementation = _byc_bundle, implementation = _resf_bundle,
attrs = BYC_BUNDLE_ATTRS, attrs = resf_bundle_ATTRS,
executable = True, executable = True,
) )

View File

@ -73,9 +73,9 @@ module.exports = {
mode: 'jit', mode: 'jit',
purge: [ purge: [
path.join(projectPath, '**/*.{jsx,tsx,vue}'), path.join(projectPath, '**/*.{jsx,tsx,vue}'),
path.join(projectPath, '../rules_byc/internal/byc_bundle/*.hbs'), path.join(projectPath, '../rules_resf/internal/resf_bundle/*.hbs'),
path.resolve(path.join('.', projectDir, '**/*.{jsx,tsx,vue}')), path.resolve(path.join('.', projectDir, '**/*.{jsx,tsx,vue}')),
path.resolve('./rules_byc/internal/byc_bundle/*.hbs'), path.resolve('./rules_resf/internal/resf_bundle/*.hbs'),
], ],
plugins: [require('@tailwindcss/forms')], plugins: [require('@tailwindcss/forms')],
theme: { theme: {

View File

@ -49,9 +49,6 @@ const resolve = path.resolve; // eslint-disable-line
// Env variables // Env variables
const dev = process.env.NODE_ENV !== 'production'; const dev = process.env.NODE_ENV !== 'production';
const bannerFile = TMPL_banner_file;
const stampData = TMPL_stamp_data;
const stableStampData = TMPL_stable_stamp_data;
const title = 'TMPL_title'; const title = 'TMPL_title';
const moduleMappings = TMPL_module_mappings; const moduleMappings = TMPL_module_mappings;
const rawName = 'TMPL_global_name'; const rawName = 'TMPL_global_name';
@ -64,7 +61,6 @@ const inputs = [TMPL_inputs];
const bodyScript = 'TMPL_body_script'; const bodyScript = 'TMPL_body_script';
const headStyle = 'TMPL_head_style'; const headStyle = 'TMPL_head_style';
const typekit = 'TMPL_typekit'; const typekit = 'TMPL_typekit';
const noSuffixFrontend = TMPL_no_suffix_frontend;
Object.keys(moduleMappings).forEach((k) => { Object.keys(moduleMappings).forEach((k) => {
moduleMappings[k] = resolve(process.cwd(), moduleMappings[k]); moduleMappings[k] = resolve(process.cwd(), moduleMappings[k]);
@ -80,32 +76,8 @@ const modules = [
resolve(process.cwd()), resolve(process.cwd()),
]; ];
const volatileStatus = {};
if (!dev && stampData) {
const versionTag = fs.readFileSync(stampData, { encoding: 'utf-8' });
const vsSplit = versionTag.split('\n');
for (const vss of vsSplit) {
const vskp = vss.split(' ');
volatileStatus[vskp[0]] = vskp[1];
}
}
const stableStatus = {};
if (!dev && stableStampData) {
const versionTag = fs.readFileSync(stableStampData, { encoding: 'utf-8' });
const vsSplit = versionTag.split('\n');
for (const vss of vsSplit) {
const vskp = vss.split(' ');
stableStatus[vskp[0]] = vskp[1];
}
}
const fileName = `${name}.bundle${dev ? '' : '.min'}`; const fileName = `${name}.bundle${dev ? '' : '.min'}`;
const stage = stableStatus['STABLE_STAGE'] || '-qa';
const stageNoDash = stage.replace(/^-/, '');
const ns = `${rawName}${noSuffixFrontend ? '' : '-frontend'}`;
const apiUrl = process.env.API_URL; const apiUrl = process.env.API_URL;
const apiKey = process.env.API_KEY; const apiKey = process.env.API_KEY;
@ -237,8 +209,6 @@ const webpackConfig = {
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV), 'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV),
'process.env.API_URL': JSON.stringify(apiUrl), 'process.env.API_URL': JSON.stringify(apiUrl),
'process.env.API_KEY': JSON.stringify(apiKey), 'process.env.API_KEY': JSON.stringify(apiKey),
'process.env.BYC_ENV': JSON.stringify(stageNoDash),
'process.env.STABLE_STAGE': JSON.stringify(stage),
}), }),
...devPlugins, ...devPlugins,
...prodPlugins, ...prodPlugins,
@ -254,7 +224,7 @@ const webpackConfig = {
options: { options: {
configFile: resolve( configFile: resolve(
process.cwd(), process.cwd(),
'rules_byc/internal/byc_bundle/babel.config.js' 'rules_resf/internal/resf_bundle/babel.config.js'
), ),
plugins: [dev && require.resolve('react-refresh/babel')].filter( plugins: [dev && require.resolve('react-refresh/babel')].filter(
Boolean Boolean

View File

@ -37,7 +37,7 @@ import (
) )
func SvcName(svc string, protocol string) string { func SvcName(svc string, protocol string) string {
env := os.Getenv("BYC_ENV") env := os.Getenv("RESF_ENV")
return fmt.Sprintf("%s-%s-%s-service", svc, protocol, env) return fmt.Sprintf("%s-%s-%s-service", svc, protocol, env)
} }
@ -50,7 +50,7 @@ func SvcNameGrpc(svc string) string {
} }
func Endpoint(svcName string, ns string, port string) string { func Endpoint(svcName string, ns string, port string) string {
if forceNs := os.Getenv("BYC_FORCE_NS"); forceNs != "" { if forceNs := os.Getenv("RESF_FORCE_NS"); forceNs != "" {
ns = forceNs ns = forceNs
} }
return fmt.Sprintf("%s.%s.svc.cluster.local%s", svcName, ns, port) return fmt.Sprintf("%s.%s.svc.cluster.local%s", svcName, ns, port)
@ -62,8 +62,8 @@ func EndpointHttp(svcName string, ns string) string {
} }
func NS(ns string) string { func NS(ns string) string {
if os.Getenv("BYC_ENV") == "dev" { if os.Getenv("RESF_ENV") == "dev" {
return os.Getenv("BYC_NS") return os.Getenv("RESF_NS")
} }
return ns return ns
} }

View File

@ -1,5 +1,5 @@
load("@io_bazel_rules_jsonnet//jsonnet:jsonnet.bzl", "jsonnet_library") load("@io_bazel_rules_jsonnet//jsonnet:jsonnet.bzl", "jsonnet_library")
load("//rules_byc:defs.bzl", "BYCDEPLOY_OUTS_MIGRATE", "peridot_k8s") load("//rules_resf:defs.bzl", "RESFDEPLOY_OUTS_MIGRATE", "peridot_k8s")
jsonnet_library( jsonnet_library(
name = "common", name = "common",
@ -11,7 +11,7 @@ jsonnet_library(
peridot_k8s( peridot_k8s(
name = "spicedb", name = "spicedb",
src = "deploy.jsonnet", src = "deploy.jsonnet",
outs = BYCDEPLOY_OUTS_MIGRATE, outs = RESFDEPLOY_OUTS_MIGRATE,
force_normal_tags = True, force_normal_tags = True,
deps = [ deps = [
":common", ":common",

View File

@ -1,8 +1,8 @@
local bycdeploy = import 'ci/bycdeploy.jsonnet'; local RESFDEPLOY = import 'ci/RESFDEPLOY.jsonnet';
local kubernetes = import 'ci/kubernetes.jsonnet'; local kubernetes = import 'ci/kubernetes.jsonnet';
local common = import 'spicedb/deploy/common.jsonnet'; local common = import 'spicedb/deploy/common.jsonnet';
bycdeploy.new({ RESFDEPLOY.new({
name: 'spicedb', name: 'spicedb',
replicas: 1, replicas: 1,
dbname: 'spicedb', dbname: 'spicedb',

View File

@ -33,6 +33,10 @@ package temporalutils
import ( import (
"context" "context"
"crypto/tls" "crypto/tls"
"os"
"strings"
"time"
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
"github.com/spf13/pflag" "github.com/spf13/pflag"
"github.com/spf13/viper" "github.com/spf13/viper"
@ -40,9 +44,6 @@ import (
"go.temporal.io/sdk/client" "go.temporal.io/sdk/client"
"google.golang.org/grpc" "google.golang.org/grpc"
"google.golang.org/grpc/credentials" "google.golang.org/grpc/credentials"
"os"
"strings"
"time"
) )
func AddFlags(pflags *pflag.FlagSet) { func AddFlags(pflags *pflag.FlagSet) {
@ -70,7 +71,7 @@ func NewClient(opts client.Options) (client.Client, error) {
opts.HostPort = temporalHostPort opts.HostPort = temporalHostPort
bycNs := os.Getenv("BYC_NS") bycNs := os.Getenv("RESF_NS")
temporalNamespace := os.Getenv("TEMPORAL_NAMESPACE") temporalNamespace := os.Getenv("TEMPORAL_NAMESPACE")
if temporalNamespace != "" { if temporalNamespace != "" {
bycNs = temporalNamespace bycNs = temporalNamespace

View File

@ -31,11 +31,12 @@
package utils package utils
import ( import (
"os"
"github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/credentials" "github.com/aws/aws-sdk-go/aws/credentials"
"github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/aws/session"
"github.com/spf13/viper" "github.com/spf13/viper"
"os"
) )
func NewAwsSession(cfg *aws.Config) (*session.Session, error) { func NewAwsSession(cfg *aws.Config) (*session.Session, error) {
@ -63,7 +64,7 @@ func NewAwsSession(cfg *aws.Config) (*session.Session, error) {
cfg.Region = aws.String(os.Getenv("AWS_REGION")) cfg.Region = aws.String(os.Getenv("AWS_REGION"))
} }
if os.Getenv("LOCALSTACK_ENDPOINT") != "" && os.Getenv("BYC_ENV") == "dev" { if os.Getenv("LOCALSTACK_ENDPOINT") != "" && os.Getenv("RESF_ENV") == "dev" {
cfg.Endpoint = aws.String(os.Getenv("LOCALSTACK_ENDPOINT")) cfg.Endpoint = aws.String(os.Getenv("LOCALSTACK_ENDPOINT"))
cfg.Credentials = credentials.NewStaticCredentials("test", "test", "") cfg.Credentials = credentials.NewStaticCredentials("test", "test", "")
} }

View File

@ -34,5 +34,5 @@ import "os"
// GetKubeNS only works when the apps run in Kubernetes // GetKubeNS only works when the apps run in Kubernetes
func GetKubeNS() string { func GetKubeNS() string {
return os.Getenv("BYC_NS") return os.Getenv("RESF_NS")
} }

View File

@ -35,11 +35,12 @@ import (
"math/rand" "math/rand"
"net/url" "net/url"
"os" "os"
"peridot.resf.org/servicecatalog"
"strconv" "strconv"
"strings" "strings"
"time" "time"
"peridot.resf.org/servicecatalog"
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
"github.com/spf13/pflag" "github.com/spf13/pflag"
"github.com/spf13/viper" "github.com/spf13/viper"
@ -93,10 +94,10 @@ func AddFlags(f *pflag.FlagSet, config *FlagConfig) {
issuer := "https://hdr.build.resf.org/" issuer := "https://hdr.build.resf.org/"
jwks := fmt.Sprintf("%s/.well-known/jwks.json", servicecatalog.HydraPublic()) jwks := fmt.Sprintf("%s/.well-known/jwks.json", servicecatalog.HydraPublic())
if os.Getenv("BYC_ENV") == "" || (os.Getenv("BYC_ENV") == "dev" && os.Getenv("LOCALSTACK_ENDPOINT") != "") { if os.Getenv("RESF_ENV") == "" || (os.Getenv("RESF_ENV") == "dev" && os.Getenv("LOCALSTACK_ENDPOINT") != "") {
issuer = "https://hdr-dev.internal.pdev.resf.localhost/" issuer = "https://hdr-dev.internal.pdev.resf.localhost/"
} else if os.Getenv("BYC_ENV") != "prod" { } else if os.Getenv("RESF_ENV") != "prod" {
issuer = fmt.Sprintf("https://hdr-%s.internal.build.resf.org/", os.Getenv("BYC_ENV")) issuer = fmt.Sprintf("https://hdr-%s.internal.build.resf.org/", os.Getenv("RESF_ENV"))
} }
f.String("oidc.issuer", issuer, "OpenID Connect Issuer for the authentication interceptor") f.String("oidc.issuer", issuer, "OpenID Connect Issuer for the authentication interceptor")