diff --git a/cmp-fileName/Dockerfile.maycmp b/cmp-fileName/Dockerfile.maycmp new file mode 100644 index 0000000..02eef9d --- /dev/null +++ b/cmp-fileName/Dockerfile.maycmp @@ -0,0 +1,9 @@ +#################################################################################################### +# may-cmp-server +#################################################################################################### +FROM busybox +COPY plugin-withFilename-config.yaml /home/argocd/cmp-server/config/plugin-withFilename-config.yaml + +RUN mkdir -p /home/argocd/cmp-server/plugins + +USER 999 \ No newline at end of file diff --git a/cmp-fileName/argocd-repo-server.yaml b/cmp-fileName/argocd-repo-server.yaml new file mode 100644 index 0000000..3f7f79e --- /dev/null +++ b/cmp-fileName/argocd-repo-server.yaml @@ -0,0 +1,208 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + labels: + app.kubernetes.io/component: repo-server + app.kubernetes.io/name: argocd-repo-server + app.kubernetes.io/part-of: argocd + name: argocd-repo-server +spec: + selector: + matchLabels: + app.kubernetes.io/name: argocd-repo-server + template: + metadata: + labels: + app.kubernetes.io/name: argocd-repo-server + spec: + affinity: + podAntiAffinity: + preferredDuringSchedulingIgnoredDuringExecution: + - podAffinityTerm: + labelSelector: + matchLabels: + app.kubernetes.io/name: argocd-repo-server + topologyKey: kubernetes.io/hostname + weight: 100 + - podAffinityTerm: + labelSelector: + matchLabels: + app.kubernetes.io/part-of: argocd + topologyKey: kubernetes.io/hostname + weight: 5 + automountServiceAccountToken: false + containers: + - name: may + command: [/var/run/argocd/argocd-cmp-server] + image: /maycmpserver:cmp + volumeMounts: + - mountPath: /var/run/argocd + name: var-files + - mountPath: /home/argocd/cmp-server/plugins + name: plugins + - mountPath: /tmp + name: tmp-dir + - command: + - uid_entrypoint.sh + - argocd-repo-server + - --redis + - argocd-redis:6379 + env: + - name: ARGOCD_RECONCILIATION_TIMEOUT + valueFrom: + configMapKeyRef: + key: timeout.reconciliation + name: argocd-cm + optional: true + - name: ARGOCD_REPO_SERVER_LOGFORMAT + valueFrom: + configMapKeyRef: + key: reposerver.log.format + name: argocd-cmd-params-cm + optional: true + - name: ARGOCD_REPO_SERVER_LOGLEVEL + valueFrom: + configMapKeyRef: + key: reposerver.log.level + name: argocd-cmd-params-cm + optional: true + - name: ARGOCD_REPO_SERVER_PARALLELISM_LIMIT + valueFrom: + configMapKeyRef: + key: reposerver.parallelism.limit + name: argocd-cmd-params-cm + optional: true + - name: ARGOCD_REPO_SERVER_DISABLE_TLS + valueFrom: + configMapKeyRef: + key: reposerver.disable.tls + name: argocd-cmd-params-cm + optional: true + - name: ARGOCD_TLS_MIN_VERSION + valueFrom: + configMapKeyRef: + key: reposerver.tls.minversion + name: argocd-cmd-params-cm + optional: true + - name: ARGOCD_TLS_MAX_VERSION + valueFrom: + configMapKeyRef: + key: reposerver.tls.maxversion + name: argocd-cmd-params-cm + optional: true + - name: ARGOCD_TLS_CIPHERS + valueFrom: + configMapKeyRef: + key: reposerver.tls.ciphers + name: argocd-cmd-params-cm + optional: true + - name: ARGOCD_REPO_CACHE_EXPIRATION + valueFrom: + configMapKeyRef: + key: reposerver.repo.cache.expiration + name: argocd-cmd-params-cm + optional: true + - name: REDIS_SERVER + valueFrom: + configMapKeyRef: + key: redis.server + name: argocd-cmd-params-cm + optional: true + - name: REDISDB + valueFrom: + configMapKeyRef: + key: redis.db + name: argocd-cmd-params-cm + optional: true + - name: ARGOCD_DEFAULT_CACHE_EXPIRATION + valueFrom: + configMapKeyRef: + key: reposerver.default.cache.expiration + name: argocd-cmd-params-cm + optional: true + image: /may:cmp4 + imagePullPolicy: Always + livenessProbe: + failureThreshold: 3 + httpGet: + path: /healthz?full=true + port: 8084 + initialDelaySeconds: 30 + periodSeconds: 5 + name: argocd-repo-server + ports: + - containerPort: 8081 + - containerPort: 8084 + readinessProbe: + httpGet: + path: /healthz + port: 8084 + initialDelaySeconds: 5 + periodSeconds: 10 + securityContext: + allowPrivilegeEscalation: false + capabilities: + drop: + - all + readOnlyRootFilesystem: true + runAsNonRoot: true + volumeMounts: + - mountPath: /app/config/ssh + name: ssh-known-hosts + - mountPath: /app/config/tls + name: tls-certs + - mountPath: /app/config/gpg/source + name: gpg-keys + - mountPath: /app/config/gpg/keys + name: gpg-keyring + - mountPath: /app/config/reposerver/tls + name: argocd-repo-server-tls + - mountPath: /home/argocd/cmp-server/plugins + name: plugins + - mountPath: /tmp + name: tmp-dir + initContainers: + - command: + - cp + - -n + - /usr/local/bin/argocd + - /var/run/argocd/argocd-cmp-server + image: /may:cmp4 + name: copyutil + volumeMounts: + - mountPath: /var/run/argocd + name: var-files + volumes: + - configMap: + name: argocd-ssh-known-hosts-cm + name: ssh-known-hosts + - configMap: + name: argocd-tls-certs-cm + name: tls-certs + - configMap: + name: argocd-gpg-keys-cm + name: gpg-keys + - emptyDir: {} + name: gpg-keyring + - emptyDir: {} + name: tmp + - name: argocd-repo-server-tls + secret: + items: + - key: tls.crt + path: tls.crt + - key: tls.key + path: tls.key + - key: ca.crt + path: ca.crt + optional: true + secretName: argocd-repo-server-tls + - emptyDir: {} + name: var-files + - emptyDir: {} + name: plugins + - emptyDir: {} + name: tmp-dir + - configMap: + name: argocd-cmp-cm + name: config-files \ No newline at end of file diff --git a/cmp-fileName/readme.md b/cmp-fileName/readme.md new file mode 100644 index 0000000..9c2d7ac --- /dev/null +++ b/cmp-fileName/readme.md @@ -0,0 +1,67 @@ +This is an example of using cmp. + +### create a docker image for your cmp server +``` +docker build -f Dockerfile.maycmp -t /maycmpserver:cmp . +``` + +### plugin-withFilename-config +This is the plugin configuration file. It uses discover.fileName by matching with this pattern. + +### Changes in argocd-repo-server.yaml. +argocd repo server deployment file. The following are added. +added the following to volumes. +``` + volumes: + - emptyDir: {} + name: var-files + - emptyDir: {} + name: plugins + - emptyDir: {} + name: tmp-dir + - configMap: + name: argocd-cmp-cm + name: config-files +``` +added the following to initContainers +``` + initContainers: + - command: + - cp + - -n + - /usr/local/bin/argocd + - /var/run/argocd/argocd-cmp-server + image: quay.io/argoproj/argocd:latest + name: copyutil + volumeMounts: + - mountPath: /var/run/argocd + name: var-files +``` +added the following to argocd-repo-server container +``` +- mountPath: /home/argocd/cmp-server/plugins + name: plugins +``` +added a new side car which uses the docker image built above. +``` + containers: + - name: may + command: [/var/run/argocd/argocd-cmp-server] + image: docker.intuit.com/dev/deploy/argo-cd-tools/service/maycmpserver:cmp + volumeMounts: + - mountPath: /var/run/argocd + name: var-files + - mountPath: /home/argocd/cmp-server/plugins + name: plugins + - mountPath: /tmp + name: tmp-dir +``` + +### Create an app using this plugin +``` +argocd app create maycmp2 --repo https://github.com/mayzhang2000/argocd-example-apps.git --path cmp-fileName --dest-server https://kubernetes.default.svc --dest-namespace default --config-management-plugin cmp-fileName +``` +### Trouble shooting +``` +k exec -it argocd-repo-server-88dc68b5c-rmkmx -c argocd-repo-server sh +```