Skip to content

Commit

Permalink
Merge pull request #4304 from emissary-ingress/rel/v3.0.0
Browse files Browse the repository at this point in the history
Release PR for v3.0.0
  • Loading branch information
Alice Wasko authored Jun 28, 2022
2 parents ce9dc45 + 3fff82b commit d678c14
Show file tree
Hide file tree
Showing 16 changed files with 349 additions and 568 deletions.
10 changes: 5 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,15 +72,15 @@ it will be removed; but as it won't be user-visible this isn't considered a brea

## RELEASE NOTES

## [3.0.0] TBD
## [3.0.0] June 27, 2022
[3.0.0]: https://github.com/emissary-ingress/emissary/compare/v2.3.1...v3.0.0

### Emissary-ingress and Ambassador Edge Stack

- Change: The envoy version included in Emissary-ingress has been upgraded from 1.17 to latest patch
release of 1.22. This provides $produceName$ with the latest security patches, performances
enhancments, and features offered by the envoy proxy. One notable change that will effect users is
the removal of support for V2 tranport protocol. See below for more information.
- Change: The envoy version included in Emissary-ingress has been upgraded from 1.17 to the latest
patch release of 1.22. This provides Emissary-ingress with the latest security patches,
performances enhancments, and features offered by the envoy proxy. One notable change that will
effect users is the removal of support for V2 tranport protocol. See below for more information.

- Change: Emissary-ingress can no longer be made to configure Envoy using the v2 xDS configuration
API; it now always uses the v3 xDS API to configure Envoy. This change should be mostly invisible
Expand Down
14 changes: 8 additions & 6 deletions cmd/entrypoint/consul.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,18 @@ type consulMapping struct {
}

func ReconcileConsul(ctx context.Context, consulWatcher *consulWatcher, s *snapshotTypes.KubernetesSnapshot) error {
envAmbID := GetAmbassadorID()

var mappings []consulMapping
for _, list := range s.Annotations {
for _, a := range list {
switch m := a.(type) {
case *amb.Mapping:
if include(m.Spec.AmbassadorID) {
if m.Spec.AmbassadorID.Matches(envAmbID) {
mappings = append(mappings, consulMapping{Service: m.Spec.Service, Resolver: m.Spec.Resolver})
}
case *amb.TCPMapping:
if include(m.Spec.AmbassadorID) {
if m.Spec.AmbassadorID.Matches(envAmbID) {
mappings = append(mappings, consulMapping{Service: m.Spec.Service, Resolver: m.Spec.Resolver})
}
}
Expand All @@ -38,19 +40,19 @@ func ReconcileConsul(ctx context.Context, consulWatcher *consulWatcher, s *snaps

var resolvers []*amb.ConsulResolver
for _, cr := range s.ConsulResolvers {
if include(cr.Spec.AmbassadorID) {
if cr.Spec.AmbassadorID.Matches(envAmbID) {
resolvers = append(resolvers, cr)
}
}

for _, m := range s.Mappings {
if include(m.Spec.AmbassadorID) {
if m.Spec.AmbassadorID.Matches(envAmbID) {
mappings = append(mappings, consulMapping{Service: m.Spec.Service, Resolver: m.Spec.Resolver})
}
}

for _, tm := range s.TCPMappings {
if include(tm.Spec.AmbassadorID) {
if tm.Spec.AmbassadorID.Matches(envAmbID) {
mappings = append(mappings, consulMapping{Service: tm.Spec.Service, Resolver: tm.Spec.Resolver})
}
}
Expand Down Expand Up @@ -325,7 +327,7 @@ func watchConsul(

w.Watch(func(endpoints consulwatch.Endpoints, e error) {
if endpoints.Id == "" {
// For Ambassador, overwrite the Id with the resolver's datacenter -- the
// For Ambassador, overwrite the ID with the resolver's datacenter -- the
// Consul watcher doesn't actually hand back the DC, and we need it.
endpoints.Id = resolver.Spec.Datacenter
}
Expand Down
18 changes: 10 additions & 8 deletions cmd/entrypoint/endpoints.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ func newEndpointRoutingInfo() endpointRoutingInfo {
}

func (eri *endpointRoutingInfo) reconcileEndpointWatches(ctx context.Context, s *snapshotTypes.KubernetesSnapshot) {
envAmbID := GetAmbassadorID()

// Reset our state except for the previous endpoint watches. We keep them so we can detect if
// the set of things we are interested in has changed.
eri.resolverTypes = map[string]ResolverType{}
Expand All @@ -78,7 +80,7 @@ func (eri *endpointRoutingInfo) reconcileEndpointWatches(ctx context.Context, s
if _, isInvalid := a.(*kates.Unstructured); isInvalid {
continue
}
if include(GetAmbId(ctx, a)) {
if GetAmbID(ctx, a).Matches(envAmbID) {
eri.checkResourcePhase1(ctx, a, "annotation")
}
}
Expand All @@ -89,25 +91,25 @@ func (eri *endpointRoutingInfo) reconcileEndpointWatches(ctx context.Context, s
// need to test every resource, and no need to walk over things we're not
// interested in.
for _, m := range s.Modules {
if include(m.Spec.AmbassadorID) {
if m.Spec.AmbassadorID.Matches(envAmbID) {
eri.checkModule(ctx, m, "CRD")
}
}

for _, r := range s.KubernetesServiceResolvers {
if include(r.Spec.AmbassadorID) {
if r.Spec.AmbassadorID.Matches(envAmbID) {
eri.saveResolver(ctx, r.GetName(), KubernetesServiceResolver, "CRD")
}
}

for _, r := range s.KubernetesEndpointResolvers {
if include(r.Spec.AmbassadorID) {
if r.Spec.AmbassadorID.Matches(envAmbID) {
eri.saveResolver(ctx, r.GetName(), KubernetesEndpointResolver, "CRD")
}
}

for _, r := range s.ConsulResolvers {
if include(r.Spec.AmbassadorID) {
if r.Spec.AmbassadorID.Matches(envAmbID) {
eri.saveResolver(ctx, r.GetName(), ConsulResolver, "CRD")
}
}
Expand All @@ -128,20 +130,20 @@ func (eri *endpointRoutingInfo) reconcileEndpointWatches(ctx context.Context, s
if _, isInvalid := a.(*kates.Unstructured); isInvalid {
continue
}
if include(GetAmbId(ctx, a)) {
if GetAmbID(ctx, a).Matches(envAmbID) {
eri.checkResourcePhase2(ctx, a, "annotation")
}
}
}

for _, m := range s.Mappings {
if include(m.Spec.AmbassadorID) {
if m.Spec.AmbassadorID.Matches(envAmbID) {
eri.checkMapping(ctx, m, "CRD")
}
}

for _, t := range s.TCPMappings {
if include(t.Spec.AmbassadorID) {
if t.Spec.AmbassadorID.Matches(envAmbID) {
eri.checkTCPMapping(ctx, t, "CRD")
}
}
Expand Down
6 changes: 1 addition & 5 deletions cmd/entrypoint/entrypoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,6 @@ import (
// manager (e.g. kubernetes) is expected to take note and restart if
// appropriate.

const envAmbassadorDemoMode string = "AMBASSADOR_DEMO_MODE"

func Main(ctx context.Context, Version string, args ...string) error {
// Setup logging according to AES_LOG_LEVEL
busy.SetLogLevel(logutil.DefaultLogLevel)
Expand All @@ -105,8 +103,6 @@ func Main(ctx context.Context, Version string, args ...string) error {
// Demo mode!
dlog.Infof(ctx, "DEMO MODE")
demoMode = true
// Set an environment variable so that other parts of the code can check if demo mode is active (mainly used for disabling synthetic authservice injection)
os.Setenv(envAmbassadorDemoMode, "true")
}

clusterID := GetClusterID(ctx)
Expand Down Expand Up @@ -221,7 +217,7 @@ func Main(ctx context.Context, Version string, args ...string) error {
}

func clusterIDFromRootID(rootID string) string {
clusterUrl := fmt.Sprintf("d6e_id://%s/%s", rootID, GetAmbassadorId())
clusterUrl := fmt.Sprintf("d6e_id://%s/%s", rootID, GetAmbassadorID())
uid := uuid.NewSHA1(uuid.NameSpaceURL, []byte(clusterUrl))

return strings.ToLower(uid.String())
Expand Down
6 changes: 3 additions & 3 deletions cmd/entrypoint/env.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func GetAgentService() string {
return ""
}

func GetAmbassadorId() string {
func GetAmbassadorID() string {
id := os.Getenv("AMBASSADOR_ID")
if id != "" {
return id
Expand Down Expand Up @@ -67,7 +67,7 @@ func GetEnvoyBootstrapFile() string {
return env("ENVOY_BOOTSTRAP_FILE", path.Join(GetAmbassadorConfigBaseDir(), "bootstrap-ads.json"))
}

func GetEnvoyBaseId() string {
func GetEnvoyBaseID() string {
return env("AMBASSADOR_ENVOY_BASE_ID", "0")
}

Expand Down Expand Up @@ -149,7 +149,7 @@ func isDebug(name string) bool {
}

func GetEnvoyFlags() []string {
result := []string{"-c", GetEnvoyBootstrapFile(), "--base-id", GetEnvoyBaseId()}
result := []string{"-c", GetEnvoyBootstrapFile(), "--base-id", GetEnvoyBaseID()}
svc := GetAgentService()
if svc != "" {
result = append(result, "--drain-time-s", "1")
Expand Down
31 changes: 0 additions & 31 deletions cmd/entrypoint/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"strings"

"github.com/datawire/dlib/dexec"
amb "github.com/emissary-ingress/emissary/v3/pkg/api/getambassador.io/v3alpha1"
)

func envbool(name string) bool {
Expand Down Expand Up @@ -64,33 +63,3 @@ func convert(in interface{}, out interface{}) error {

return nil
}

// Should we pay attention to a given AmbassadorID set?
//
// XXX Yes, amb.AmbassadorID is a singular name for a plural type. Sigh.
func include(id amb.AmbassadorID) bool {
// We always pay attention to the "_automatic_" ID -- it gives us a
// to easily always include certain configuration resources for Edge
// Stack.
if len(id) == 1 && id[0] == "_automatic_" {
return true
}

// It's not "_automatic_", so we have to actually do the work. Grab
// our AmbassadorID...
me := GetAmbassadorId()

// ...force an empty AmbassadorID to "default", per the documentation...
if len(id) == 0 {
id = amb.AmbassadorID{"default"}
}

// ...and then see if our AmbassadorID is in the list.
for _, name := range id {
if me == name {
return true
}
}

return false
}
10 changes: 6 additions & 4 deletions cmd/entrypoint/secrets.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,8 @@ func checkSecret(
// since we don't want to send secrets to Ambassador unless we're
// using them, since any secret we send will be saved to disk.
func ReconcileSecrets(ctx context.Context, sh *SnapshotHolder) error {
envAmbID := GetAmbassadorID()

// Start by building up a list of all the K8s objects that are
// allowed to mention secrets. Note that we vet the ambassador_id
// for all of these before putting them on the list.
Expand All @@ -190,7 +192,7 @@ func ReconcileSecrets(ctx context.Context, sh *SnapshotHolder) error {
if _, isInvalid := a.(*kates.Unstructured); isInvalid {
continue
}
if include(GetAmbId(ctx, a)) {
if GetAmbID(ctx, a).Matches(envAmbID) {
resources = append(resources, a)
}
}
Expand All @@ -203,19 +205,19 @@ func ReconcileSecrets(ctx context.Context, sh *SnapshotHolder) error {
if len(h.Spec.AmbassadorID) > 0 {
id = h.Spec.AmbassadorID
}
if include(id) {
if id.Matches(envAmbID) {
resources = append(resources, h)
}
}

// TLSContexts, Modules, and Ingresses are all straightforward.
for _, t := range sh.k8sSnapshot.TLSContexts {
if include(t.Spec.AmbassadorID) {
if t.Spec.AmbassadorID.Matches(envAmbID) {
resources = append(resources, t)
}
}
for _, m := range sh.k8sSnapshot.Modules {
if include(m.Spec.AmbassadorID) {
if m.Spec.AmbassadorID.Matches(envAmbID) {
resources = append(resources, m)
}
}
Expand Down
4 changes: 2 additions & 2 deletions cmd/entrypoint/snapshot.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ func NewKubernetesSnapshot() *snapshotTypes.KubernetesSnapshot {
return a
}

// GetAmbId extracts the AmbassadorId from the kubernetes resource.
func GetAmbId(ctx context.Context, resource kates.Object) amb.AmbassadorID {
// GetAmbID extracts the AmbassadorID from the kubernetes resource.
func GetAmbID(ctx context.Context, resource kates.Object) amb.AmbassadorID {
switch r := resource.(type) {
case *amb.Host:
var id amb.AmbassadorID
Expand Down
Loading

0 comments on commit d678c14

Please sign in to comment.