Skip to content

Commit 0123fd8

Browse files
committed
is the 1st commit message:
updates deepcopy changes
1 parent 57ed333 commit 0123fd8

File tree

5 files changed

+23
-74
lines changed

5 files changed

+23
-74
lines changed

Makefile

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,8 @@ manifests: ## Generate WebhookConfiguration, ClusterRole and CustomResourceDefin
127127

128128
.PHONY: generate
129129
generate: ## Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations.
130-
$(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./..."
130+
$(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./api/..."
131+
hack/update-clientgen.sh
131132

132133
.PHONY: fmt
133134
fmt: ## Run go fmt against code.
@@ -148,13 +149,8 @@ update-manifests: $(HELM_BIN)
148149
hack/update-istio-csr-manifests.sh $(ISTIO_CSR_VERSION)
149150
.PHONY: update-manifests
150151

151-
update-scripts:
152-
hack/update-deepcopy.sh
153-
hack/update-clientgen.sh
154-
.PHONY: update-scripts
155-
156152
.PHONY: update
157-
update: update-scripts update-manifests update-bindata
153+
update: generate update-scripts update-manifests update-bindata
158154

159155
.PHONY: update-with-container
160156
update-with-container:

config/manager/manager.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,11 @@ spec:
7575
- name: OPERATOR_NAME
7676
value: cert-manager-operator
7777
- name: RELATED_IMAGE_CERT_MANAGER_WEBHOOK
78-
value: quay.io/jetstack/cert-manager-webhook
78+
value: quay.io/jetstack/cert-manager-webhook:latest
7979
- name: RELATED_IMAGE_CERT_MANAGER_CA_INJECTOR
80-
value: quay.io/jetstack/cert-manager-cainjector
80+
value: quay.io/jetstack/cert-manager-cainjector:latest
8181
- name: RELATED_IMAGE_CERT_MANAGER_CONTROLLER
82-
value: quay.io/jetstack/cert-manager-controller
82+
value: quay.io/jetstack/cert-manager-controller:latest
8383
- name: RELATED_IMAGE_CERT_MANAGER_ACMESOLVER
8484
value: quay.io/jetstack/cert-manager-acmesolver:v1.16.4
8585
- name: RELATED_IMAGE_CERT_MANAGER_ISTIOCSR

hack/update-deepcopy.sh

Lines changed: 0 additions & 9 deletions
This file was deleted.

hack/verify-deepcopy.sh

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
11
#!/bin/bash
22

3-
source "$(dirname "${BASH_SOURCE}")/lib/init.sh"
3+
set -euo pipefail
44

5-
SCRIPT_ROOT=$(dirname ${BASH_SOURCE})/..
6-
VERIFY=--verify-only ${SCRIPT_ROOT}/hack/update-deepcopy.sh
5+
function print_failure {
6+
echo "There are unexpected changes to the tree when running 'make generate'. Please"
7+
echo "run these commands locally and double-check the Git repository for unexpected changes which may"
8+
echo "need to be committed."
9+
exit 1
10+
}
11+
12+
echo "> generating deepcopy"
13+
make generate
14+
git status
15+
git diff
16+
test -z "$(git status --porcelain | \grep -v '^??')" || print_failure

pkg/operator/operatorclient/operatorclient.go

Lines changed: 4 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -80,21 +80,11 @@ func (c OperatorClient) ApplyOperatorSpec(ctx context.Context, fieldManager stri
8080

8181
func (c OperatorClient) ApplyOperatorStatus(ctx context.Context, fieldManager string, applyConfiguration *applyoperatorv1.OperatorStatusApplyConfiguration) (err error) {
8282
if applyConfiguration == nil {
83-
8483
return fmt.Errorf("applyConfiguration must have a value")
8584
}
8685

8786
desired := applyconfig.CertManager("cluster")
88-
//desired.Status.Conditions = make([]operatorv1.OperatorCondition, len(applyConfiguration.Conditions))
89-
//for i := range applyConfiguration.Conditions {
90-
// desired.Status.Conditions[i] = operatorv1.OperatorCondition{
91-
// Type: *applyConfiguration.Conditions[i].Type,
92-
// Status: *applyConfiguration.Conditions[i].Status,
93-
// LastTransitionTime: *applyConfiguration.Conditions[i].LastTransitionTime,
94-
// Reason: *applyConfiguration.Conditions[i].Reason,
95-
// Message: *applyConfiguration.Conditions[i].Message,
96-
// }
97-
//}
87+
desired.Status = &applyconfig.CertManagerStatusApplyConfiguration{}
9888

9989
desired.Status.Conditions = applyConfiguration.Conditions
10090
desired.Status.ObservedGeneration = applyConfiguration.ObservedGeneration
@@ -108,59 +98,21 @@ func (c OperatorClient) ApplyOperatorStatus(ctx context.Context, fieldManager st
10898
v1helpers.SetApplyConditionsLastTransitionTime(c.clock, &applyConfiguration.Conditions, nil)
10999
ts := c.clock.Now()
110100
for i := range desired.Status.Conditions {
111-
desired.Status.Conditions[i].LastTransitionTime = &metav1.Time{Time: ts}
101+
if desired.Status.Conditions[i].LastTransitionTime == nil {
102+
desired.Status.Conditions[i].LastTransitionTime = &metav1.Time{Time: ts}
103+
}
112104
}
113105

114106
case err != nil:
115107
return fmt.Errorf("unable to get operator configuration: %w", err)
116108
default:
117-
//previous, err := v1.ExtractOpenShiftControllerManagerStatus(instance, fieldManager)
118-
//if err != nil {
119-
// return fmt.Errorf("unable to extract operator configuration: %w", err)
120-
//}
121-
122-
//operatorStatus := &v1.OperatorStatusApplyConfiguration{}
123-
//if previous.Status != nil {
124-
// jsonBytes, err := json.Marshal(previous.Status)
125-
// if err != nil {
126-
// return fmt.Errorf("unable to serialize operator configuration: %w", err)
127-
// }
128-
// if err := json.Unmarshal(jsonBytes, operatorStatus); err != nil {
129-
// return fmt.Errorf("unable to deserialize operator configuration: %w", err)
130-
// }
131-
//}
132-
133-
//switch {
134-
//case applyConfiguration.Conditions != nil && operatorStatus != nil:
135-
// v1helpers.SetApplyConditionsLastTransitionTime(c.clock, &applyConfiguration.Conditions, operatorStatus.Conditions)
136-
//case applyConfiguration.Conditions != nil && operatorStatus == nil:
137-
// v1helpers.SetApplyConditionsLastTransitionTime(c.clock, &applyConfiguration.Conditions, nil)
138-
//}
139109

140-
//v1helpers.CanonicalizeOperatorStatus(applyConfiguration)
141-
//v1helpers.CanonicalizeOperatorStatus(operatorStatus)
142110
original := &applyconfig.CertManagerApplyConfiguration{}
143111
original.WithName(instance.Name)
144112

145113
original.WithKind(instance.Kind)
146114
original.WithAPIVersion(instance.APIVersion)
147115

148-
//if equality.Semantic.DeepEqual(original, desired) {
149-
// return nil
150-
//}
151-
//original := v1.OpenShiftControllerManager("cluster")
152-
//if operatorStatus != nil {
153-
// originalStatus := &v1.OpenShiftControllerManagerStatusApplyConfiguration{
154-
// OperatorStatusApplyConfiguration: *operatorStatus,
155-
// }
156-
// original.WithStatus(originalStatus)
157-
//}
158-
//
159-
//desiredStatus := &v1.OpenShiftControllerManagerStatusApplyConfiguration{
160-
// OperatorStatusApplyConfiguration: *applyConfiguration,
161-
//}
162-
//desired.WithStatus(desiredStatus)
163-
164116
if equality.Semantic.DeepEqual(original, desired) {
165117
return nil
166118
}

0 commit comments

Comments
 (0)