Skip to content

Commit e46d853

Browse files
committed
wip
1 parent 4dcd63f commit e46d853

3 files changed

Lines changed: 26 additions & 8 deletions

File tree

scripts/azure-vn/deployment/generate-deployment-artifacts.sh

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,7 @@ fi
3939

4040
# Input files
4141
INPUT_FILES=(
42-
operator.json operator.parameters.json
43-
vault.json vault.parameters.json
44-
vnet.json vnet.parameters.json
45-
gateway.json gateway.parameters.json
42+
operator.yaml
4643
)
4744

4845
# Copy input files to output dir
@@ -70,16 +67,17 @@ if [[ $? -ne 0 ]]; then
7067
fi
7168

7269
# Generate operator template
73-
sed -i "s#IMAGE_PLACEHOLDER#${IMAGE}#g" ${OUTPUT_DIR}/operator.json && \
74-
sed -i "s#IMAGE_VERSION_PLACEHOLDER#${IMAGE_VERSION}#g" ${OUTPUT_DIR}/operator.json
70+
sed -i "s#IMAGE_PLACEHOLDER#${IMAGE}#g" ${OUTPUT_DIR}/operator.yaml
71+
# && \
72+
# sed -i "s#IMAGE_VERSION_PLACEHOLDER#${IMAGE_VERSION}#g" ${OUTPUT_DIR}/operator.yaml
7573
if [[ $? -ne 0 ]]; then
7674
echo "Failed to pre-process operator template file"
7775
exit 1
7876
fi
7977

8078
# Export the policy, update it to turn off allow_environment_variable_dropping, and then insert it into the template
8179
# note that the EnclaveId is generated by generate.py on the raw policy, not the base64 version
82-
POLICY_DIGEST_FILE=azure-cc-operator-digest-$VERSION_NUMBER.txt
80+
POLICY_DIGEST_FILE=azure-vn-operator-digest-$VERSION_NUMBER.txt
8381
az confcom acipolicygen --approve-wildcards --template-file ${OUTPUT_DIR}/operator.json --print-policy > ${INPUT_DIR}/policy.base64
8482
base64 -di < ${INPUT_DIR}/policy.base64 > ${INPUT_DIR}/generated.rego
8583
sed -i "s#allow_environment_variable_dropping := true#allow_environment_variable_dropping := false#g" ${INPUT_DIR}/generated.rego
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import sys
2+
from hashlib import sha256
3+
4+
def str_to_sha256(x: str) -> str:
5+
return sha256(x.encode('utf-8')).hexdigest()
6+
7+
def print_data_sha256(data: str) -> str:
8+
print(str_to_sha256(data))
9+
10+
def print_data_sha256_stripped(data: str) -> str:
11+
print(str_to_sha256(data.strip()))
12+
13+
def main():
14+
with open(sys.argv[1], 'r') as file:
15+
data = file.read()
16+
17+
print_data_sha256(data)
18+
19+
if __name__ == '__main__':
20+
main()

scripts/azure-vn/deployment/operator.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ spec:
1212
labels:
1313
app.kubernetes.io/name: operator
1414
annotations:
15-
microsoft.containerinstance.virtualnode.ccepolicy: ''
15+
microsoft.containerinstance.virtualnode.ccepolicy: CCE_POLICY_PLACEHOLDER
1616
microsoft.containerinstance.virtualnode.identity: IDENTITY_PLACEHOLDER
1717
microsoft.containerinstance.virtualnode.injectdns: "false"
1818
spec:

0 commit comments

Comments
 (0)