Skip to content

Commit e53c4c3

Browse files
Merge pull request openshift-service-mesh#164 from openshift-service-mesh-bot/none-main-merge_upstream_main-38a843ce
Automator: merge upstream changes to openshift-service-mesh/sail-operator@main
2 parents aceba32 + b0e3bb9 commit e53c4c3

File tree

118 files changed

+16639
-2134
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

118 files changed

+16639
-2134
lines changed

.devcontainer/devcontainer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "istio build-tools",
3-
"image": "gcr.io/istio-testing/build-tools:master-4759bf88d40172234fc6a0b9e11a4c5f1ea58a90",
3+
"image": "gcr.io/istio-testing/build-tools:master-3d91e3d29bd1057b14995647d90cbf85e043eba6",
44
"privileged": true,
55
"remoteEnv": {
66
"USE_GKE_GCLOUD_AUTH_PLUGIN": "True",

.github/workflows/update-deps.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
update-deps:
2424
runs-on: ubuntu-latest
2525
container:
26-
image: gcr.io/istio-testing/build-tools:master-4759bf88d40172234fc6a0b9e11a4c5f1ea58a90
26+
image: gcr.io/istio-testing/build-tools:master-3d91e3d29bd1057b14995647d90cbf85e043eba6
2727
options: --entrypoint ''
2828

2929
steps:

Makefile.core.mk

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ deploy: verify-kubeconfig helm ## Deploy controller to an existing cluster.
309309
$(HELM) template chart chart $(HELM_TEMPL_DEF_FLAGS) --set image='$(IMAGE)' --namespace $(NAMESPACE) | kubectl apply --server-side=true -f -
310310

311311
.PHONY: deploy-yaml
312-
deploy-yaml: verify-kubeconfig helm ## Output YAML manifests used by `deploy`.
312+
deploy-yaml: helm ## Output YAML manifests used by `deploy`.
313313
$(HELM) template chart chart $(HELM_TEMPL_DEF_FLAGS) --set image='$(IMAGE)' --namespace $(NAMESPACE)
314314

315315
.PHONY: deploy-openshift # TODO: remove this target and use deploy-olm instead (when we fix the internal registry TLS issues when using operator-sdk run bundle)
@@ -319,7 +319,7 @@ deploy-openshift: verify-kubeconfig helm ## Deploy controller to an existing OCP
319319
$(HELM) template chart chart $(HELM_TEMPL_DEF_FLAGS) --set image='$(IMAGE)' --namespace $(NAMESPACE) --set platform="openshift" | kubectl apply --server-side=true -f -
320320

321321
.PHONY: deploy-yaml-openshift
322-
deploy-yaml-openshift: verify-kubeconfig helm ## Output YAML manifests used by `deploy-openshift`.
322+
deploy-yaml-openshift: helm ## Output YAML manifests used by `deploy-openshift`.
323323
$(HELM) template chart chart $(HELM_TEMPL_DEF_FLAGS) --set image='$(IMAGE)' --namespace $(NAMESPACE) --set platform="openshift"
324324

325325
.PHONY: deploy-olm
@@ -468,12 +468,12 @@ OPM ?= $(LOCALBIN)/opm
468468
ISTIOCTL ?= $(LOCALBIN)/istioctl
469469

470470
## Tool Versions
471-
OPERATOR_SDK_VERSION ?= v1.37.0
472-
HELM_VERSION ?= v3.16.2
473-
CONTROLLER_TOOLS_VERSION ?= v0.16.4
474-
OPM_VERSION ?= v1.47.0
475-
OLM_VERSION ?= 0.28.0
476-
GITLEAKS_VERSION ?= v8.21.1
471+
OPERATOR_SDK_VERSION ?= v1.38.0
472+
HELM_VERSION ?= v3.16.3
473+
CONTROLLER_TOOLS_VERSION ?= v0.16.5
474+
OPM_VERSION ?= v1.48.0
475+
OLM_VERSION ?= v0.30.0
476+
GITLEAKS_VERSION ?= v8.21.2
477477
ISTIOCTL_VERSION ?= 1.23.0
478478

479479
# GENERATE_RELATED_IMAGES defines whether `spec.relatedImages` is going to be generated or not

PROJECT

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,15 @@ resources:
2424
namespaced: false
2525
controller: true
2626
domain: sailoperator.io
27-
kind: RemoteIstio
27+
kind: IstioRevision
2828
path: github.com/istio-ecosystem/sail-operator/api/v1alpha1
2929
version: v1alpha1
3030
- api:
3131
crdVersion: v1
3232
namespaced: false
3333
controller: true
3434
domain: sailoperator.io
35-
kind: IstioRevision
35+
kind: IstioRevisionTag
3636
path: github.com/istio-ecosystem/sail-operator/api/v1alpha1
3737
version: v1alpha1
3838
- api:
@@ -43,4 +43,12 @@ resources:
4343
kind: IstioCNI
4444
path: github.com/istio-ecosystem/sail-operator/api/v1alpha1
4545
version: v1alpha1
46+
- api:
47+
crdVersion: v1
48+
namespaced: false
49+
controller: true
50+
domain: sailoperator.io
51+
kind: ZTunnel
52+
path: github.com/istio-ecosystem/sail-operator/api/v1alpha1
53+
version: v1alpha1
4654
version: "3"

api/v1alpha1/istio_types.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,10 @@ type IstioSpec struct {
5151
// +sail:profile
5252
// The built-in installation configuration profile to use.
5353
// The 'default' profile is always applied. On OpenShift, the 'openshift' profile is also applied on top of 'default'.
54-
// Must be one of: ambient, default, demo, empty, openshift-ambient, openshift, preview, stable.
54+
// Must be one of: ambient, default, demo, empty, openshift-ambient, openshift, preview, remote, stable.
5555
// +++PROFILES-DROPDOWN-HIDDEN-UNTIL-WE-FULLY-IMPLEMENT-THEM+++operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Profile",xDescriptors={"urn:alm:descriptor:com.tectonic.ui:fieldGroup:General", "urn:alm:descriptor:com.tectonic.ui:select:ambient", "urn:alm:descriptor:com.tectonic.ui:select:default", "urn:alm:descriptor:com.tectonic.ui:select:demo", "urn:alm:descriptor:com.tectonic.ui:select:empty", "urn:alm:descriptor:com.tectonic.ui:select:external", "urn:alm:descriptor:com.tectonic.ui:select:minimal", "urn:alm:descriptor:com.tectonic.ui:select:preview", "urn:alm:descriptor:com.tectonic.ui:select:remote"}
5656
// +operator-sdk:csv:customresourcedefinitions:type=spec,xDescriptors={"urn:alm:descriptor:com.tectonic.ui:hidden"}
57-
// +kubebuilder:validation:Enum=ambient;default;demo;empty;openshift-ambient;openshift;preview;stable
57+
// +kubebuilder:validation:Enum=ambient;default;demo;empty;openshift-ambient;openshift;preview;remote;stable
5858
Profile string `json:"profile,omitempty"`
5959

6060
// Namespace to which the Istio components should be installed. Note that this field is immutable.
@@ -227,6 +227,9 @@ const (
227227
// IstioReasonIstiodNotReady indicates that the control plane is fully reconciled, but istiod is not ready.
228228
IstioReasonIstiodNotReady IstioConditionReason = "IstiodNotReady"
229229

230+
// IstioReasonRemoteIstiodNotReady indicates that the control plane is fully reconciled, but the remote istiod is not ready.
231+
IstioReasonRemoteIstiodNotReady IstioConditionReason = "RemoteIstiodNotReady"
232+
230233
// IstioReasonReadinessCheckFailed indicates that readiness could not be ascertained.
231234
IstioReasonReadinessCheckFailed IstioConditionReason = "ReadinessCheckFailed"
232235
)

api/v1alpha1/istiocni_types.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ type IstioCNISpec struct {
3737
// +sail:profile
3838
// The built-in installation configuration profile to use.
3939
// The 'default' profile is always applied. On OpenShift, the 'openshift' profile is also applied on top of 'default'.
40-
// Must be one of: ambient, default, demo, empty, openshift-ambient, openshift, preview, stable.
40+
// Must be one of: ambient, default, demo, empty, openshift-ambient, openshift, preview, remote, stable.
4141
// +++PROFILES-DROPDOWN-HIDDEN-UNTIL-WE-FULLY-IMPLEMENT-THEM+++operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Profile",xDescriptors={"urn:alm:descriptor:com.tectonic.ui:fieldGroup:General", "urn:alm:descriptor:com.tectonic.ui:select:ambient", "urn:alm:descriptor:com.tectonic.ui:select:default", "urn:alm:descriptor:com.tectonic.ui:select:demo", "urn:alm:descriptor:com.tectonic.ui:select:empty", "urn:alm:descriptor:com.tectonic.ui:select:external", "urn:alm:descriptor:com.tectonic.ui:select:minimal", "urn:alm:descriptor:com.tectonic.ui:select:preview", "urn:alm:descriptor:com.tectonic.ui:select:remote"}
4242
// +operator-sdk:csv:customresourcedefinitions:type=spec,xDescriptors={"urn:alm:descriptor:com.tectonic.ui:hidden"}
43-
// +kubebuilder:validation:Enum=ambient;default;demo;empty;openshift-ambient;openshift;preview;stable
43+
// +kubebuilder:validation:Enum=ambient;default;demo;empty;openshift-ambient;openshift;preview;remote;stable
4444
Profile string `json:"profile,omitempty"`
4545

4646
// Namespace to which the Istio CNI component should be installed.

api/v1alpha1/istiorevision_types.go

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,6 @@ const (
2828
// IstioRevisionSpec defines the desired state of IstioRevision
2929
// +kubebuilder:validation:XValidation:rule="self.values.global.istioNamespace == self.__namespace__",message="spec.values.global.istioNamespace must match spec.namespace"
3030
type IstioRevisionSpec struct {
31-
// Type indicates whether this revision represents a local or a remote control plane installation.
32-
// +kubebuilder:default=Local
33-
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="Value is immutable"
34-
Type IstioRevisionType `json:"type"`
35-
3631
// +sail:version
3732
// Defines the version of Istio to install.
3833
// Must be one of: v1.23.2.
@@ -178,16 +173,6 @@ const (
178173
IstioRevisionReasonHealthy IstioRevisionConditionReason = "Healthy"
179174
)
180175

181-
type IstioRevisionType string
182-
183-
const (
184-
// IstioRevisionTypeLocal indicates that the revision represents a local control plane installation.
185-
IstioRevisionTypeLocal IstioRevisionType = "Local"
186-
187-
// IstioRevisionTypeRemote indicates that the revision represents a remote control plane installation.
188-
IstioRevisionTypeRemote IstioRevisionType = "Remote"
189-
)
190-
191176
// +kubebuilder:object:root=true
192177
// +kubebuilder:resource:scope=Cluster,shortName=istiorev,categories=istio-io
193178
// +kubebuilder:subresource:status
Lines changed: 204 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,204 @@
1+
// Copyright Istio Authors
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
package v1alpha1
16+
17+
import (
18+
"time"
19+
20+
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
21+
)
22+
23+
const (
24+
IstioRevisionTagKind = "IstioRevisionTag"
25+
DefaultRevisionTag = "default"
26+
)
27+
28+
// IstioRevisionTagSpec defines the desired state of IstioRevisionTag
29+
type IstioRevisionTagSpec struct {
30+
// +kubebuilder:validation:Required
31+
TargetRef IstioRevisionTagTargetReference `json:"targetRef"`
32+
}
33+
34+
// IstioRevisionTagTargetReference can reference either Istio or IstioRevision objects in the cluster.
35+
type IstioRevisionTagTargetReference struct {
36+
// Kind is the kind of the target resource.
37+
//
38+
// +kubebuilder:validation:MinLength=1
39+
// +kubebuilder:validation:MaxLength=253
40+
// +kubebuilder:validation:Required
41+
Kind string `json:"kind"`
42+
43+
// Name is the name of the target resource.
44+
//
45+
// +kubebuilder:validation:MinLength=1
46+
// +kubebuilder:validation:MaxLength=253
47+
// +kubebuilder:validation:Required
48+
Name string `json:"name"`
49+
}
50+
51+
// IstioRevisionStatus defines the observed state of IstioRevision
52+
type IstioRevisionTagStatus struct {
53+
// ObservedGeneration is the most recent generation observed for this
54+
// IstioRevisionTag object. It corresponds to the object's generation, which is
55+
// updated on mutation by the API Server. The information in the status
56+
// pertains to this particular generation of the object.
57+
ObservedGeneration int64 `json:"observedGeneration,omitempty"`
58+
59+
// Represents the latest available observations of the object's current state.
60+
Conditions []IstioRevisionTagCondition `json:"conditions,omitempty"`
61+
62+
// Reports the current state of the object.
63+
State IstioRevisionTagConditionReason `json:"state,omitempty"`
64+
65+
// IstiodNamespace stores the namespace of the corresponding Istiod instance
66+
IstiodNamespace string `json:"istiodNamespace"`
67+
68+
// IstioRevision stores the name of the referenced IstioRevision
69+
IstioRevision string `json:"istioRevision"`
70+
}
71+
72+
// GetCondition returns the condition of the specified type
73+
func (s *IstioRevisionTagStatus) GetCondition(conditionType IstioRevisionTagConditionType) IstioRevisionTagCondition {
74+
if s != nil {
75+
for i := range s.Conditions {
76+
if s.Conditions[i].Type == conditionType {
77+
return s.Conditions[i]
78+
}
79+
}
80+
}
81+
return IstioRevisionTagCondition{Type: conditionType, Status: metav1.ConditionUnknown}
82+
}
83+
84+
// SetCondition sets a specific condition in the list of conditions
85+
func (s *IstioRevisionTagStatus) SetCondition(condition IstioRevisionTagCondition) {
86+
var now time.Time
87+
if testTime == nil {
88+
now = time.Now()
89+
} else {
90+
now = *testTime
91+
}
92+
93+
// The lastTransitionTime only gets serialized out to the second. This can
94+
// break update skipping, as the time in the resource returned from the client
95+
// may not match the time in our cached status during a reconcile. We truncate
96+
// here to save any problems down the line.
97+
lastTransitionTime := metav1.NewTime(now.Truncate(time.Second))
98+
99+
for i, prevCondition := range s.Conditions {
100+
if prevCondition.Type == condition.Type {
101+
if prevCondition.Status != condition.Status {
102+
condition.LastTransitionTime = lastTransitionTime
103+
} else {
104+
condition.LastTransitionTime = prevCondition.LastTransitionTime
105+
}
106+
s.Conditions[i] = condition
107+
return
108+
}
109+
}
110+
111+
// If the condition does not exist, initialize the lastTransitionTime
112+
condition.LastTransitionTime = lastTransitionTime
113+
s.Conditions = append(s.Conditions, condition)
114+
}
115+
116+
// IstioRevisionCondition represents a specific observation of the IstioRevision object's state.
117+
type IstioRevisionTagCondition struct {
118+
// The type of this condition.
119+
Type IstioRevisionTagConditionType `json:"type,omitempty"`
120+
121+
// The status of this condition. Can be True, False or Unknown.
122+
Status metav1.ConditionStatus `json:"status,omitempty"`
123+
124+
// Unique, single-word, CamelCase reason for the condition's last transition.
125+
Reason IstioRevisionTagConditionReason `json:"reason,omitempty"`
126+
127+
// Human-readable message indicating details about the last transition.
128+
Message string `json:"message,omitempty"`
129+
130+
// Last time the condition transitioned from one status to another.
131+
LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty"`
132+
}
133+
134+
// IstioRevisionConditionType represents the type of the condition. Condition stages are:
135+
// Installed, Reconciled, Ready
136+
type IstioRevisionTagConditionType string
137+
138+
// IstioRevisionConditionReason represents a short message indicating how the condition came
139+
// to be in its present state.
140+
type IstioRevisionTagConditionReason string
141+
142+
const (
143+
// IstioRevisionConditionReconciled signifies whether the controller has
144+
// successfully reconciled the resources defined through the CR.
145+
IstioRevisionTagConditionReconciled IstioRevisionTagConditionType = "Reconciled"
146+
147+
// IstioRevisionTagNameAlreadyExists indicates that the a revision with the same name as the IstioRevisionTag already exists.
148+
IstioRevisionTagReasonNameAlreadyExists IstioRevisionTagConditionReason = "NameAlreadyExists"
149+
150+
// IstioRevisionTagReasonReferenceNotFound indicates that the resource referenced by the tag's TargetRef was not found
151+
IstioRevisionTagReasonReferenceNotFound IstioRevisionTagConditionReason = "RefNotFound"
152+
153+
// IstioRevisionReasonReconcileError indicates that the reconciliation of the resource has failed, but will be retried.
154+
IstioRevisionTagReasonReconcileError IstioRevisionTagConditionReason = "ReconcileError"
155+
)
156+
157+
const (
158+
// IstioRevisionConditionInUse signifies whether any workload is configured to use the revision.
159+
IstioRevisionTagConditionInUse IstioRevisionTagConditionType = "InUse"
160+
161+
// IstioRevisionReasonReferencedByWorkloads indicates that the revision is referenced by at least one pod or namespace.
162+
IstioRevisionTagReasonReferencedByWorkloads IstioRevisionTagConditionReason = "ReferencedByWorkloads"
163+
164+
// IstioRevisionReasonNotReferenced indicates that the revision is not referenced by any pod or namespace.
165+
IstioRevisionTagReasonNotReferenced IstioRevisionTagConditionReason = "NotReferencedByAnything"
166+
167+
// IstioRevisionReasonUsageCheckFailed indicates that the operator could not check whether any workloads use the revision.
168+
IstioRevisionTagReasonUsageCheckFailed IstioRevisionTagConditionReason = "UsageCheckFailed"
169+
)
170+
171+
const (
172+
// IstioRevisionTagReasonHealthy indicates that the revision tag has been successfully reconciled and is in use.
173+
IstioRevisionTagReasonHealthy IstioRevisionTagConditionReason = "Healthy"
174+
)
175+
176+
// +kubebuilder:object:root=true
177+
// +kubebuilder:resource:scope=Cluster,shortName=istiorevtag,categories=istio-io
178+
// +kubebuilder:subresource:status
179+
// +kubebuilder:printcolumn:name="Status",type="string",JSONPath=".status.state",description="The current state of this object."
180+
// +kubebuilder:printcolumn:name="In use",type="string",JSONPath=".status.conditions[?(@.type==\"InUse\")].status",description="Whether the tag is being used by workloads."
181+
// +kubebuilder:printcolumn:name="Revision",type="string",JSONPath=".status.istioRevision",description="The IstioRevision this object is referencing."
182+
// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp",description="The age of the object"
183+
184+
// IstioRevisionTag references a Istio or IstioRevision object and serves as an alias for sidecar injection.
185+
type IstioRevisionTag struct {
186+
metav1.TypeMeta `json:",inline"`
187+
metav1.ObjectMeta `json:"metadata,omitempty"`
188+
189+
Spec IstioRevisionTagSpec `json:"spec,omitempty"`
190+
Status IstioRevisionTagStatus `json:"status,omitempty"`
191+
}
192+
193+
// +kubebuilder:object:root=true
194+
195+
// IstioRevisionList contains a list of IstioRevision
196+
type IstioRevisionTagList struct {
197+
metav1.TypeMeta `json:",inline"`
198+
metav1.ListMeta `json:"metadata,omitempty"`
199+
Items []IstioRevisionTag `json:"items"`
200+
}
201+
202+
func init() {
203+
SchemeBuilder.Register(&IstioRevisionTag{}, &IstioRevisionTagList{})
204+
}

0 commit comments

Comments
 (0)