Skip to content

Commit

Permalink
Merge pull request #310 from cncf/new-homepage
Browse files Browse the repository at this point in the history
New homepage
  • Loading branch information
hh authored Apr 7, 2020
2 parents 858bf43 + eb7edba commit dc4290d
Show file tree
Hide file tree
Showing 74 changed files with 3,877 additions and 1,792 deletions.
7 changes: 3 additions & 4 deletions Tiltfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,9 @@ default_registry('registry:5000',
host_from_cluster='registry:5000')
k8s_yaml(kustomize('kustomize'))
docker_build('gcr.io/k8s-staging-apisnoop/webapp', 'apps/webapp/app',
live_update=[
fall_back_on(['package.json', 'package-lock.json']),
sync('apps/webapp/app','/src')
])
live_update=[
sync('apps/webapp/src','/webapp/src')
])
docker_build('gcr.io/k8s-staging-apisnoop/hasura', 'apps/hasura/app')
docker_build('gcr.io/k8s-staging-apisnoop/auditlogger', 'apps/auditlogger/app')
docker_build('gcr.io/k8s-staging-apisnoop/postgres', 'apps/postgres')
Expand Down
13 changes: 0 additions & 13 deletions apps/hasura/app/migrations/100_table_bucket_job_swagger.up.sql
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
-- Create Table
-- :PROPERTIES:
-- :header-args:sql-mode+: :tangle ./app/migrations/100_table_bucket_job_swagger.up.sql
-- :END:
-- #+NAME: bucket_job_swagger

-- [[file:~/apisnoop/apps/hasura/index.org::bucket_job_swagger][bucket_job_swagger]]
CREATE TABLE bucket_job_swagger (
ingested_at timestamp DEFAULT CURRENT_TIMESTAMP,
bucket text,
Expand All @@ -21,14 +14,8 @@ CREATE TABLE bucket_job_swagger (
swagger jsonb,
PRIMARY KEY (bucket, job)
);
-- bucket_job_swagger ends here

-- Index Table
-- #+NAME: general index the raw_swagger

-- [[file:~/apisnoop/apps/hasura/index.org::general%20index%20the%20raw_swagger][general index the raw_swagger]]
CREATE INDEX idx_swagger_jsonb_ops ON bucket_job_swagger
USING GIN (swagger jsonb_ops);
CREATE INDEX idx_swagger_jsonb_path_ops ON bucket_job_swagger
USING GIN (swagger jsonb_path_ops);
-- general index the raw_swagger ends here
8 changes: 0 additions & 8 deletions apps/hasura/app/migrations/101_function_load_swagger.up.sql
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
-- 101: Function to Load Swagger
-- :PROPERTIES:
-- :header-args:sql-mode+: :tangle ./app/migrations/101_function_load_swagger.up.sql
-- :END:
-- #+NAME: load_swagger.sql

-- [[file:~/apisnoop/apps/hasura/index.org::load_swagger.sql][load_swagger.sql]]
set role dba;
DROP FUNCTION IF EXISTS load_swagger;
CREATE OR REPLACE FUNCTION load_swagger(
Expand Down Expand Up @@ -74,4 +67,3 @@ except:
print("<p>Error: %s</p>" % e )
$$ LANGUAGE plpython3u ;
reset role;
-- load_swagger.sql ends here
12 changes: 0 additions & 12 deletions apps/hasura/app/migrations/110_table_audit_event.up.sql
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
-- Create
-- #+NAME: raw_audit_event

-- [[file:~/apisnoop/apps/hasura/index.org::raw_audit_event][raw_audit_event]]
CREATE UNLOGGED TABLE audit_event (
bucket text,
job text,
Expand Down Expand Up @@ -32,17 +28,9 @@ CREATE UNLOGGED TABLE audit_event (
-- id int GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,
-- ingested_at timestamp DEFAULT CURRENT_TIMESTAMP,
);
-- raw_audit_event ends here

-- TODO Index
-- I am not sure why our create index and alter table lines are commented out.
-- the TODO is to enquire on why these lines are commented
-- #+NAME: index the raw_audit_event

-- [[file:~/apisnoop/apps/hasura/index.org::index%20the%20raw_audit_event][index the raw_audit_event]]
CREATE INDEX idx_audit_event_bucket ON audit_event (bucket);
CREATE INDEX idx_audit_event_job ON audit_event (job);
CREATE INDEX idx_audit_event_operation_id ON audit_event(operation_id);
CREATE INDEX idx_audit_event_test_hit ON audit_event(test_hit);
CREATE INDEX idx_audit_event_conf_test_hit ON audit_event(conf_test_hit);
-- index the raw_audit_event ends here
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
-- 111: load_audit_event Function
-- :PROPERTIES:
-- :header-args:sql-mode+: :tangle ./app/migrations/111_function_load_audit_event.up.sql
-- :END:
-- #+NAME: load_audit_events.sql

-- [[file:~/apisnoop/apps/hasura/index.org::load_audit_events.sql][load_audit_events.sql]]
set role dba;
CREATE OR REPLACE FUNCTION load_audit_events(
custom_bucket text default null,
Expand All @@ -24,4 +17,3 @@ CREATE OR REPLACE FUNCTION load_audit_events(
return "something unknown went wrong"
$$ LANGUAGE plpython3u ;
reset role;
-- load_audit_events.sql ends here
8 changes: 0 additions & 8 deletions apps/hasura/app/migrations/112_function_add_opp_id.up.sql
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
-- 112: add_opp_id function
-- :PROPERTIES:
-- :header-args:sql-mode+: :tangle ./app/migrations/112_function_add_opp_id.up.sql
-- :END:
-- #+NAME: add_opp_id.sql

-- [[file:~/apisnoop/apps/hasura/index.org::add_opp_id.sql][add_opp_id.sql]]
set role dba;
CREATE OR REPLACE FUNCTION add_op_id() RETURNS TRIGGER as $$
import json
Expand All @@ -22,4 +15,3 @@ CREATE OR REPLACE FUNCTION add_op_id() RETURNS TRIGGER as $$
return "MODIFY";
$$ LANGUAGE plpython3u;
reset role;
-- add_opp_id.sql ends here
9 changes: 0 additions & 9 deletions apps/hasura/app/migrations/113_trigger_add_opp_id.up.sql
Original file line number Diff line number Diff line change
@@ -1,14 +1,5 @@
-- 113: add_opp_id trigger
-- :PROPERTIES:
-- :header-args:sql-mode+: :tangle ./app/migrations/113_trigger_add_opp_id.up.sql
-- :END:

-- #+NAME: Create Trigger

-- [[file:~/apisnoop/apps/hasura/index.org::Create%20Trigger][Create Trigger]]
CREATE TRIGGER add_op_id
BEFORE INSERT ON audit_event
FOR EACH ROW
WHEN (NEW.job = 'live')
EXECUTE PROCEDURE add_op_id();
-- Create Trigger ends here
12 changes: 0 additions & 12 deletions apps/hasura/app/migrations/200_view_api_operation_material.up.sql
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@


-- #+NAME: regex_from_path.sql

-- [[file:~/apisnoop/apps/hasura/index.org::regex_from_path.sql][regex_from_path.sql]]
set role dba;
CREATE OR REPLACE FUNCTION regex_from_path(path text)
RETURNS text AS $$
Expand All @@ -22,13 +17,7 @@ else:
return path_regex
$$ LANGUAGE plpython3u ;
reset role;
-- regex_from_path.sql ends here

-- Create

-- #+NAME: api_operation_material

-- [[file:~/apisnoop/apps/hasura/index.org::api_operation_material][api_operation_material]]
CREATE MATERIALIZED VIEW "public"."api_operation_material" AS
SELECT
(d.value ->> 'operationId'::text) AS operation_id,
Expand Down Expand Up @@ -77,4 +66,3 @@ CREATE MATERIALIZED VIEW "public"."api_operation_material" AS
, jsonb_array_elements((d.value -> 'schemes'::text)) schemestring(value)
GROUP BY bjs.bucket, bjs.job, paths.key, d.key, d.value, cat_tag.value
ORDER BY paths.key;
-- api_operation_material ends here
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
-- Index
-- #+NAME: index the api_operation_material

-- [[file:~/apisnoop/apps/hasura/index.org::index%20the%20api_operation_material][index the api_operation_material]]
CREATE INDEX api_operation_materialized_bucket ON api_operation_material (bucket);
CREATE INDEX api_operation_materialized_event_verb ON api_operation_material (event_verb);
CREATE INDEX api_operation_materialized_k8s_action ON api_operation_material (k8s_action);
Expand All @@ -18,4 +14,3 @@ CREATE INDEX api_operation_materialized_parameters_ops ON api_operation_materi
CREATE INDEX api_operation_materialized_parameters_path ON api_operation_material USING GIN (parameters jsonb_path_ops);
CREATE INDEX api_operation_materialized_responses_ops ON api_operation_material USING GIN (responses jsonb_ops);
CREATE INDEX api_operation_materialized_responses_path ON api_operation_material USING GIN (responses jsonb_path_ops);
-- index the api_operation_material ends here
8 changes: 0 additions & 8 deletions apps/hasura/app/migrations/210_view_api_operation.up.sql
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
-- 210: api_operation
-- :PROPERTIES:
-- :header-args:sql-mode+: :tangle ./app/migrations/210_view_api_operation.up.sql
-- :END:


-- [[file:~/apisnoop/apps/hasura/index.org::*210:%20api_operation][210: api_operation:1]]
CREATE OR REPLACE VIEW api_operation AS
SELECT
*
FROM
api_operation_material;
-- 210: api_operation:1 ends here
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
-- Create
-- Using our api_operation_material view, look into the parameters field in each one.
-- #+NAME: api_operation_parameter_material view

-- [[file:~/apisnoop/apps/hasura/index.org::api_operation_parameter_material%20view][api_operation_parameter_material view]]
CREATE MATERIALIZED VIEW "public"."api_operation_parameter_material" AS
SELECT ao.operation_id AS param_op,
(param.entry ->> 'name'::text) AS param_name,
Expand Down Expand Up @@ -32,11 +27,5 @@ CREATE MATERIALIZED VIEW "public"."api_operation_parameter_material" AS
FROM api_operation_material ao
, jsonb_array_elements(ao.parameters) WITH ORDINALITY param(entry, index)
WHERE ao.parameters IS NOT NULL;
-- api_operation_parameter_material view ends here

-- Index
-- #+NAME: index the api_operation_material

-- [[file:~/apisnoop/apps/hasura/index.org::index%20the%20api_operation_material][index the api_operation_material]]
CREATE INDEX api_parameters_materialized_schema ON api_operation_parameter_material (param_schema);
-- index the api_operation_material ends here
Original file line number Diff line number Diff line change
@@ -1,13 +1,3 @@
-- 500: Endpoint Coverage Material View
-- :PROPERTIES:
-- :header-args:sql-mode+: :tangle ./app/migrations/500_view_endpoint_coverage_material.up.sql
-- :END:

-- developed in [[file:explorations/ticket_50_endpoint_coverage.org][ticket 50: endpoint coverage]]

-- #+NAME: Endpoint Coverage View

-- [[file:~/apisnoop/apps/hasura/index.org::Endpoint%20Coverage%20View][Endpoint Coverage View]]
CREATE MATERIALIZED VIEW "public"."endpoint_coverage_material" AS
SELECT DISTINCT
bjs.job_timestamp::date as date,
Expand Down Expand Up @@ -36,11 +26,5 @@ CREATE MATERIALIZED VIEW "public"."endpoint_coverage_material" AS
) as coverage ON (coverage.bucket = ao.bucket AND coverage.job = ao.job)
WHERE ao.deprecated IS False
GROUP BY ao.operation_id, ao.bucket, ao.job, date, ao.level, ao.category, ao.k8s_group, ao.k8s_kind, ao.k8s_version;
-- Endpoint Coverage View ends here

-- Index
-- #+NAME: Add indexes

-- [[file:~/apisnoop/apps/hasura/index.org::Add%20indexes][Add indexes]]
CREATE INDEX idx_endpoint_coverage_material_job ON endpoint_coverage_material (job);
-- Add indexes ends here
8 changes: 0 additions & 8 deletions apps/hasura/app/migrations/510_view_endpoint_coverage.up.sql
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
-- 510: Endpoint Coverage View
-- :PROPERTIES:
-- :header-args:sql-mode+: :tangle ./app/migrations/510_view_endpoint_coverage.up.sql
-- :END:
-- #+NAME: endpoint_coverage_material

-- [[file:~/apisnoop/apps/hasura/index.org::endpoint_coverage_material][endpoint_coverage_material]]
CREATE OR REPLACE VIEW "public"."endpoint_coverage" AS
SELECT
*
FROM
endpoint_coverage_material;
-- endpoint_coverage_material ends here
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
-- 520: stable endpoint_stats_view
-- :PROPERTIES:
-- :header-args:sql-mode+: :tangle ./app/migrations/520_view_stable_endpoint_stats.up.sql
-- :END:
-- Based on the update we give to dan, developed in [[file:explorations/ticket_50_endpoint_coverage.org][ticket 50: endpoint coverage]]
-- #+NAME: Endpoint Stats View

-- [[file:~/apisnoop/apps/hasura/index.org::Endpoint%20Stats%20View][Endpoint Stats View]]
CREATE OR REPLACE VIEW "public"."stable_endpoint_stats" AS
WITH stats as (
SELECT
Expand All @@ -32,4 +24,3 @@ SELECT
FROM
stats
;
-- Endpoint Stats View ends here
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
-- 600: Untested Stable Core Endpoints
-- :PROPERTIES:
-- :header-args:sql-mode+: :tangle ./app/migrations/600_view_untested_stable_core_endpoints.up.sql
-- :END:

-- #+NAME: untested endpoints

-- [[file:~/apisnoop/apps/hasura/index.org::untested%20endpoints][untested endpoints]]
CREATE OR REPLACE VIEW "public"."untested_stable_core_endpoints" AS
SELECT
ec.*,
Expand All @@ -23,4 +15,3 @@ CREATE OR REPLACE VIEW "public"."untested_stable_core_endpoints" AS
AND ec.job != 'live'
ORDER BY hit desc
;
-- untested endpoints ends here
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
-- 610: Endpoints Hit by New Test
-- :PROPERTIES:
-- :header-args:sql-mode+: :tangle ./app/migrations/610_view_endpoints_hit_by_new_test.up.sql
-- :END:
-- #+NAME: endpoints hit by new test

-- [[file:~/apisnoop/apps/hasura/index.org::endpoints%20hit%20by%20new%20test][endpoints hit by new test]]
CREATE OR REPLACE VIEW "public"."endpoints_hit_by_new_test" AS
WITH live_testing_endpoints AS (
SELECT DISTINCT
Expand All @@ -29,4 +22,3 @@ CREATE OR REPLACE VIEW "public"."endpoints_hit_by_new_test" AS
lte.hits as hit_by_new_test
FROM live_testing_endpoints lte
JOIN baseline b ON (b.operation_id = lte.operation_id);
-- endpoints hit by new test ends here
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
-- 620:Projected Change in Coverage
-- :PROPERTIES:
-- :header-args:sql-mode+: :tangle ./app/migrations/620_view_projected_change_in_coverage.up.sql
-- :END:
-- #+NAME: PROJECTED Change in Coverage

-- [[file:~/apisnoop/apps/hasura/index.org::PROJECTED%20Change%20in%20Coverage][PROJECTED Change in Coverage]]
CREATE OR REPLACE VIEW "public"."projected_change_in_coverage" AS
WITH baseline AS (
SELECT *
Expand Down Expand Up @@ -41,12 +34,3 @@ CREATE OR REPLACE VIEW "public"."projected_change_in_coverage" AS
(coverage.new_coverage - coverage.old_coverage) AS change_in_number
FROM baseline, coverage
;
-- PROJECTED Change in Coverage ends here



-- #+RESULTS: PROJECTED Change in Coverage

-- [[file:~/apisnoop/apps/hasura/index.org::*620:Projected%20Change%20in%20Coverage][620:Projected Change in Coverage:2]]
CREATE VIEW
-- 620:Projected Change in Coverage:2 ends here
5 changes: 0 additions & 5 deletions apps/hasura/app/migrations/710_tests.up.sql
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
-- Create
-- #+NAME: tests view

-- [[file:~/apisnoop/apps/hasura/index.org::tests%20view][tests view]]
CREATE OR REPLACE VIEW "public"."tests" AS
WITH raw_tests AS (
SELECT audit_event.operation_id,
Expand All @@ -19,4 +15,3 @@ CREATE OR REPLACE VIEW "public"."tests" AS
array_agg(DISTINCT raw_tests.test_tag) AS test_tags
FROM raw_tests
GROUP BY raw_tests.test, raw_tests.bucket, raw_tests.job;
-- tests view ends here
5 changes: 0 additions & 5 deletions apps/hasura/app/migrations/720_useragents.up.sql
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
-- Create
-- #+NAME: tests view

-- [[file:~/apisnoop/apps/hasura/index.org::tests%20view][tests view]]
CREATE OR REPLACE VIEW "public"."useragents" AS
WITH raw_useragents AS (
SELECT audit_event.operation_id,
Expand All @@ -17,4 +13,3 @@ CREATE OR REPLACE VIEW "public"."useragents" AS
array_agg(DISTINCT raw_useragents.operation_id) AS operation_ids
FROM raw_useragents
GROUP BY raw_useragents.useragent, raw_useragents.bucket, raw_useragents.job;
-- tests view ends here
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
-- 910: Populate Swaggers Up
-- :PROPERTIES:
-- :header-args:sql-mode+: :tangle ./app/migrations/910_load_and_populate_swaggers.up.sql
-- :header-args:sql-mode+: :results silent
-- :END:

-- [[file:~/apisnoop/apps/hasura/index.org::*910:%20Populate%20Swaggers%20Up][910: Populate Swaggers Up:1]]
select * from load_swagger();
--populate the apisnoop/live bucket/job to help when writing test functions
select * from load_swagger(null, null, true);
-- 910: Populate Swaggers Up:1 ends here
7 changes: 0 additions & 7 deletions apps/hasura/app/migrations/920_populate_audit_events.up.sql
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
-- 920: Populate Audits Up
-- :PROPERTIES:
-- :header-args:sql-mode+: :tangle ./app/migrations/920_populate_audit_events.up.sql
-- :END:

-- [[file:~/apisnoop/apps/hasura/index.org::*920:%20Populate%20Audits%20Up][920: Populate Audits Up:1]]
select * from load_audit_events();
REFRESH MATERIALIZED VIEW api_operation_material;
REFRESH MATERIALIZED VIEW api_operation_parameter_material;
REFRESH MATERIALIZED VIEW endpoint_coverage_material;
-- 920: Populate Audits Up:1 ends here
Loading

0 comments on commit dc4290d

Please sign in to comment.