Skip to content

Commit

Permalink
Update the ResourceRef message with namespace.
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Nelson <minelson@vmware.com>
  • Loading branch information
absoludity committed Nov 18, 2021
1 parent 1833ef9 commit cbfc108
Show file tree
Hide file tree
Showing 22 changed files with 1,629 additions and 2,313 deletions.
6 changes: 5 additions & 1 deletion cmd/kubeapps-apis/docs/kubeapps-apis.swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -3452,9 +3452,13 @@
"name": {
"type": "string",
"description": "The name of the specific resource in the context of the installed package."
},
"namespace": {
"type": "string",
"description": "The namespace of the specific resource in the context of the installed\npackage. In most cases this will be identical to the namespace of the\ninstalled package. Exceptions will be non-namespaced resources and packages\nthat install resources in other namespaces for special reasons."
}
},
"description": "A reference to a Kubernetes resource related to a specific installed package.\nThe context (cluster, namespace) for each resource is that of the related\ninstalled package.",
"description": "A reference to a Kubernetes resource related to a specific installed package.\nThe context (cluster) for each resource is that of the related\ninstalled package.",
"title": "Resource reference"
},
"v1alpha1RollbackInstalledPackageRequest": {
Expand Down
2 changes: 1 addition & 1 deletion cmd/kubeapps-apis/gen/apidocs.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

429 changes: 221 additions & 208 deletions cmd/kubeapps-apis/gen/core/packages/v1alpha1/packages.pb.go

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion cmd/kubeapps-apis/gen/core/plugins/v1alpha1/plugins.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,14 @@ apiVersion: v1
kind: Service
metadata:
name: apache-test
namespace: default
---
# Source: apache/templates/deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: apache-test
namespace: default
`,
},
},
Expand All @@ -74,11 +76,64 @@ metadata:
{
ApiVersion: "v1",
Name: "apache-test",
Namespace: "default",
Kind: "Service",
},
{
ApiVersion: "apps/v1",
Name: "apache-test",
Namespace: "default",
Kind: "Deployment",
},
},
},
},
{
name: "returns resource references for resources in other namespaces",
existingReleases: []releaseStub{
{
name: "my-apache",
namespace: "default",
manifest: `
---
apiVersion: v1
kind: ClusterRole
metadata:
name: test-cluster-role
---
# Source: apache/templates/deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: test-other-namespace
namespace: some-other-namespace
`,
},
},
request: &corev1.GetInstalledPackageResourceRefsRequest{
InstalledPackageRef: &corev1.InstalledPackageReference{
Context: &corev1.Context{
Cluster: "default",
Namespace: "default",
},
Identifier: "my-apache",
},
},
expectedResponse: &corev1.GetInstalledPackageResourceRefsResponse{
Context: &corev1.Context{
Cluster: "default",
Namespace: "default",
},
ResourceRefs: []*corev1.ResourceRef{
{
ApiVersion: "v1",
Name: "test-cluster-role",
Kind: "ClusterRole",
},
{
ApiVersion: "apps/v1",
Name: "test-other-namespace",
Namespace: "some-other-namespace",
Kind: "Deployment",
},
},
Expand Down
1 change: 1 addition & 0 deletions cmd/kubeapps-apis/plugins/helm/packages/v1alpha1/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -1244,6 +1244,7 @@ func resourceRefsFromManifest(m string) ([]*corev1.ResourceRef, error) {
ApiVersion: doc.APIVersion,
Kind: doc.Kind,
Name: doc.Metadata.Name,
Namespace: doc.Metadata.Namespace,
})
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -910,7 +910,7 @@ message PackageAppVersion {
// Resource reference
//
// A reference to a Kubernetes resource related to a specific installed package.
// The context (cluster, namespace) for each resource is that of the related
// The context (cluster) for each resource is that of the related
// installed package.
message ResourceRef {
// The APIVersion directly from the resource has the group and version, eg. "apps/v1"
Expand All @@ -921,4 +921,9 @@ message ResourceRef {
string kind = 2;
// The name of the specific resource in the context of the installed package.
string name = 3;
// The namespace of the specific resource in the context of the installed
// package. In most cases this will be identical to the namespace of the
// installed package. Exceptions will be non-namespaced resources and packages
// that install resources in other namespaces for special reasons.
string namespace = 4;
}
94 changes: 28 additions & 66 deletions dashboard/src/gen/google/api/http.ts
Original file line number Diff line number Diff line change
Expand Up @@ -397,14 +397,11 @@ export const Http = {
fromJSON(object: any): Http {
const message = { ...baseHttp } as Http;
message.rules = (object.rules ?? []).map((e: any) => HttpRule.fromJSON(e));
if (
message.fullyDecodeReservedExpansion =
object.fullyDecodeReservedExpansion !== undefined &&
object.fullyDecodeReservedExpansion !== null
) {
message.fullyDecodeReservedExpansion = Boolean(object.fullyDecodeReservedExpansion);
} else {
message.fullyDecodeReservedExpansion = false;
}
? Boolean(object.fullyDecodeReservedExpansion)
: false;
return message;
},

Expand Down Expand Up @@ -513,51 +510,25 @@ export const HttpRule = {

fromJSON(object: any): HttpRule {
const message = { ...baseHttpRule } as HttpRule;
if (object.selector !== undefined && object.selector !== null) {
message.selector = String(object.selector);
} else {
message.selector = "";
}
if (object.get !== undefined && object.get !== null) {
message.get = String(object.get);
} else {
message.get = undefined;
}
if (object.put !== undefined && object.put !== null) {
message.put = String(object.put);
} else {
message.put = undefined;
}
if (object.post !== undefined && object.post !== null) {
message.post = String(object.post);
} else {
message.post = undefined;
}
if (object.delete !== undefined && object.delete !== null) {
message.delete = String(object.delete);
} else {
message.delete = undefined;
}
if (object.patch !== undefined && object.patch !== null) {
message.patch = String(object.patch);
} else {
message.patch = undefined;
}
if (object.custom !== undefined && object.custom !== null) {
message.custom = CustomHttpPattern.fromJSON(object.custom);
} else {
message.custom = undefined;
}
if (object.body !== undefined && object.body !== null) {
message.body = String(object.body);
} else {
message.body = "";
}
if (object.responseBody !== undefined && object.responseBody !== null) {
message.responseBody = String(object.responseBody);
} else {
message.responseBody = "";
}
message.selector =
object.selector !== undefined && object.selector !== null ? String(object.selector) : "";
message.get = object.get !== undefined && object.get !== null ? String(object.get) : undefined;
message.put = object.put !== undefined && object.put !== null ? String(object.put) : undefined;
message.post =
object.post !== undefined && object.post !== null ? String(object.post) : undefined;
message.delete =
object.delete !== undefined && object.delete !== null ? String(object.delete) : undefined;
message.patch =
object.patch !== undefined && object.patch !== null ? String(object.patch) : undefined;
message.custom =
object.custom !== undefined && object.custom !== null
? CustomHttpPattern.fromJSON(object.custom)
: undefined;
message.body = object.body !== undefined && object.body !== null ? String(object.body) : "";
message.responseBody =
object.responseBody !== undefined && object.responseBody !== null
? String(object.responseBody)
: "";
message.additionalBindings = (object.additionalBindings ?? []).map((e: any) =>
HttpRule.fromJSON(e),
);
Expand Down Expand Up @@ -594,11 +565,10 @@ export const HttpRule = {
message.post = object.post ?? undefined;
message.delete = object.delete ?? undefined;
message.patch = object.patch ?? undefined;
if (object.custom !== undefined && object.custom !== null) {
message.custom = CustomHttpPattern.fromPartial(object.custom);
} else {
message.custom = undefined;
}
message.custom =
object.custom !== undefined && object.custom !== null
? CustomHttpPattern.fromPartial(object.custom)
: undefined;
message.body = object.body ?? "";
message.responseBody = object.responseBody ?? "";
message.additionalBindings = (object.additionalBindings ?? []).map(e =>
Expand Down Expand Up @@ -644,16 +614,8 @@ export const CustomHttpPattern = {

fromJSON(object: any): CustomHttpPattern {
const message = { ...baseCustomHttpPattern } as CustomHttpPattern;
if (object.kind !== undefined && object.kind !== null) {
message.kind = String(object.kind);
} else {
message.kind = "";
}
if (object.path !== undefined && object.path !== null) {
message.path = String(object.path);
} else {
message.path = "";
}
message.kind = object.kind !== undefined && object.kind !== null ? String(object.kind) : "";
message.path = object.path !== undefined && object.path !== null ? String(object.path) : "";
return message;
},

Expand Down
16 changes: 6 additions & 10 deletions dashboard/src/gen/google/protobuf/any.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,16 +160,12 @@ export const Any = {

fromJSON(object: any): Any {
const message = { ...baseAny } as Any;
if (object.typeUrl !== undefined && object.typeUrl !== null) {
message.typeUrl = String(object.typeUrl);
} else {
message.typeUrl = "";
}
if (object.value !== undefined && object.value !== null) {
message.value = bytesFromBase64(object.value);
} else {
message.value = new Uint8Array();
}
message.typeUrl =
object.typeUrl !== undefined && object.typeUrl !== null ? String(object.typeUrl) : "";
message.value =
object.value !== undefined && object.value !== null
? bytesFromBase64(object.value)
: new Uint8Array();
return message;
},

Expand Down
Loading

0 comments on commit cbfc108

Please sign in to comment.