Skip to content

Commit

Permalink
feat(STONEINTG-941): replace Environment API references
Browse files Browse the repository at this point in the history
The IntegrationTestScenario Environment fields are now
referencing API structs that have been removed from the
latest versions of the application-api.

Signed-off-by: Josh Everett <[email protected]>
  • Loading branch information
Josh-Everett committed Aug 5, 2024
1 parent 3ea5ef7 commit 01d0b26
Show file tree
Hide file tree
Showing 5 changed files with 232 additions and 14 deletions.
51 changes: 47 additions & 4 deletions api/v1alpha1/integrationtestscenario_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,53 @@ limitations under the License.
package v1alpha1

import (
applicationapiv1alpha1 "github.com/redhat-appstudio/application-api/api/v1alpha1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

// EnvVarPair describes environment variables to use for the component
type EnvVarPair struct {

// Name is the environment variable name
Name string `json:"name"`

// Value is the environment variable value
Value string `json:"value"`
}

// DeploymentTargetClaimConfig specifies the DeploymentTargetClaim details for a given Environment.
type DeploymentTargetClaimConfig struct {
ClaimName string `json:"claimName"`
}

// EnvironmentTarget provides the configuration for a deployment target.
type EnvironmentTarget struct {
DeploymentTargetClaim DeploymentTargetClaimConfig `json:"deploymentTargetClaim"`
}

// EnvironmentConfiguration contains Environment-specific configurations details, to be used when generating
// Component/Application GitOps repository resources.
type DeprecatedEnvironmentConfiguration struct {
// Env is an array of standard environment variables
Env []EnvVarPair `json:"env,omitempty"`

// Target is used to reference a DeploymentTargetClaim for a target Environment.
// The Environment controller uses the referenced DeploymentTargetClaim to access its bounded
// DeploymentTarget with cluster credential secret.
Target EnvironmentTarget `json:"target,omitempty"`
}

// DEPRECATED: EnvironmentType should no longer be used, and has no replacement.
// - It's original purpose was to indicate whether an environment is POC/Non-POC, but these data were ultimately not required.
type DeprecatedEnvironmentType string

const (
// DEPRECATED: EnvironmentType_POC should no longer be used, and has no replacement.
EnvironmentType_POC DeprecatedEnvironmentType = "POC"

// DEPRECATED: EnvironmentType_NonPOC should no longer be used, and has no replacement.
EnvironmentType_NonPOC DeprecatedEnvironmentType = "Non-POC"
)

// IntegrationTestScenarioSpec defines the desired state of IntegrationScenario
type IntegrationTestScenarioSpec struct {
// Application that's associated with the IntegrationTestScenario
Expand Down Expand Up @@ -55,9 +98,9 @@ type PipelineParameter struct {

// TestEnvironment contains the name and values of a Test environment
type TestEnvironment struct {
Name string `json:"name"`
Type applicationapiv1alpha1.EnvironmentType `json:"type"`
Configuration *applicationapiv1alpha1.EnvironmentConfiguration `json:"configuration,omitempty"`
Name string `json:"name"`
Type DeprecatedEnvironmentType `json:"type"`
Configuration *DeprecatedEnvironmentConfiguration `json:"configuration,omitempty"`
}

// TestContext contains the name and values of a Test context
Expand Down
70 changes: 68 additions & 2 deletions api/v1alpha1/zz_generated.deepcopy.go

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

51 changes: 47 additions & 4 deletions api/v1beta1/integrationtestscenario_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,53 @@ limitations under the License.
package v1beta1

import (
applicationapiv1alpha1 "github.com/redhat-appstudio/application-api/api/v1alpha1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

// EnvVarPair describes environment variables to use for the component
type EnvVarPair struct {

// Name is the environment variable name
Name string `json:"name"`

// Value is the environment variable value
Value string `json:"value"`
}

// DeploymentTargetClaimConfig specifies the DeploymentTargetClaim details for a given Environment.
type DeploymentTargetClaimConfig struct {
ClaimName string `json:"claimName"`
}

// EnvironmentTarget provides the configuration for a deployment target.
type EnvironmentTarget struct {
DeploymentTargetClaim DeploymentTargetClaimConfig `json:"deploymentTargetClaim"`
}

// EnvironmentConfiguration contains Environment-specific configurations details, to be used when generating
// Component/Application GitOps repository resources.
type DeprecatedEnvironmentConfiguration struct {
// Env is an array of standard environment variables
Env []EnvVarPair `json:"env,omitempty"`

// Target is used to reference a DeploymentTargetClaim for a target Environment.
// The Environment controller uses the referenced DeploymentTargetClaim to access its bounded
// DeploymentTarget with cluster credential secret.
Target EnvironmentTarget `json:"target,omitempty"`
}

// DEPRECATED: EnvironmentType should no longer be used, and has no replacement.
// - It's original purpose was to indicate whether an environment is POC/Non-POC, but these data were ultimately not required.
type DeprecatedEnvironmentType string

const (
// DEPRECATED: EnvironmentType_POC should no longer be used, and has no replacement.
EnvironmentType_POC DeprecatedEnvironmentType = "POC"

// DEPRECATED: EnvironmentType_NonPOC should no longer be used, and has no replacement.
EnvironmentType_NonPOC DeprecatedEnvironmentType = "Non-POC"
)

// IntegrationTestScenarioSpec defines the desired state of IntegrationScenario
type IntegrationTestScenarioSpec struct {
// Application that's associated with the IntegrationTestScenario
Expand Down Expand Up @@ -52,9 +95,9 @@ type PipelineParameter struct {

// TestEnvironment contains the name and values of a Test environment
type TestEnvironment struct {
Name string `json:"name"`
Type applicationapiv1alpha1.EnvironmentType `json:"type"`
Configuration *applicationapiv1alpha1.EnvironmentConfiguration `json:"configuration,omitempty"`
Name string `json:"name"`
Type DeprecatedEnvironmentType `json:"type"`
Configuration *DeprecatedEnvironmentConfiguration `json:"configuration,omitempty"`
}

// TestContext contains the name and values of a Test context
Expand Down
70 changes: 68 additions & 2 deletions api/v1beta1/zz_generated.deepcopy.go

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 @@ -76,7 +76,7 @@ spec:
GitOps repository resources.
properties:
env:
description: Env is an array of standard environment vairables
description: Env is an array of standard environment variables
items:
description: EnvVarPair describes environment variables
to use for the component
Expand Down Expand Up @@ -285,7 +285,7 @@ spec:
GitOps repository resources.
properties:
env:
description: Env is an array of standard environment vairables
description: Env is an array of standard environment variables
items:
description: EnvVarPair describes environment variables
to use for the component
Expand Down

0 comments on commit 01d0b26

Please sign in to comment.