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 dependencyproxy model, crds, listers, informers #279

Merged
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
81 changes: 81 additions & 0 deletions admiral/crd/dependencyproxies.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: dependencyproxies.admiral.io
spec:
group: admiral.io
names:
kind: DependencyProxy
listKind: DependencyProxyList
plural: dependencyproxies
shortNames:
- dp
singular: dependencyproxy
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add a shortName for the CRD, something like dp?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, will do that

scope: Namespaced
versions:
- additionalPrinterColumns:
- jsonPath: .spec.destination.identity
name: Destination
type: string
- jsonPath: .spec.proxy.identity
name: Proxy
type: string
name: v1alpha1
schema:
openAPIV3Schema:
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
type: string
kind:
description: 'Kind is a string value representing the REST resource this
object represents. Servers may infer this from the endpoint the client
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
metadata:
type: object
spec:
description: 'The below example of DependencyProxy ```yaml apiVersion:
admiral.io/v1alpha1 kind: DependencyProxy metadata: name: dependency-proxy-example
namespace: admiral annotations: admiral.io/env: stage spec: destination:
identity: greeting dns_suffix: "xyz" dns_prefix: - "test0" - "test1"
proxy: identity: nginx-gw ``` The above DependencyProxy will generate
the following VirtualService object ```yaml apiVersion: networking.istio.io/v1alpha3
kind: VirtualService metadata: name: httpbin-vs spec: hosts: - test0.stage.greeting.xyz
- test1.stage.greeting.xyz - stage.greeting.xyz http: - route: - destination:
host: stage.gateway.global port: number: 80 ```'
properties:
destination:
description: Configuration of the destination identity for which the
requests should be proxied.
properties:
dns_prefixes:
description: An ordered list of all DNS prefixes.
items:
type: string
type: array
dns_suffix:
description: The DNS suffix that should be appended while constructing
the endpoint of the destination service.
type: string
identity:
description: Identifier of the destination workload.
type: string
type: object
proxy:
description: Configuration of the proxy's identity through which the
requests to the destination will be proxied through.
properties:
identity:
description: Identifier of the proxy's workload
type: string
type: object
type: object
required:
- metadata
- spec
type: object
served: true
storage: true
237 changes: 237 additions & 0 deletions admiral/pkg/apis/admiral/model/dependencyproxy.pb.go

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

72 changes: 72 additions & 0 deletions admiral/pkg/apis/admiral/model/dependencyproxy.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
syntax = "proto3";

package admiral.global.v1alpha;

option go_package = "model";

// The below example of DependencyProxy
//```yaml
// apiVersion: admiral.io/v1alpha1
// kind: DependencyProxy
// metadata:
// name: dependency-proxy-example
// namespace: admiral
// annotations:
// admiral.io/env: stage
// spec:
// destination:
// identity: greeting
// dns_suffix: "xyz"
// dns_prefix:
// - "test0"
// - "test1"
// proxy:
// identity: nginx-gw
//```
// The above DependencyProxy will generate the following
// VirtualService object
//```yaml
// apiVersion: networking.istio.io/v1alpha3
// kind: VirtualService
// metadata:
// name: httpbin-vs
// spec:
// hosts:
// - test0.stage.greeting.xyz
// - test1.stage.greeting.xyz
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am thinking if these should be test0.greeting.xyz and test1.greeting.xyz because if some one has e2e1 and e2e2, the endpoints will look like e2e1.e2e.greeting.xyz and e2e2.e2e.greeting.xyz. Also this will make the migration later (from gateway to mesh seamless when that happens)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hey @aattuluri , I'm sorry this example I think is a little confusing. stage here is the admiral.io/env on the deployment/rollout of the destination service(greeting). So I was thinking if we'll prepend the prefixes defined above to the generated endpoint of the service. `..

So we'll be generating the regular endpoint without the prefix as well as shown here


This should make the migration seamless. Please correct me if I'm wrong.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense.

// - stage.greeting.xyz
// http:
// - route:
// - destination:
// host: stage.gateway.global
// port:
// number: 80
//```
//
message DependencyProxy {
// Configuration of the destination identity for which the
// requests should be proxied.
Destination destination = 1;

// Configuration of the proxy's identity through which the requests
// to the destination will be proxied through.
Proxy proxy = 2;

}

message Destination {
// Identifier of the destination workload.
string identity = 1;

// An ordered list of all DNS prefixes.
repeated string dns_prefixes = 2;

// The DNS suffix that should be appended while
// constructing the endpoint of the destination service.
string dns_suffix = 3;
}

message Proxy {
// Identifier of the proxy's workload
string identity = 1;
}
Loading