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 PIPELINES metadata table #109

Merged
merged 2 commits into from
Feb 14, 2025
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
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,17 @@ public class K8sMetadata extends AbstractSchema {
private final Map<String, Table> tableMap = new HashMap<>();
private final K8sDatabaseTable databaseTable;
private final K8sEngineTable engineTable;
private final K8sPipelineTable pipelineTable;
private final K8sViewTable viewTable;

public K8sMetadata(K8sContext context) {
this.engineTable = new K8sEngineTable(context);
this.databaseTable = new K8sDatabaseTable(context, engineTable);
this.pipelineTable = new K8sPipelineTable(context);
this.viewTable = new K8sViewTable(context);
tableMap.put("DATABASES", databaseTable);
tableMap.put("ENGINES", engineTable);
tableMap.put("PIPELINES", pipelineTable);
tableMap.put("VIEWS", viewTable);
}

Expand All @@ -36,6 +39,10 @@ public K8sViewTable viewTable() {
return viewTable;
}

public K8sPipelineTable pipelineTable() {
return pipelineTable;
}

@Override
public Map<String, Table> getTableMap() {
return tableMap;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package com.linkedin.hoptimator.k8s;

import org.apache.calcite.schema.Schema;

import com.linkedin.hoptimator.k8s.models.V1alpha1Pipeline;
import com.linkedin.hoptimator.k8s.models.V1alpha1PipelineList;
import com.linkedin.hoptimator.k8s.models.V1alpha1PipelineSpec;


public class K8sPipelineTable extends K8sTable<V1alpha1Pipeline, V1alpha1PipelineList, K8sPipelineTable.Row> {

// CHECKSTYLE:OFF
public static class Row {
public String NAME;
public String STATUS;

public Row(String name, String status) {
this.NAME = name;
this.STATUS = status;
}

@Override
public String toString() {
return String.join("\t", NAME, STATUS);
}
}
// CHECKSTYLE:ON

public K8sPipelineTable(K8sContext context) {
super(context, K8sApiEndpoints.PIPELINES, Row.class);
}

@Override
public Row toRow(V1alpha1Pipeline obj) {
return new Row(obj.getMetadata().getName(), obj.getStatus().getMessage());
}

@Override
public Schema.TableType getJdbcTableType() {
return Schema.TableType.SYSTEM_TABLE;
}
}