-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1223 from equinor/master
Release operator
- Loading branch information
Showing
29 changed files
with
1,175 additions
and
98 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
pipeline-runner/steps/deployconfig/internal/externaldns_provider.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package internal | ||
|
||
import ( | ||
"fmt" | ||
"slices" | ||
|
||
"github.com/equinor/radix-common/utils/slice" | ||
radixv1 "github.com/equinor/radix-operator/pkg/apis/radix/v1" | ||
) | ||
|
||
// ExternalDNSFeatureProvider handles external DNS configuration | ||
type ExternalDNSFeatureProvider struct{} | ||
|
||
func (d *ExternalDNSFeatureProvider) IsEnabledForEnvironment(envName string, ra radixv1.RadixApplication, activeRd radixv1.RadixDeployment) bool { | ||
if slices.ContainsFunc(ra.Spec.DNSExternalAlias, func(alias radixv1.ExternalAlias) bool { return alias.Environment == envName }) { | ||
return true | ||
} | ||
|
||
if slices.ContainsFunc(activeRd.Spec.Components, func(comp radixv1.RadixDeployComponent) bool { return len(comp.GetExternalDNS()) > 0 }) { | ||
return true | ||
} | ||
|
||
return false | ||
} | ||
|
||
func (d *ExternalDNSFeatureProvider) Mutate(target, source radixv1.RadixDeployment) error { | ||
for i, targetComp := range target.Spec.Components { | ||
sourceComp, found := slice.FindFirst(source.Spec.Components, func(c radixv1.RadixDeployComponent) bool { return c.Name == targetComp.Name }) | ||
if !found { | ||
return fmt.Errorf("component %s not found in active deployment", targetComp.Name) | ||
} | ||
target.Spec.Components[i].ExternalDNS = sourceComp.GetExternalDNS() | ||
} | ||
|
||
return nil | ||
} |
14 changes: 14 additions & 0 deletions
14
pipeline-runner/steps/deployconfig/internal/feature_provider.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package internal | ||
|
||
import ( | ||
radixv1 "github.com/equinor/radix-operator/pkg/apis/radix/v1" | ||
) | ||
|
||
// FeatureProvider provides methods for checking and mutating Radix features | ||
type FeatureProvider interface { | ||
// Check if feature is enabled for the specified environment by inspecting RadixApplication and active RadixDeployment (if set) | ||
IsEnabledForEnvironment(envName string, ra radixv1.RadixApplication, activeRd radixv1.RadixDeployment) bool | ||
|
||
// Mutates target with fields from source | ||
Mutate(target, source radixv1.RadixDeployment) error | ||
} |
Oops, something went wrong.