diff --git a/Dockerfile b/Dockerfile index debf449..db4ae72 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,6 +13,8 @@ RUN \ go build -o bin/fides main.go FROM base AS goreleaser +ENTRYPOINT ["/usr/local/bin/fides"] +CMD ["controller"] COPY fides /usr/local/bin/fides USER fides diff --git a/go.mod b/go.mod index b97e5b1..53d3ab8 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/ekristen/fides go 1.19 require ( - github.com/rancher/wrangler v1.1.1 + github.com/rancher/wrangler/v2 v2.1.1-0.20231012210714-3032665ca561 github.com/sirupsen/logrus v1.9.3 github.com/stretchr/testify v1.8.4 github.com/urfave/cli/v2 v2.25.7 diff --git a/go.sum b/go.sum index 23ff4c3..4de383e 100644 --- a/go.sum +++ b/go.sum @@ -6,7 +6,7 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/emicklei/go-restful/v3 v3.9.0 h1:XwGDlfxEnQZzuopoqxwSEllNcCOM9DhhFyhFIIGKwxE= github.com/emicklei/go-restful/v3 v3.9.0/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc= -github.com/evanphx/json-patch v4.12.0+incompatible h1:4onqiflcdA9EOZ4RxV643DvftH5pOlLGNtQ5lPWQu84= +github.com/evanphx/json-patch v5.6.0+incompatible h1:jBYDEEiFBPxA0v50tFdvOzQQTCvpL6mnFh5mB2/l16U= github.com/go-logr/logr v1.2.0/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= @@ -63,8 +63,8 @@ github.com/onsi/gomega v1.27.6 h1:ENqfyGeS5AX/rlXDd/ETokDz93u0YufY1Pgxuy/PvWE= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/rancher/wrangler v1.1.1 h1:wmqUwqc2M7ADfXnBCJTFkTB5ZREWpD78rnZMzmxwMvM= -github.com/rancher/wrangler v1.1.1/go.mod h1:ioVbKupzcBOdzsl55MvEDN0R1wdGggj8iNCYGFI5JvM= +github.com/rancher/wrangler/v2 v2.1.1-0.20231012210714-3032665ca561 h1:5tIFBO5r+DWXm638DtBsQP9VdZD+OVDi9K7qryyx60M= +github.com/rancher/wrangler/v2 v2.1.1-0.20231012210714-3032665ca561/go.mod h1:2pCXUgRUaiiIZYqFe/nK2xwujNs6JK+SgAcyB+xs+Tg= github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= diff --git a/main.go b/main.go index 69ab4e5..183dd84 100644 --- a/main.go +++ b/main.go @@ -4,11 +4,13 @@ import ( "os" "path" - "github.com/rancher/wrangler/pkg/signals" + "github.com/rancher/wrangler/v2/pkg/signals" "github.com/sirupsen/logrus" "github.com/urfave/cli/v2" "github.com/ekristen/fides/pkg/common" + + _ "github.com/ekristen/fides/pkg/commands/controllers" ) func main() { diff --git a/pkg/commands/controllers/controllers.go b/pkg/commands/controllers/controllers.go index 0f46103..cc2a583 100644 --- a/pkg/commands/controllers/controllers.go +++ b/pkg/commands/controllers/controllers.go @@ -32,18 +32,21 @@ func Execute(c *cli.Context) error { func init() { flags := []cli.Flag{ &cli.BoolFlag{ - Name: "agree-tos", - Usage: "Agree to the Terms of Service https://fides.ekristen.dev/terms, by using this option you agree.", + Name: "agree-tos", + Usage: "Agree to the Terms of Service https://fides.ekristen.dev/terms, by using this option you agree.", + EnvVars: []string{"FIDES_AGREE_TOS"}, }, &cli.StringFlag{ - Name: "namespace", - Usage: "namespace for fides", - Value: "fides-system", + Name: "namespace", + Usage: "namespace for fides", + Value: "fides-system", + EnvVars: []string{"FIDES_NAMESPACE"}, }, &cli.StringFlag{ - Name: "secret-name", - Usage: "custom name for the fides secret", - Value: "fides", + Name: "secret-name", + Usage: "custom name for the fides secret", + Value: "fides", + EnvVars: []string{"FIDES_SECRET_NAME"}, }, &cli.StringFlag{ Name: "metrics-port", @@ -55,9 +58,10 @@ func init() { Hidden: true, }, &cli.StringFlag{ - Name: "base-url", - Value: "https://fides.ekristen.dev", - Hidden: true, + Name: "base-url", + Value: "https://fides.ekristen.dev", + Hidden: true, + EnvVars: []string{"FIDES_BASE_URL"}, }, &cli.StringFlag{ Name: "cluster-key", diff --git a/pkg/controller/controller.go b/pkg/controller/controller.go index 51e8c75..2fe3132 100644 --- a/pkg/controller/controller.go +++ b/pkg/controller/controller.go @@ -5,8 +5,8 @@ import ( "context" "encoding/json" "fmt" - "github.com/rancher/wrangler/pkg/kubeconfig" - "github.com/rancher/wrangler/pkg/leader" + "github.com/rancher/wrangler/v2/pkg/kubeconfig" + "github.com/rancher/wrangler/v2/pkg/leader" "github.com/sirupsen/logrus" "io" "io/ioutil"