Skip to content

Commit

Permalink
pull in latest change in application-api (#359)
Browse files Browse the repository at this point in the history
Signed-off-by: Stephanie <[email protected]>
  • Loading branch information
yangcao77 authored Jul 5, 2023
1 parent 72bbec8 commit f92b56b
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 48 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,6 @@ func (r *SnapshotEnvironmentBindingReconciler) Reconcile(ctx context.Context, re
genOptions := gitopsgenv1alpha1.GeneratorOptions{
Name: component.Name,
RouteName: routeName,
Replicas: component.Configuration.Replicas,
Resources: componentResources,
BaseEnvVar: envVars,
OverlayEnvVar: environmentConfigEnvVars,
Expand All @@ -335,6 +334,10 @@ func (r *SnapshotEnvironmentBindingReconciler) Reconcile(ctx context.Context, re
TargetPort: hasComponent.Spec.TargetPort, // pass the target port to the gitops gen library as they may generate a route/ingress based on the target port if the devfile does not have an ingress/route or an endpoint
}

if component.Configuration.Replicas != nil {
genOptions.Replicas = *component.Configuration.Replicas
}

if !reflect.DeepEqual(kubernetesResources, devfileParser.KubernetesResources{}) {
genOptions.KubernetesResources.Routes = append(genOptions.KubernetesResources.Routes, kubernetesResources.Routes...)
genOptions.KubernetesResources.Ingresses = append(genOptions.KubernetesResources.Ingresses, kubernetesResources.Ingresses...)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ var _ = Describe("SnapshotEnvironmentBinding controller", func() {
"deployment-patch.yaml": true,
}

replicas := int32(3)
replicas := 3

createAndFetchSimpleApp(applicationName, HASAppNamespace, DisplayName, Description)

Expand Down Expand Up @@ -139,7 +139,7 @@ var _ = Describe("SnapshotEnvironmentBinding controller", func() {
{
Name: componentName,
Configuration: appstudiov1alpha1.BindingComponentConfiguration{
Replicas: int(replicas),
Replicas: &replicas,
Env: []appstudiov1alpha1.EnvVarPair{
{
Name: "FOO",
Expand Down Expand Up @@ -220,7 +220,7 @@ var _ = Describe("SnapshotEnvironmentBinding controller", func() {
bindingName := HASBindingName + "2"
environmentName := "staging" + "2"

replicas := int32(3)
replicas := 3

createAndFetchSimpleApp(applicationName, HASAppNamespace, DisplayName, Description)

Expand Down Expand Up @@ -300,7 +300,7 @@ var _ = Describe("SnapshotEnvironmentBinding controller", func() {
{
Name: componentName,
Configuration: appstudiov1alpha1.BindingComponentConfiguration{
Replicas: int(replicas),
Replicas: &replicas,
Env: []appstudiov1alpha1.EnvVarPair{
{
Name: "FOO",
Expand All @@ -317,7 +317,7 @@ var _ = Describe("SnapshotEnvironmentBinding controller", func() {
{
Name: componentName2,
Configuration: appstudiov1alpha1.BindingComponentConfiguration{
Replicas: int(replicas),
Replicas: &replicas,
},
},
},
Expand Down Expand Up @@ -365,7 +365,7 @@ var _ = Describe("SnapshotEnvironmentBinding controller", func() {
bindingName := HASBindingName + "3"
environmentName := "staging" + "3"

replicas := int32(3)
replicas := 3

createAndFetchSimpleApp(applicationName, HASAppNamespace, DisplayName, Description)

Expand Down Expand Up @@ -415,7 +415,7 @@ var _ = Describe("SnapshotEnvironmentBinding controller", func() {
{
Name: componentName,
Configuration: appstudiov1alpha1.BindingComponentConfiguration{
Replicas: int(replicas),
Replicas: &replicas,
Env: []appstudiov1alpha1.EnvVarPair{
{
Name: "FOO",
Expand Down Expand Up @@ -472,7 +472,7 @@ var _ = Describe("SnapshotEnvironmentBinding controller", func() {
bindingName := HASBindingName + "4"
environmentName := "staging" + "4"

replicas := int32(3)
replicas := 3

createAndFetchSimpleApp(applicationName, HASAppNamespace, DisplayName, Description)

Expand Down Expand Up @@ -552,7 +552,7 @@ var _ = Describe("SnapshotEnvironmentBinding controller", func() {
{
Name: componentName,
Configuration: appstudiov1alpha1.BindingComponentConfiguration{
Replicas: int(replicas),
Replicas: &replicas,
Env: []appstudiov1alpha1.EnvVarPair{
{
Name: "FOO",
Expand Down Expand Up @@ -613,7 +613,7 @@ var _ = Describe("SnapshotEnvironmentBinding controller", func() {
bindingName := HASBindingName + "5"
environmentName := "staging" + "5"

replicas := int32(3)
replicas := 3

createAndFetchSimpleApp(applicationName, HASAppNamespace, DisplayName, Description)
createAndFetchSimpleApp(applicationName2, HASAppNamespace, DisplayName, Description)
Expand Down Expand Up @@ -698,7 +698,7 @@ var _ = Describe("SnapshotEnvironmentBinding controller", func() {
{
Name: componentName,
Configuration: appstudiov1alpha1.BindingComponentConfiguration{
Replicas: int(replicas),
Replicas: &replicas,
Env: []appstudiov1alpha1.EnvVarPair{
{
Name: "FOO",
Expand All @@ -715,7 +715,7 @@ var _ = Describe("SnapshotEnvironmentBinding controller", func() {
{
Name: componentName2,
Configuration: appstudiov1alpha1.BindingComponentConfiguration{
Replicas: int(replicas),
Replicas: &replicas,
},
},
},
Expand Down Expand Up @@ -768,7 +768,7 @@ var _ = Describe("SnapshotEnvironmentBinding controller", func() {
bindingName := HASBindingName + "6"
environmentName := "staging" + "6"

replicas := int32(3)
replicas := 3

createAndFetchSimpleApp(applicationName, HASAppNamespace, DisplayName, Description)

Expand Down Expand Up @@ -852,7 +852,7 @@ var _ = Describe("SnapshotEnvironmentBinding controller", func() {
{
Name: componentName,
Configuration: appstudiov1alpha1.BindingComponentConfiguration{
Replicas: int(replicas),
Replicas: &replicas,
Env: []appstudiov1alpha1.EnvVarPair{
{
Name: "FOO",
Expand All @@ -869,7 +869,7 @@ var _ = Describe("SnapshotEnvironmentBinding controller", func() {
{
Name: componentName2,
Configuration: appstudiov1alpha1.BindingComponentConfiguration{
Replicas: int(replicas),
Replicas: &replicas,
},
},
},
Expand Down Expand Up @@ -919,8 +919,8 @@ var _ = Describe("SnapshotEnvironmentBinding controller", func() {
bindingName := HASBindingName + "7"
environmentName := "staging" + "7"

replicas := int32(3)
newReplicas := int32(4)
replicas := 3
newReplicas := 4

createAndFetchSimpleApp(applicationName, HASAppNamespace, DisplayName, Description)

Expand Down Expand Up @@ -1003,7 +1003,7 @@ var _ = Describe("SnapshotEnvironmentBinding controller", func() {
{
Name: componentName,
Configuration: appstudiov1alpha1.BindingComponentConfiguration{
Replicas: int(replicas),
Replicas: &replicas,
Env: []appstudiov1alpha1.EnvVarPair{
{
Name: "FOO",
Expand Down Expand Up @@ -1037,7 +1037,7 @@ var _ = Describe("SnapshotEnvironmentBinding controller", func() {
Expect(bindingLabels["appstudio.application"]).Should(Equal(applicationName))
Expect(bindingLabels["appstudio.environment"]).Should(Equal(environmentName))

createdBinding.Spec.Components[0].Configuration.Replicas = int(newReplicas)
createdBinding.Spec.Components[0].Configuration.Replicas = &newReplicas

Expect(k8sClient.Update(ctx, createdBinding)).Should(Succeed())

Expand Down Expand Up @@ -1078,7 +1078,7 @@ var _ = Describe("SnapshotEnvironmentBinding controller", func() {
bindingName := HASBindingName + "8"
environmentName := "staging" + "8"

replicas := int32(3)
replicas := 3

hasApp := &appstudiov1alpha1.Application{
TypeMeta: metav1.TypeMeta{
Expand Down Expand Up @@ -1185,7 +1185,7 @@ var _ = Describe("SnapshotEnvironmentBinding controller", func() {
{
Name: componentName,
Configuration: appstudiov1alpha1.BindingComponentConfiguration{
Replicas: int(replicas),
Replicas: &replicas,
},
},
},
Expand Down Expand Up @@ -1232,7 +1232,7 @@ var _ = Describe("SnapshotEnvironmentBinding controller", func() {
bindingName := HASBindingName + "9"
environmentName := "staging" + "9"

replicas := int32(3)
replicas := 3

createAndFetchSimpleApp(applicationName, HASAppNamespace, DisplayName, Description)

Expand Down Expand Up @@ -1287,7 +1287,7 @@ var _ = Describe("SnapshotEnvironmentBinding controller", func() {
{
Name: componentName,
Configuration: appstudiov1alpha1.BindingComponentConfiguration{
Replicas: int(replicas),
Replicas: &replicas,
Env: []appstudiov1alpha1.EnvVarPair{
{
Name: "FOO",
Expand Down Expand Up @@ -1347,7 +1347,7 @@ var _ = Describe("SnapshotEnvironmentBinding controller", func() {
environmentName := "staging" + "10"
environmentName2 := "staging" + "10-2"

replicas := int32(3)
replicas := 3

createAndFetchSimpleApp(applicationName, HASAppNamespace, DisplayName, Description)
createAndFetchSimpleApp(applicationName2, HASAppNamespace, DisplayName, Description)
Expand Down Expand Up @@ -1491,7 +1491,7 @@ var _ = Describe("SnapshotEnvironmentBinding controller", func() {
{
Name: componentName,
Configuration: appstudiov1alpha1.BindingComponentConfiguration{
Replicas: int(replicas),
Replicas: &replicas,
},
},
},
Expand Down Expand Up @@ -1528,7 +1528,7 @@ var _ = Describe("SnapshotEnvironmentBinding controller", func() {
{
Name: componentName2,
Configuration: appstudiov1alpha1.BindingComponentConfiguration{
Replicas: int(replicas),
Replicas: &replicas,
},
},
},
Expand Down Expand Up @@ -1612,7 +1612,7 @@ var _ = Describe("SnapshotEnvironmentBinding controller", func() {
"deployment-patch.yaml": true,
}

replicas := int32(3)
replicas := 3

createAndFetchSimpleApp(applicationName, HASAppNamespace, DisplayName, Description)
hasComp := createAndFetchSimpleComponent(componentName, HASAppNamespace, ComponentName, applicationName, SampleRepoLink, true)
Expand Down Expand Up @@ -1697,7 +1697,7 @@ var _ = Describe("SnapshotEnvironmentBinding controller", func() {
{
Name: componentName,
Configuration: appstudiov1alpha1.BindingComponentConfiguration{
Replicas: int(replicas),
Replicas: &replicas,
Env: []appstudiov1alpha1.EnvVarPair{
{
Name: "FOO",
Expand All @@ -1714,7 +1714,7 @@ var _ = Describe("SnapshotEnvironmentBinding controller", func() {
{
Name: secondComponentName,
Configuration: appstudiov1alpha1.BindingComponentConfiguration{
Replicas: int(replicas),
Replicas: &replicas,
Env: []appstudiov1alpha1.EnvVarPair{
{
Name: "FOO",
Expand Down Expand Up @@ -1787,7 +1787,7 @@ var _ = Describe("SnapshotEnvironmentBinding controller", func() {
bindingName := HASBindingName + "12"
environmentName := "staging"

replicas := int32(3)
replicas := 3

createAndFetchSimpleAppWithRepo(applicationName, HASAppNamespace, DisplayName, Description, "https://github.com/fakeorg/test-error-response")
hasComp := createAndFetchSimpleComponent(componentName, HASAppNamespace, ComponentName, applicationName, SampleRepoLink, false)
Expand Down Expand Up @@ -1866,7 +1866,7 @@ var _ = Describe("SnapshotEnvironmentBinding controller", func() {
{
Name: componentName,
Configuration: appstudiov1alpha1.BindingComponentConfiguration{
Replicas: int(replicas),
Replicas: &replicas,
Env: []appstudiov1alpha1.EnvVarPair{
{
Name: "FOO",
Expand Down Expand Up @@ -1929,7 +1929,7 @@ var _ = Describe("SnapshotEnvironmentBinding controller", func() {
bindingName := HASBindingName + "14"
environmentName := "staging" + "14"

replicas := int32(3)
replicas := 3

createAndFetchSimpleApp(applicationName, HASAppNamespace, DisplayName, Description)

Expand Down Expand Up @@ -2018,7 +2018,7 @@ var _ = Describe("SnapshotEnvironmentBinding controller", func() {
{
Name: componentName,
Configuration: appstudiov1alpha1.BindingComponentConfiguration{
Replicas: int(replicas),
Replicas: &replicas,
Env: []appstudiov1alpha1.EnvVarPair{
{
Name: "FOO",
Expand Down Expand Up @@ -2077,7 +2077,7 @@ var _ = Describe("SnapshotEnvironmentBinding controller", func() {
bindingName := HASBindingName + "15"
environmentName := "staging" + "15"

replicas := int32(3)
replicas := 3

hasGitopsGeneratedResource := map[string]bool{
"deployment-patch.yaml": true,
Expand Down Expand Up @@ -2171,7 +2171,7 @@ var _ = Describe("SnapshotEnvironmentBinding controller", func() {
{
Name: componentName,
Configuration: appstudiov1alpha1.BindingComponentConfiguration{
Replicas: int(replicas),
Replicas: &replicas,
Env: []appstudiov1alpha1.EnvVarPair{
{
Name: "FOO",
Expand Down Expand Up @@ -2244,7 +2244,7 @@ var _ = Describe("SnapshotEnvironmentBinding controller", func() {
bindingName := HASBindingName + "16"
environmentName := "staging" + "16"

replicas := int32(3)
replicas := 3

createAndFetchSimpleApp(applicationName, HASAppNamespace, DisplayName, Description)

Expand Down Expand Up @@ -2344,7 +2344,7 @@ var _ = Describe("SnapshotEnvironmentBinding controller", func() {
{
Name: componentName,
Configuration: appstudiov1alpha1.BindingComponentConfiguration{
Replicas: int(replicas),
Replicas: &replicas,
Env: []appstudiov1alpha1.EnvVarPair{
{
Name: "FOO",
Expand Down Expand Up @@ -2402,7 +2402,7 @@ var _ = Describe("SnapshotEnvironmentBinding controller", func() {
bindingName := HASBindingName + "17"
environmentName := "staging" + "17"

replicas := int32(3)
replicas := 3

hasGitopsGeneratedResource := map[string]bool{
"deployment-patch.yaml": true,
Expand Down Expand Up @@ -2594,7 +2594,7 @@ schemaVersion: 2.2.0`
{
Name: componentName,
Configuration: appstudiov1alpha1.BindingComponentConfiguration{
Replicas: int(replicas),
Replicas: &replicas,
Env: []appstudiov1alpha1.EnvVarPair{
{
Name: "FOO",
Expand Down
Loading

0 comments on commit f92b56b

Please sign in to comment.