-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update:
crossplane
to v1.16.0, use new upjet AWS provider (#197)
Includes `crossplane-core` and `crossplane-s3-provider`
- Loading branch information
1 parent
e9fe679
commit 43a1813
Showing
16 changed files
with
334 additions
and
126 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package install | ||
|
||
import ( | ||
"github.com/awslabs/eksdemo/pkg/application" | ||
"github.com/awslabs/eksdemo/pkg/application/crossplane/core" | ||
"github.com/awslabs/eksdemo/pkg/application/crossplane/s3" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
var crossplane []func() *application.Application | ||
|
||
func NewInstallCrossplaneCmd() *cobra.Command { | ||
cmd := &cobra.Command{ | ||
Use: "crossplane", | ||
Short: "The Cloud Native Control Plane", | ||
Aliases: []string{"cp"}, | ||
} | ||
|
||
// Don't show flag errors for `install crossplane` without a subcommand | ||
cmd.DisableFlagParsing = true | ||
|
||
for _, cp := range crossplane { | ||
cmd.AddCommand(cp().NewInstallCmd()) | ||
} | ||
|
||
return cmd | ||
} | ||
|
||
func NewUninstallCrossplaneCmd() *cobra.Command { | ||
cmd := &cobra.Command{ | ||
Use: "crossplane", | ||
Short: "The Cloud Native Control Plane", | ||
Aliases: []string{"cp"}, | ||
} | ||
|
||
// Don't show flag errors for `uninstall crossplane` without a subcommand | ||
cmd.DisableFlagParsing = true | ||
|
||
for _, cp := range crossplane { | ||
cmd.AddCommand(cp().NewUninstallCmd()) | ||
} | ||
|
||
return cmd | ||
} | ||
|
||
func init() { | ||
crossplane = []func() *application.Application{ | ||
core.NewApp, | ||
s3.NewApp, | ||
} | ||
} |
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 was deleted.
Oops, something went wrong.
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,80 @@ | ||
package crossplane | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
|
||
"github.com/awslabs/eksdemo/pkg/kubernetes" | ||
"github.com/awslabs/eksdemo/pkg/resource" | ||
"github.com/spf13/cobra" | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
"k8s.io/apimachinery/pkg/runtime/schema" | ||
) | ||
|
||
func CheckCore() *resource.Resource { | ||
return &resource.Resource{ | ||
Options: &resource.CommonOptions{ | ||
Name: "check-for-crossplane-core", | ||
}, | ||
|
||
Manager: &CheckResourceManager{ | ||
Name: "Crossplane Core", | ||
Message: "please install \"crossplane-core\" first", | ||
Group: "pkg.crossplane.io", | ||
Resource: "providers", | ||
Version: "v1", | ||
}, | ||
} | ||
} | ||
|
||
type CheckResourceManager struct { | ||
DryRun bool | ||
Name string | ||
Message string | ||
|
||
Group string | ||
Resource string | ||
Version string | ||
resource.EmptyInit | ||
} | ||
|
||
func (m *CheckResourceManager) Create(options resource.Options) error { | ||
if m.DryRun { | ||
fmt.Println("\nCheck Resource Manager Dry Run:") | ||
fmt.Println("Will check for: ", m.Name) | ||
fmt.Printf("Check performs a List operaton on Group: %q, Resource: %q, Version: %q\n", m.Group, m.Resource, m.Version) | ||
return nil | ||
} | ||
|
||
client, err := kubernetes.DynamicClient(options.Common().KubeContext) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
providerConfig := schema.GroupVersionResource{ | ||
Group: m.Group, | ||
Resource: m.Resource, | ||
Version: m.Version, | ||
} | ||
|
||
_, err = client.Resource(providerConfig).List(context.Background(), metav1.ListOptions{}) | ||
if err != nil { | ||
return fmt.Errorf(m.Message) | ||
} | ||
|
||
fmt.Printf("%q found\n", m.Name) | ||
|
||
return nil | ||
} | ||
|
||
func (m *CheckResourceManager) Delete(_ resource.Options) error { | ||
return nil | ||
} | ||
|
||
func (m *CheckResourceManager) SetDryRun() { | ||
m.DryRun = true | ||
} | ||
|
||
func (m *CheckResourceManager) Update(_ resource.Options, _ *cobra.Command) error { | ||
return fmt.Errorf("feature not supported") | ||
} |
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
24 changes: 11 additions & 13 deletions
24
pkg/application/crossplane/options.go → pkg/application/crossplane/core/options.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
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
Oops, something went wrong.