Skip to content
This repository has been archived by the owner on Sep 4, 2020. It is now read-only.

remove trailing group_version of trait names to align with definitions #516

Merged
merged 3 commits into from
Jan 18, 2020
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
6 changes: 3 additions & 3 deletions docs/concepts/application-configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ spec:
- name: section
value: "[fromVariable(SECTION_NUMBER)]"
<b style="color:blue;">traits</b>:
- name: ingress.core.oam.dev/v1alpha1
- name: ingress
properties:
hostname: example.com
path: /
Expand Down Expand Up @@ -154,7 +154,7 @@ components:
- name: port
value: '9999'
traits:
- name: ingress.core.oam.dev/v1alpha1
- name: ingress
properties:
hostname: example.com
path: /
Expand All @@ -173,7 +173,7 @@ For each of your components, you can optionally define one or more traits. A tra
# Example trait entry

traits:
- name: ingress.core.oam.dev/v1alpha1
- name: ingress
properties:
hostname: example.com
path: /
Expand Down
2 changes: 1 addition & 1 deletion docs/concepts/scopes.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ spec:
- name: port
value: "9999"
traits:
- name: ingress.core.oam.dev/v1alpha1
- name: ingress
properties:
hostname: example.com
path: /
Expand Down
10 changes: 5 additions & 5 deletions docs/concepts/traits.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ spec:
- name: poem
value: The Wasteland
<b style="color:blue;">traits:</b>
- <b style="color:blue;">name:</b> ingress.core.oam.dev/v1alpha1
- <b style="color:blue;">name:</b> ingress
properties:</b>
hostname: example.com
path: /
Expand Down Expand Up @@ -83,7 +83,7 @@ None. *The manual scaler trait has no external dependencies.*
```yaml
# Example manual scaler trait entry
traits:
- name: manual-scaler.core.oam.dev/v1alpha1
- name: manual-scaler
properties:
replicaCount: 3
```
Expand Down Expand Up @@ -118,7 +118,7 @@ $ helm install keda stable/keda

```yaml
# Example autoscaler trait entry
- name: auto-scaler.core.oam.dev/v1alpha1
- name: auto-scaler
properties:
maximum: 6
minimim: 2
Expand Down Expand Up @@ -188,7 +188,7 @@ spec:
- componentName: nginx-replicated-v1
instanceName: example-app
traits:
- name: ingress.core.oam.dev/v1alpha1
- name: ingress
properties:
hostname: example.com
path: /
Expand Down Expand Up @@ -277,7 +277,7 @@ spec:
- componentName: server-with-volume-v1
instanceName: example-server-with-volume
traits:
- name: volume-mounter.core.oam.dev/v1alpha1
- name: volume-mounter
properties:
volumename: myvol
storageClass: default
Expand Down
8 changes: 4 additions & 4 deletions docs/how-to/using_helm_kustomize_manage_oam.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ spec:
- name: port
value: "{{ .Values.port }}"
traits:
- name: ingress.core.oam.dev/v1alpha1
- name: ingress
properties:
hostname: example.com
path: /
servicePort: {{ .Values.port }}
- name: manual-scaler.core.oam.dev/v1alpha1
- name: manual-scaler
properties:
replicaCount: {{ .Values.replicaCount }}
```
Expand Down Expand Up @@ -88,12 +88,12 @@ spec:
- name: port
value: "{{ .Values.service.port }}"
traits:
- name: ingress.core.oam.dev/v1alpha1
- name: ingress
properties:
hostname: example.com
path: /
servicePort: {{ .Values.port }}
- name: manual-scaler.core.oam.dev/v1alpha1
- name: manual-scaler
properties:
replicaCount: {{ .Values.replicaCount }}
```
Expand Down
10 changes: 5 additions & 5 deletions docs/tutorials/deploy_and_update.md
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ spec:
- name: port
value: '9999'
traits:
- name: ingress.core.oam.dev/v1alpha1
- name: ingress
properties:
hostname: example.com
path: /
Expand Down Expand Up @@ -215,7 +215,7 @@ spec:
- name: port
value: "9999"
traits:
- name: ingress.core.oam.dev/v1alpha1
- name: ingress
properties:
hostname: example.com
path: /
Expand Down Expand Up @@ -277,7 +277,7 @@ spec:
- name: port
value: '9999'
traits:
- name: ingress.core.oam.dev/v1alpha1
- name: ingress
properties:
- hostname: example.com
+ hostname: oam.example.com
Expand Down Expand Up @@ -322,7 +322,7 @@ spec:
- name: port
value: "9999"
traits:
- name: ingress.core.oam.dev/v1alpha1
- name: ingress
properties:
hostname: oam.example.com
path: /
Expand Down Expand Up @@ -382,7 +382,7 @@ spec:
- name: port
value: '9999'
traits:
- name: ingress.core.oam.dev/v1alpha1
- name: ingress
properties:
hostname: oam.example.com
path: /
Expand Down
4 changes: 2 additions & 2 deletions docs/tutorials/deploy_openfaas_workload.md
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ spec:
- name: write_debug
value: "false"
traits:
- name: manual-scaler.core.oam.dev/v1alpha1
- name: manual-scaler
properties:
replicaCount: 2
```
Expand Down Expand Up @@ -255,7 +255,7 @@ spec:
- name: write_debug
value: "false"
traits:
- name: manual-scaler.core.oam.dev/v1alpha1
- name: manual-scaler
properties:
replicaCount: 3
```
Expand Down
2 changes: 1 addition & 1 deletion examples/autoscaler.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ spec:
- name: poem
value: The Wasteland
traits:
- name: auto-scaler.core.oam.dev/v1alpha1
- name: auto-scaler
properties:
maximum : 6
minimum : 2
Expand Down
4 changes: 2 additions & 2 deletions examples/charts/hello-rudr/templates/appconfig.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ spec:
- name: port
value: "{{ .Values.port }}"
traits:
- name: ingress.core.oam.dev/v1alpha1
- name: ingress
properties:
hostname: example.com
path: /
servicePort: {{ .Values.port }}
- name: manual-scaler.core.oam.dev/v1alpha1
- name: manual-scaler
properties:
replicaCount: {{ .Values.replicaCount }}
8 changes: 4 additions & 4 deletions examples/first-app-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ spec:
- name: port
value: "9999"
traits:
- name: ingress.core.oam.dev/v1alpha1
properties:
hostname: example.com
path: /
- name: ingress
properties:
hostname: example.com
path: /
servicePort: 9999
2 changes: 1 addition & 1 deletion examples/kustomize/hello-rudr/base/appconfig.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ spec:
- name: port
value: "9999"
traits:
- name: ingress.core.oam.dev/v1alpha1
- name: ingress
properties:
hostname: example.com
path: /
Expand Down
2 changes: 1 addition & 1 deletion examples/manual-scaler.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ spec:
- name: poem
value: The Wasteland
traits:
- name: manual-scaler.core.oam.dev/v1alpha1
- name: manual-scaler
properties:
replicaCount: 3
4 changes: 2 additions & 2 deletions examples/multi-component.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ spec:
- name: poem
value: The Wasteland
traits:
- name: ingress.core.oam.dev/v1alpha1
- name: ingress
parameterValues:
hostname: example.com
hostname: example.com
path: /
- componentName: alpine-task-v1
instanceName: example-multi-component-alpine
Expand Down
4 changes: 2 additions & 2 deletions examples/multi-server.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ spec:
- componentName: nginx-singleton-v1
instanceName: multi-singleton-1
traits:
- name: ingress.core.oam.dev/v1alpha1
- name: ingress
parameterValues:
hostname: example.com
hostname: example.com
path: /
- componentName: nginx-singleton-v1
instanceName: multi-singleton-2
2 changes: 1 addition & 1 deletion examples/openfaasapp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,6 @@ spec:
- name: write_debug
value: "false"
traits:
- name: manual-scaler.core.oam.dev/v1alpha1
- name: manual-scaler
properties:
replicaCount: 2
2 changes: 1 addition & 1 deletion examples/replicable-task.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ spec:
- name: message
value: Hello World
traits:
- name: manual-scaler.core.oam.dev/v1alpha1
- name: manual-scaler
properties:
replicaCount: 3
4 changes: 2 additions & 2 deletions examples/singleton-nginx-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ spec:
- componentName: alpine-singleton-worker-v1
instanceName: singleton-nginx-app
traits:
- name: ingress.core.oam.dev/v1alpha1
- name: ingress
parameterValues:
hostname: example.com
hostname: example.com
path: /
2 changes: 1 addition & 1 deletion examples/volumes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ spec:
- componentName: server-with-volume-v1
instanceName: example-server-with-volume
traits:
- name: volume-mounter.core.oam.dev/v1alpha1
- name: volume-mounter
properties:
volumeName: myvol
storageClass: default
Expand Down
4 changes: 2 additions & 2 deletions examples/voting/configuration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ spec:
- componentName: voting-frontend-v1
instanceName: voter-fe
traits:
- name: ingress.core.oam.dev/v1alpha1
- name: ingress
properties:
hostname: voting.example.com
path: /
- componentName: voting-admin-v1
instanceName: voter-admin
traits:
- name: ingress.core.oam.dev/v1alpha1
- name: ingress
properties:
hostname: admin.example.com
path: /
2 changes: 1 addition & 1 deletion examples/worker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ spec:
- name: poem
value: The Wasteland
traits:
- name: manual-scaler.core.oam.dev/v1alpha1
- name: manual-scaler
properties:
replicaCount: 2
2 changes: 1 addition & 1 deletion healthscope/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ spec:
- name: port
value: "9999"
traits:
- name: ingress.core.oam.dev/v1alpha1
- name: ingress
properties:
hostname: example.com
path: /
Expand Down
12 changes: 4 additions & 8 deletions src/schematic/traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,10 @@ mod manual_scaler_test;
#[cfg(test)]
mod ingress_test;

pub const INGRESS: &str = "ingress";
pub const AUTOSCALER: &str = "auto-scaler";
pub const MANUAL_SCALER: &str = "manual-scaler";
pub const VOLUME_MOUNTER: &str = "volume-mounter";
pub const INGRESS_V1ALPHA1: &str = "ingress.core.oam.dev/v1alpha1";
pub const AUTOSCALER_V1ALPHA1: &str = "auto-scaler.core.oam.dev/v1alpha1";
pub const MANUAL_SCALER_V1ALPHA1: &str = "manual-scaler.core.oam.dev/v1alpha1";
pub const VOLUME_MOUNTER_V1ALPHA1: &str = "volume-mounter.core.oam.dev/v1alpha1";
pub const INGRESS_V1ALPHA1: &str = "ingress";
Copy link
Contributor

Choose a reason for hiding this comment

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

INGRESS_V1ALPHA1 [](start = 10, length = 16)

You have to make change to trait_manager.rs - load_traits() method to remove the case statements "INGRESS", "AUTOSCALER" and others. Additionally the trait object has from_param() method that needs to be removed as well.

Copy link
Member Author

@hongchaodeng hongchaodeng Jan 17, 2020

Choose a reason for hiding this comment

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

Why do I need to change that? Could you explain more details?
The behavior with the change looks correct to me.

Copy link
Contributor

Choose a reason for hiding this comment

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

If you look at the switch stmt, "INGRESS_V1ALPHA1" is before "INGRESS" case that is why it is working. If you change the ordering it will break. With this change, we have two case options with same value and because of case statement ordering it works in your case.

Earlier params(key-value pair) was used as the way to get input and recent change uses fixed schema (via properties). Since we are moving to fixed schema old remnants that is using params should be removed.


In reply to: 367710920 [](ancestors = 367710920)

Copy link
Member Author

Choose a reason for hiding this comment

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

Hi @iyyappam

Thanks for your explanations. I got your meanings.

Moreover, would you mind tell me your Slack ID? That would be easier for me to ask you additional questions and discuss issues :)

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for making the change. Also trait objects such as ingress, autoscaler has from_param() method which are not needed anymore. You can remove that too.


In reply to: 367726505 [](ancestors = 367726505)

Copy link
Contributor

Choose a reason for hiding this comment

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

For faster response please mail me at iyyappam at microsoft dot com.


In reply to: 367729724 [](ancestors = 367729724,367726505)

Copy link
Member Author

Choose a reason for hiding this comment

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

has from_param() method which are not needed anymore.

done.

Copy link
Contributor

Choose a reason for hiding this comment

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

INGRESS_V1ALPHA1 [](start = 10, length = 16)

The earlier plan was to hold making the change for backward compatibility till v0.2 is released. I'm not sure of that state now. @suhuruli might know about it.

Copy link
Member Author

Choose a reason for hiding this comment

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

Not sure what's plan here?

hongchaodeng marked this conversation as resolved.
Show resolved Hide resolved
pub const AUTOSCALER_V1ALPHA1: &str = "auto-scaler";
pub const MANUAL_SCALER_V1ALPHA1: &str = "manual-scaler";
pub const VOLUME_MOUNTER_V1ALPHA1: &str = "volume-mounter";
pub const EMPTY: &str = "empty";

/// Trait describes OAM traits.
Expand Down
26 changes: 0 additions & 26 deletions src/schematic/traits/autoscaler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,32 +21,6 @@ pub struct Autoscaler {
}

impl Autoscaler {
pub fn from_params(
name: String,
instance_name: String,
component_name: String,
params: ParamMap,
owner_ref: OwnerRefs,
) -> Self {
Autoscaler {
name,
component_name,
instance_name,
owner_ref,
minimum: params
.get("minimum")
.and_then(|p| p.as_i64().map(|i64| i64 as i32)),
maximum: params
.get("maximum")
.and_then(|p| p.as_i64().map(|i64| i64 as i32)),
cpu: params
.get("cpu")
.and_then(|p| p.as_i64().map(|i64| i64 as i32)),
memory: params
.get("memory")
.and_then(|p| p.as_i64().map(|i64| i64 as i32)),
}
}
pub fn from_properties(
name: String,
instance_name: String,
Expand Down
Loading