tag

package
v0.0.0-...-91868f7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 1, 2024 License: Apache-2.0 Imports: 34 Imported by: 1

Documentation

Index

Constants

View Source
const (
	IstioTagLabel       = "istio.io/tag"
	DefaultRevisionName = "default"
)

Variables

This section is empty.

Functions

func Create

func Create(client kube.CLIClient, manifests, ns string) error

Create applies the given tag manifests.

func DeactivateIstioInjectionWebhook

func DeactivateIstioInjectionWebhook(ctx context.Context, client kubernetes.Interface) error

DeactivateIstioInjectionWebhook deactivates the istio-injection webhook from the given MutatingWebhookConfiguration if exists. used rather than just deleting the webhook since we want to keep it around after changing the default so user can later switch back to it. This is a hack but it is meant to cover a corner case where a user wants to migrate from a non-revisioned old version and then later decides to switch back to the old revision again.

func DeleteTagWebhooks

func DeleteTagWebhooks(ctx context.Context, client kubernetes.Interface, tag string) error

DeleteTagWebhooks deletes the given webhooks.

func Generate

func Generate(ctx context.Context, client kube.Client, opts *GenerateOptions, istioNS string) (string, error)

Generate generates the manifests for a revision tag pointed the given revision.

func GetNamespacesWithTag

func GetNamespacesWithTag(ctx context.Context, client kubernetes.Interface, tag string) ([]string, error)

GetNamespacesWithTag retrieves all namespaces pointed at the given tag.

func GetWebhookRevision

func GetWebhookRevision(wh admitv1.MutatingWebhookConfiguration) (string, error)

GetWebhookRevision extracts tag target revision from webhook object.

func GetWebhookTagName

func GetWebhookTagName(wh admitv1.MutatingWebhookConfiguration) string

GetWebhookTagName extracts tag name from webhook object.

func GetWebhooksWithRevision

func GetWebhooksWithRevision(ctx context.Context, client kubernetes.Interface, rev string) ([]admitv1.MutatingWebhookConfiguration, error)

GetWebhooksWithRevision returns webhooks tagged with istio.io/rev=<rev> and NOT TAGGED with istio.io/tag. this retrieves the webhook created at revision installation rather than tag webhooks

func GetWebhooksWithTag

func GetWebhooksWithTag(ctx context.Context, client kubernetes.Interface, tag string) ([]admitv1.MutatingWebhookConfiguration, error)

GetWebhooksWithTag returns webhooks tagged with istio.io/tag=<tag>.

func ListRevisionDescriptions

func ListRevisionDescriptions(client kube.CLIClient) (map[string]*RevisionDescription, error)

func PreviousInstallExists

func PreviousInstallExists(ctx context.Context, client kubernetes.Interface) bool

PreviousInstallExists checks whether there is an existing Istio installation. Should be used in installer when deciding whether to make an installation the default.

func PrintJSON

func PrintJSON(w io.Writer, res any) error

func TagCommand

func TagCommand(ctx cli.Context) *cobra.Command

Types

type GenerateOptions

type GenerateOptions struct {
	// Tag is the name of the revision tag to generate.
	Tag string
	// Revision is the revision to associate the revision tag with.
	Revision string
	// WebhookName is an override for the mutating webhook name.
	WebhookName string
	// ManifestsPath specifies where the manifests to render the mutatingwebhook can be found.
	// TODO(Monkeyanator) once we stop using Helm templating remove this.
	ManifestsPath string
	// Generate determines whether we should just generate the webhooks without applying. This
	// applying is not done here, but we are looser with checks when doing generate.
	Generate bool
	// Overwrite removes analysis checks around existing webhooks.
	Overwrite bool
	// AutoInjectNamespaces controls, if the sidecars should be injected into all namespaces by default.
	AutoInjectNamespaces bool
	// CustomLabels are labels to add to the generated webhook.
	CustomLabels map[string]string
	// UserManaged indicates whether the revision tag is user managed.
	// If true, the revision tag will not be affected by the installer.
	UserManaged bool
}

GenerateOptions is the group of options needed to generate a tag webhook.

type IopDiff

type IopDiff struct {
	Path  string `json:"path"`
	Value string `json:"value"`
}

type IstioOperatorCRInfo

type IstioOperatorCRInfo struct {
	IOP            *iopv1alpha1.IstioOperator `json:"-"`
	Namespace      string                     `json:"namespace"`
	Name           string                     `json:"name"`
	Profile        string                     `json:"profile"`
	Components     []string                   `json:"components,omitempty"`
	Customizations []IopDiff                  `json:"customizations,omitempty"`
}

IstioOperatorCRInfo represents a tiny subset of fields from IstioOperator CR. This structure is used for displaying data. Exposed for integration test

type MutatingWebhookConfigInfo

type MutatingWebhookConfigInfo struct {
	Name     string `json:"name"`
	Revision string `json:"revision"`
	Tag      string `json:"tag,omitempty"`
}

MutatingWebhookConfigInfo represents a tiny subset of fields from MutatingWebhookConfiguration kubernetes object. This is exposed for integration tests only

type NsInfo

type NsInfo struct {
	Name string             `json:"name,omitempty"`
	Pods []*PodFilteredInfo `json:"pods,omitempty"`
}

NsInfo represents namespace related information like pods running there. It is used to display data and is exposed for integration tests.

type PodFilteredInfo

type PodFilteredInfo struct {
	Namespace string          `json:"namespace"`
	Name      string          `json:"name"`
	Address   string          `json:"address"`
	Status    corev1.PodPhase `json:"status"`
	Age       string          `json:"age"`
}

PodFilteredInfo represents a small subset of fields from Pod object in Kubernetes. Exposed for integration test

type RevisionDescription

type RevisionDescription struct {
	IstioOperatorCRs   []*IstioOperatorCRInfo       `json:"istio_operator_crs,omitempty"`
	Webhooks           []*MutatingWebhookConfigInfo `json:"webhooks,omitempty"`
	ControlPlanePods   []*PodFilteredInfo           `json:"control_plane_pods,omitempty"`
	IngressGatewayPods []*PodFilteredInfo           `json:"ingess_gateways,omitempty"`
	EgressGatewayPods  []*PodFilteredInfo           `json:"egress_gateways,omitempty"`
	NamespaceSummary   map[string]*NsInfo           `json:"namespace_summary,omitempty"`
}

RevisionDescription is used to display revision related information. This is exposed for integration tests.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL